Bug 4692 fixed: Export did not work while xgetmouse() was waiting 78/14078/3
Calixte DENIZET [Wed, 19 Mar 2014 16:00:51 +0000 (17:00 +0100)]
Change-Id: I1a698689770518b251199d56852a17e3e109f4ce

15 files changed:
scilab/CHANGES_5.5.X
scilab/modules/graphic_objects/includes/ScilabView.hxx
scilab/modules/graphic_objects/src/cpp/ScilabView.cpp
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/ScilabNativeView.java
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/ScilabNativeViewJNI.java
scilab/modules/graphic_objects/src/jni/ScilabNativeView.i
scilab/modules/graphic_objects/src/jni/ScilabNativeView_wrap.c
scilab/modules/gui/etc/graphics_menubar.xml
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/CallScilabBridge.java
scilab/modules/gui/src/java/org/scilab/modules/gui/bridge/filechooser/SwingScilabExportFileChooser.java
scilab/modules/gui/src/java/org/scilab/modules/gui/datatip/DatatipManager.java
scilab/modules/gui/src/java/org/scilab/modules/gui/editor/EditorManager.java
scilab/modules/gui/src/java/org/scilab/modules/gui/events/callback/JavaCallBack.java
scilab/modules/renderer/src/java/org/scilab/modules/renderer/CallRenderer.java
scilab/modules/scirenderer/src/org/scilab/forge/scirenderer/implementation/jogl/JoGLCanvas.java

index 449921b..702cac9 100644 (file)
@@ -233,6 +233,8 @@ Scilab Bug Fixes
 
 * Bug #4677 fixed - xclick did not return correct mouse position on keyboard event.
 
+* Bug #4692 fixed - Export did not work while xgetmouse was waiting.
+
 * Bug #4858 fixed - libintl.h was missing in binary versions but included in localization.h.
 
 * Bug #4965 fixed - Setting links property for a handle of type legend did not work.
index 84dc377..d082aeb 100644 (file)
@@ -29,6 +29,7 @@ extern "C"
     void ScilabNativeView__setCurrentSubWin(int id);
     void ScilabNativeView__setCurrentObject(int id);
     int ScilabNativeView__getValidDefaultFigureId();
+    int ScilabNativeView__getFigureFromIndex(int figNum);
 }
 
 struct PathItem
index 6921128..97a6452 100644 (file)
@@ -71,6 +71,11 @@ int ScilabNativeView__getValidDefaultFigureId()
     return ScilabView::getValidDefaultFigureId();
 }
 
+int ScilabNativeView__getFigureFromIndex(int figNum)
+{
+    return ScilabView::getFigureFromIndex(figNum);
+}
+
 /**
  * \}
  */
index dc25e1c..f012956 100644 (file)
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
+ * Version 2.0.11
  *
  * Do not make changes to this file unless you know what you are doing--modify
  * the SWIG interface file instead.
@@ -37,4 +37,8 @@ public class ScilabNativeView {
         return ScilabNativeViewJNI.ScilabNativeView__getValidDefaultFigureId();
     }
 
+    public static int ScilabNativeView__getFigureFromIndex(int figNum) {
+        return ScilabNativeViewJNI.ScilabNativeView__getFigureFromIndex(figNum);
+    }
+
 }
index eec8f63..740f7b2 100644 (file)
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
+ * Version 2.0.11
  *
  * Do not make changes to this file unless you know what you are doing--modify
  * the SWIG interface file instead.
@@ -26,4 +26,5 @@ public class ScilabNativeViewJNI {
     public final static native void ScilabNativeView__setCurrentSubWin(int jarg1);
     public final static native void ScilabNativeView__setCurrentObject(int jarg1);
     public final static native int ScilabNativeView__getValidDefaultFigureId();
+    public final static native int ScilabNativeView__getFigureFromIndex(int jarg1);
 }
index dca92a7..15f0110 100644 (file)
  *
  */
 
+/**
+ * Windows: swig -java -package org.scilab.modules.graphic_objects -outdir ../java/org/scilab/modules/graphic_objects/ ScilabNativeView.i
+ * Other: Use the option --enable-build-swig to the configure
+*/
+
 %module ScilabNativeView
 
 %pragma(java) jniclasscode=%{
@@ -31,4 +36,5 @@
     extern void ScilabNativeView__setCurrentSubWin(int id);
     extern void ScilabNativeView__setCurrentObject(int id);
     extern int ScilabNativeView__getValidDefaultFigureId();
+    extern int ScilabNativeView__getFigureFromIndex(int figNum);
     %}
index 0f14066..aa0f32e 100644 (file)
@@ -1,11 +1,11 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 2.0.7
- * 
- * This file is not intended to be easily readable and contains a number of 
+ * Version 2.0.11
+ *
+ * This file is not intended to be easily readable and contains a number of
  * coding conventions designed to improve portability and efficiency. Do not make
- * changes to this file unless you know what you are doing--modify the SWIG 
- * interface file instead. 
+ * changes to this file unless you know what you are doing--modify the SWIG
+ * interface file instead.
  * ----------------------------------------------------------------------------- */
 
 #define SWIGJAVA
 #ifndef SWIGUNUSED
 # if defined(__GNUC__)
 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
-#     define SWIGUNUSED __attribute__ ((__unused__)) 
+#     define SWIGUNUSED __attribute__ ((__unused__))
 #   else
 #     define SWIGUNUSED
 #   endif
 # elif defined(__ICC)
-#   define SWIGUNUSED __attribute__ ((__unused__)) 
+#   define SWIGUNUSED __attribute__ ((__unused__))
 # else
-#   define SWIGUNUSED 
+#   define SWIGUNUSED
 # endif
 #endif
 
 #ifndef SWIG_MSC_UNSUPPRESS_4505
 # if defined(_MSC_VER)
 #   pragma warning(disable : 4505) /* unreferenced local function has been removed */
-# endif 
+# endif
 #endif
 
 #ifndef SWIGUNUSEDPARM
 # ifdef __cplusplus
 #   define SWIGUNUSEDPARM(p)
 # else
-#   define SWIGUNUSEDPARM(p) p SWIGUNUSED 
+#   define SWIGUNUSEDPARM(p) p SWIGUNUSED
 # endif
 #endif
 
 #   define SWIGSTDCALL __stdcall
 # else
 #   define SWIGSTDCALL
-# endif 
+# endif
 #endif
 
 /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
 
 /* Fix for jlong on some versions of gcc on Windows */
 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
-  typedef long long __int64;
+typedef long long __int64;
 #endif
 
 /* Fix for jlong on 64-bit x86 Solaris */
 
 
 /* Support for throwing Java exceptions */
-typedef enum {
-  SWIG_JavaOutOfMemoryError = 1, 
-  SWIG_JavaIOException, 
-  SWIG_JavaRuntimeException, 
-  SWIG_JavaIndexOutOfBoundsException,
-  SWIG_JavaArithmeticException,
-  SWIG_JavaIllegalArgumentException,
-  SWIG_JavaNullPointerException,
-  SWIG_JavaDirectorPureVirtual,
-  SWIG_JavaUnknownError
+typedef enum
+{
+    SWIG_JavaOutOfMemoryError = 1,
+    SWIG_JavaIOException,
+    SWIG_JavaRuntimeException,
+    SWIG_JavaIndexOutOfBoundsException,
+    SWIG_JavaArithmeticException,
+    SWIG_JavaIllegalArgumentException,
+    SWIG_JavaNullPointerException,
+    SWIG_JavaDirectorPureVirtual,
+    SWIG_JavaUnknownError
 } SWIG_JavaExceptionCodes;
 
-typedef struct {
-  SWIG_JavaExceptionCodes code;
-  const char *java_exception;
+typedef struct
+{
+    SWIG_JavaExceptionCodes code;
+    const char *java_exception;
 } SWIG_JavaExceptions_t;
 
 
-static void SWIGUNUSED SWIG_JavaThrowException(JNIEnv *jenv, SWIG_JavaExceptionCodes code, const char *msg) {
-  jclass excep;
-  static const SWIG_JavaExceptions_t java_exceptions[] = {
-    { SWIG_JavaOutOfMemoryError, "java/lang/OutOfMemoryError" },
-    { SWIG_JavaIOException, "java/io/IOException" },
-    { SWIG_JavaRuntimeException, "java/lang/RuntimeException" },
-    { SWIG_JavaIndexOutOfBoundsException, "java/lang/IndexOutOfBoundsException" },
-    { SWIG_JavaArithmeticException, "java/lang/ArithmeticException" },
-    { SWIG_JavaIllegalArgumentException, "java/lang/IllegalArgumentException" },
-    { SWIG_JavaNullPointerException, "java/lang/NullPointerException" },
-    { SWIG_JavaDirectorPureVirtual, "java/lang/RuntimeException" },
-    { SWIG_JavaUnknownError,  "java/lang/UnknownError" },
-    { (SWIG_JavaExceptionCodes)0,  "java/lang/UnknownError" }
-  };
-  const SWIG_JavaExceptions_t *except_ptr = java_exceptions;
-
-  while (except_ptr->code != code && except_ptr->code)
-    except_ptr++;
-
-  (*jenv)->ExceptionClear(jenv);
-  excep = (*jenv)->FindClass(jenv, except_ptr->java_exception);
-  if (excep)
-    (*jenv)->ThrowNew(jenv, excep, msg);
+static void SWIGUNUSED SWIG_JavaThrowException(JNIEnv *jenv, SWIG_JavaExceptionCodes code, const char *msg)
+{
+    jclass excep;
+    static const SWIG_JavaExceptions_t java_exceptions[] =
+    {
+        { SWIG_JavaOutOfMemoryError, "java/lang/OutOfMemoryError" },
+        { SWIG_JavaIOException, "java/io/IOException" },
+        { SWIG_JavaRuntimeException, "java/lang/RuntimeException" },
+        { SWIG_JavaIndexOutOfBoundsException, "java/lang/IndexOutOfBoundsException" },
+        { SWIG_JavaArithmeticException, "java/lang/ArithmeticException" },
+        { SWIG_JavaIllegalArgumentException, "java/lang/IllegalArgumentException" },
+        { SWIG_JavaNullPointerException, "java/lang/NullPointerException" },
+        { SWIG_JavaDirectorPureVirtual, "java/lang/RuntimeException" },
+        { SWIG_JavaUnknownError,  "java/lang/UnknownError" },
+        { (SWIG_JavaExceptionCodes)0,  "java/lang/UnknownError" }
+    };
+    const SWIG_JavaExceptions_t *except_ptr = java_exceptions;
+
+    while (except_ptr->code != code && except_ptr->code)
+    {
+        except_ptr++;
+    }
+
+    (*jenv)->ExceptionClear(jenv);
+    excep = (*jenv)->FindClass(jenv, except_ptr->java_exception);
+    if (excep)
+    {
+        (*jenv)->ThrowNew(jenv, excep, msg);
+    }
 }
 
 
@@ -187,90 +195,113 @@ static void SWIGUNUSED SWIG_JavaThrowException(JNIEnv *jenv, SWIG_JavaExceptionC
 #define SWIG_contract_assert(nullreturn, expr, msg) if (!(expr)) {SWIG_JavaThrowException(jenv, SWIG_JavaIllegalArgumentException, msg); return nullreturn; } else
 
 
-    extern void ScilabNativeView__createObject(int id);
-    extern void ScilabNativeView__deleteObject(int id);
-    extern void ScilabNativeView__updateObject(int id, int iProperty);
-    extern void ScilabNativeView__setCurrentFigure(int id);
-    extern void ScilabNativeView__setCurrentSubWin(int id);
-    extern void ScilabNativeView__setCurrentObject(int id);
-    extern int ScilabNativeView__getValidDefaultFigureId();
-    
+extern void ScilabNativeView__createObject(int id);
+extern void ScilabNativeView__deleteObject(int id);
+extern void ScilabNativeView__updateObject(int id, int iProperty);
+extern void ScilabNativeView__setCurrentFigure(int id);
+extern void ScilabNativeView__setCurrentSubWin(int id);
+extern void ScilabNativeView__setCurrentObject(int id);
+extern int ScilabNativeView__getValidDefaultFigureId();
+extern int ScilabNativeView__getFigureFromIndex(int figNum);
+
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-SWIGEXPORT void JNICALL Java_org_scilab_modules_graphic_1objects_ScilabNativeViewJNI_ScilabNativeView_1_1createObject(JNIEnv *jenv, jclass jcls, jint jarg1) {
-  int arg1 ;
-  
-  (void)jenv;
-  (void)jcls;
-  arg1 = (int)jarg1; 
-  ScilabNativeView__createObject(arg1);
+SWIGEXPORT void JNICALL Java_org_scilab_modules_graphic_1objects_ScilabNativeViewJNI_ScilabNativeView_1_1createObject(JNIEnv *jenv, jclass jcls, jint jarg1)
+{
+    int arg1 ;
+
+    (void)jenv;
+    (void)jcls;
+    arg1 = (int)jarg1;
+    ScilabNativeView__createObject(arg1);
+}
+
+
+SWIGEXPORT void JNICALL Java_org_scilab_modules_graphic_1objects_ScilabNativeViewJNI_ScilabNativeView_1_1deleteObject(JNIEnv *jenv, jclass jcls, jint jarg1)
+{
+    int arg1 ;
+
+    (void)jenv;
+    (void)jcls;
+    arg1 = (int)jarg1;
+    ScilabNativeView__deleteObject(arg1);
 }
 
 
-SWIGEXPORT void JNICALL Java_org_scilab_modules_graphic_1objects_ScilabNativeViewJNI_ScilabNativeView_1_1deleteObject(JNIEnv *jenv, jclass jcls, jint jarg1) {
-  int arg1 ;
-  
-  (void)jenv;
-  (void)jcls;
-  arg1 = (int)jarg1; 
-  ScilabNativeView__deleteObject(arg1);
+SWIGEXPORT void JNICALL Java_org_scilab_modules_graphic_1objects_ScilabNativeViewJNI_ScilabNativeView_1_1updateObject(JNIEnv *jenv, jclass jcls, jint jarg1, jint jarg2)
+{
+    int arg1 ;
+    int arg2 ;
+
+    (void)jenv;
+    (void)jcls;
+    arg1 = (int)jarg1;
+    arg2 = (int)jarg2;
+    ScilabNativeView__updateObject(arg1, arg2);
 }
 
 
-SWIGEXPORT void JNICALL Java_org_scilab_modules_graphic_1objects_ScilabNativeViewJNI_ScilabNativeView_1_1updateObject(JNIEnv *jenv, jclass jcls, jint jarg1, jint jarg2) {
-  int arg1 ;
-  int arg2 ;
-  
-  (void)jenv;
-  (void)jcls;
-  arg1 = (int)jarg1; 
-  arg2 = (int)jarg2; 
-  ScilabNativeView__updateObject(arg1,arg2);
+SWIGEXPORT void JNICALL Java_org_scilab_modules_graphic_1objects_ScilabNativeViewJNI_ScilabNativeView_1_1setCurrentFigure(JNIEnv *jenv, jclass jcls, jint jarg1)
+{
+    int arg1 ;
+
+    (void)jenv;
+    (void)jcls;
+    arg1 = (int)jarg1;
+    ScilabNativeView__setCurrentFigure(arg1);
 }
 
 
-SWIGEXPORT void JNICALL Java_org_scilab_modules_graphic_1objects_ScilabNativeViewJNI_ScilabNativeView_1_1setCurrentFigure(JNIEnv *jenv, jclass jcls, jint jarg1) {
-  int arg1 ;
-  
-  (void)jenv;
-  (void)jcls;
-  arg1 = (int)jarg1; 
-  ScilabNativeView__setCurrentFigure(arg1);
+SWIGEXPORT void JNICALL Java_org_scilab_modules_graphic_1objects_ScilabNativeViewJNI_ScilabNativeView_1_1setCurrentSubWin(JNIEnv *jenv, jclass jcls, jint jarg1)
+{
+    int arg1 ;
+
+    (void)jenv;
+    (void)jcls;
+    arg1 = (int)jarg1;
+    ScilabNativeView__setCurrentSubWin(arg1);
 }
 
 
-SWIGEXPORT void JNICALL Java_org_scilab_modules_graphic_1objects_ScilabNativeViewJNI_ScilabNativeView_1_1setCurrentSubWin(JNIEnv *jenv, jclass jcls, jint jarg1) {
-  int arg1 ;
-  
-  (void)jenv;
-  (void)jcls;
-  arg1 = (int)jarg1; 
-  ScilabNativeView__setCurrentSubWin(arg1);
+SWIGEXPORT void JNICALL Java_org_scilab_modules_graphic_1objects_ScilabNativeViewJNI_ScilabNativeView_1_1setCurrentObject(JNIEnv *jenv, jclass jcls, jint jarg1)
+{
+    int arg1 ;
+
+    (void)jenv;
+    (void)jcls;
+    arg1 = (int)jarg1;
+    ScilabNativeView__setCurrentObject(arg1);
 }
 
 
-SWIGEXPORT void JNICALL Java_org_scilab_modules_graphic_1objects_ScilabNativeViewJNI_ScilabNativeView_1_1setCurrentObject(JNIEnv *jenv, jclass jcls, jint jarg1) {
-  int arg1 ;
-  
-  (void)jenv;
-  (void)jcls;
-  arg1 = (int)jarg1; 
-  ScilabNativeView__setCurrentObject(arg1);
+SWIGEXPORT jint JNICALL Java_org_scilab_modules_graphic_1objects_ScilabNativeViewJNI_ScilabNativeView_1_1getValidDefaultFigureId(JNIEnv *jenv, jclass jcls)
+{
+    jint jresult = 0 ;
+    int result;
+
+    (void)jenv;
+    (void)jcls;
+    result = (int)ScilabNativeView__getValidDefaultFigureId();
+    jresult = (jint)result;
+    return jresult;
 }
 
 
-SWIGEXPORT jint JNICALL Java_org_scilab_modules_graphic_1objects_ScilabNativeViewJNI_ScilabNativeView_1_1getValidDefaultFigureId(JNIEnv *jenv, jclass jcls) {
-  jint jresult = 0 ;
-  int result;
-  
-  (void)jenv;
-  (void)jcls;
-  result = (int)ScilabNativeView__getValidDefaultFigureId();
-  jresult = (jint)result; 
-  return jresult;
+SWIGEXPORT jint JNICALL Java_org_scilab_modules_graphic_1objects_ScilabNativeViewJNI_ScilabNativeView_1_1getFigureFromIndex(JNIEnv *jenv, jclass jcls, jint jarg1)
+{
+    jint jresult = 0 ;
+    int arg1 ;
+    int result;
+
+    (void)jenv;
+    (void)jcls;
+    arg1 = (int)jarg1;
+    result = (int)ScilabNativeView__getFigureFromIndex(arg1);
+    jresult = (jint)result;
+    return jresult;
 }
 
 
index 74a39a7..99b3839 100644 (file)
         </submenu>
         <separator/>
         <submenu label="&amp;Export to..." accelerator="OSSCKEY E">
-            <callback instruction='exportUI([SCILAB_FIGURE_ID])' type="0"/>
+            <callback instruction='org.scilab.modules.gui.bridge.CallScilabBridge.exportUI([SCILAB_FIGURE_ID])' type="3"/>
         </submenu>
         <submenu label="&amp;Copy to clipboard" accelerator="OSSCKEY C" icon="edit-copy">
-            <callback instruction='clipboard([SCILAB_FIGURE_ID], "EMF");' type="0"/>
+            <callback instruction='org.scilab.modules.gui.bridge.CallScilabBridge.clipboard_figure([SCILAB_FIGURE_ID])' type="3"/>
         </submenu>
         <separator/>
         <submenu label="P&amp;age setup...">
             <callback instruction='org.scilab.modules.gui.bridge.CallScilabBridge.pageSetup' type="3"/>
         </submenu>
         <submenu label="&amp;Print..." accelerator="OSSCKEY P" icon="document-print">
-            <callback instruction='printfigure([SCILAB_FIGURE_ID]);' type="0"/>
+            <callback instruction='org.scilab.modules.gui.bridge.CallScilabBridge.print_figure([SCILAB_FIGURE_ID])' type="3"/>
         </submenu>
         <separator/>
         <submenu label="C&amp;lose" accelerator="OSSCKEY W">
@@ -72,7 +72,7 @@
         </submenu>
         <separator/>
         <submenu label="&amp;Zoom" icon="zoom-fit-selection">
-            <callback instruction='zoom_rect(get_figure_handle([SCILAB_FIGURE_ID]))' type="0"/>
+            <callback instruction='org.scilab.modules.renderer.CallRenderer.start_zoom([SCILAB_FIGURE_ID])' type="3"/>
         </submenu>
         <submenu label="&amp;Original View" icon="zoom-original">
             <callback instruction='unzoom(get_figure_handle([SCILAB_FIGURE_ID]))' type="0"/>
         </submenu>
         <separator/>
         <submenu label="&amp;Start datatip manager" icon="datatips">
-            <callback instruction='datatipManagerMode(get_figure_handle([SCILAB_FIGURE_ID]), %t)' type="-2"/>
+            <callback instruction='org.scilab.modules.gui.datatip.DatatipManager.start([SCILAB_FIGURE_ID])' type="3"/>
         </submenu>
         <submenu label="Stop datatip manager">
-            <callback instruction='datatipManagerMode(get_figure_handle([SCILAB_FIGURE_ID]), %f)' type="-2"/>
+            <callback instruction='org.scilab.modules.gui.datatip.DatatipManager.stop([SCILAB_FIGURE_ID])' type="3"/>
         </submenu>
         
         <submenu label="Start curve data modification" icon="data_modify">
-            <callback instruction='useeditor([SCILAB_FIGURE_ID], %t);' type="0"/>
+            <callback instruction='org.scilab.modules.gui.editor.EditorManager.start([SCILAB_FIGURE_ID])' type="3"/>
         </submenu>
         <submenu label="Stop curve data modification">
-            <callback instruction='useeditor([SCILAB_FIGURE_ID], %f);' type="0"/>
+            <callback instruction='org.scilab.modules.gui.editor.EditorManager.stop([SCILAB_FIGURE_ID])' type="3"/>
         </submenu>
         
         <!--
         </submenu>
         <separator/>
         <submenu label="&amp;About Scilab..." accelerator="shift F1">
-            <callback instruction='about()' type="0"/>
+            <callback instruction='org.scilab.modules.gui.bridge.CallScilabBridge.scilabAboutBox' type="3"/>
         </submenu>
     </menu>
 </menubar>
index 9d887a1..7b350dc 100644 (file)
@@ -50,6 +50,7 @@ import javax.swing.text.Document;
 import org.scilab.modules.commons.ScilabCommons;
 import org.scilab.modules.console.SciConsole;
 import org.scilab.modules.graphic_export.FileExporter;
+import org.scilab.modules.graphic_objects.ScilabNativeView;
 import org.scilab.modules.graphic_objects.figure.Figure;
 import org.scilab.modules.graphic_objects.graphicController.GraphicController;
 import org.scilab.modules.gui.SwingView;
@@ -293,13 +294,20 @@ public class CallScilabBridge {
      * @param figureId id of the figure to export
      * @return the ID of the File Chooser in the UIElementMapper
      */
-
     public static int newExportFileChooser(int figureId) {
         FileChooser fileChooser = ScilabFileChooser.createExportFileChooser(figureId);
         return 0;
     }
 
-
+    /**
+     * Create a new Graphic Export File Chooser in Scilab GUIs
+     * @param figureId id of the figure to export
+     * @return the ID of the File Chooser in the UIElementMapper
+     */
+    public static int exportUI(int figureId) {
+        FileChooser fileChooser = ScilabFileChooser.createExportFileChooser(ScilabNativeView.ScilabNativeView__getFigureFromIndex(figureId));
+        return 0;
+    }
 
     /**********************/
     /*                    */
@@ -839,8 +847,8 @@ public class CallScilabBridge {
      * @param figID the ID of the figure to print
      * @return execution status
      */
-    public static boolean printFigure(int figID) {
-        return printFigure(figID, true, true);
+    public static boolean print_figure(int figureId) {
+        return printFigure(ScilabNativeView.ScilabNativeView__getFigureFromIndex(figureId), true, true);
     }
 
     /**
@@ -1144,6 +1152,14 @@ public class CallScilabBridge {
      * Copy figure to clipboard
      * @param figID the ID of the figure
      */
+    public static void clipboard_figure(int figureId) {
+        copyFigureToClipBoard(ScilabNativeView.ScilabNativeView__getFigureFromIndex(figureId));
+    }
+
+    /**
+     * Copy figure to clipboard
+     * @param figID the ID of the figure
+     */
     public static void copyFigureToClipBoard(int figID) {
         Image figureImage = ImageExporter.imageExport(figID);
         if (figureImage != null) {
index 74caebf..4648f19 100644 (file)
@@ -159,11 +159,6 @@ public class SwingScilabExportFileChooser extends SwingScilabFileChooser {
         if (selection == JFileChooser.APPROVE_OPTION && super.getSelectedFile() != null) {
             this.exportName = super.getSelectedFile().getAbsolutePath();
 
-            //Test if there is a file with the same name
-            if (!canWriteFile(this.exportName)) {
-                return;
-            }
-
             /* Bug 3849 fix */
             ConfigManager.saveLastOpenedDirectory(new File(exportName).getParentFile().getPath());
 
index ac99ad5..99e4511 100644 (file)
 
 package org.scilab.modules.gui.datatip;
 
-
 import java.util.HashMap;
 import java.util.Map;
 
+import org.scilab.modules.graphic_objects.ScilabNativeView;
+
 /**
  * Manages all the datatipManagerMode.
  *
@@ -41,6 +42,14 @@ public class DatatipManager {
         return tipManagerMode;
     }
 
+    public static void start(int figureId) {
+        setEnabled(ScilabNativeView.ScilabNativeView__getFigureFromIndex(figureId), true);
+    }
+
+    public static void stop(int figureId) {
+        setEnabled(ScilabNativeView.ScilabNativeView__getFigureFromIndex(figureId), false);
+    }
+
     /**
      * Enables the DatatipManagerMode which belongs to the given figure uid.
      * @param figureUid Figure wich the editor belongs.
index 6ebaf67..f64610b 100644 (file)
 
 package org.scilab.modules.gui.editor;
 
-
 import java.util.HashMap;
 import java.util.Map;
 
+import org.scilab.modules.graphic_objects.ScilabNativeView;
+
 /**
  * Manages all the editors.
  *
@@ -42,6 +43,14 @@ public class EditorManager {
         return editor;
     }
 
+    public static void start(int figureId) {
+        enableModify(ScilabNativeView.ScilabNativeView__getFigureFromIndex(figureId));
+    }
+
+    public static void stop(int figureId) {
+        disableModify(ScilabNativeView.ScilabNativeView__getFigureFromIndex(figureId));
+    }
+
     /**
      * Enables the editor which belongs to the given figure uid.
      * @param figureUid Figure wich the editor belongs.
index 7b2a7b4..3e52151 100644 (file)
@@ -14,6 +14,8 @@ package org.scilab.modules.gui.events.callback;
 import java.awt.event.ActionEvent;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
 
 import org.scilab.modules.graphic_objects.graphicObject.CallBack;
 
@@ -24,8 +26,20 @@ import org.scilab.modules.graphic_objects.graphicObject.CallBack;
 public abstract class JavaCallBack extends CommonCallBack {
 
     private static final long serialVersionUID = -6513057558261299432L;
-
     private static final String DOT = ".";
+    private static final Map<Class, ArgConverter> converters = new HashMap<Class, ArgConverter>();
+
+    static {
+        converters.put(int.class, new ArgConverter() {
+            public Object convert(String s) {
+                try {
+                    return Integer.decode(s);
+                } catch (Exception e) {
+                    return null;
+                }
+            }
+        });
+    }
 
     /**
      * @param command : the command to execute.
@@ -46,13 +60,33 @@ public abstract class JavaCallBack extends CommonCallBack {
 
             public void callBack() {
                 try {
-                    int lastPoint = getCommand().lastIndexOf(DOT);
+                    String cmd = getCommand();
+                    String args = null;
+                    int fpindex = cmd.indexOf('(');
+                    int lpindex = cmd.lastIndexOf(')');
+                    if (fpindex != -1 && lpindex != -1) {
+                        args = cmd.substring(fpindex + 1, lpindex);
+                        cmd = cmd.substring(0, fpindex);
+                    }
+
+                    int lastPoint = cmd.lastIndexOf(DOT);
                     Class invokedClass;
-                    invokedClass = Class.forName(getCommand().substring(0, lastPoint));
-                    Method runMe;
-                    runMe = invokedClass.getMethod(getCommand().substring(lastPoint + 1));
-                    // Only able to launch method Class.
-                    runMe.invoke(invokedClass.getClass(), (Object[]) null);
+                    invokedClass = Class.forName(cmd.substring(0, lastPoint));
+                    String methName = cmd.substring(lastPoint + 1);
+
+                    if (args == null) {
+                        Method runMe = invokedClass.getMethod(methName);
+                        // Only able to launch method Class.
+                        runMe.invoke(invokedClass.getClass(), (Object[]) null);
+                    } else {
+                        Method[] meths = invokedClass.getMethods();
+                        for (Method m : meths) {
+                            if (m.getName().equals(methName)) {
+                                m.invoke(invokedClass.getClass(), getArguments(m, args));
+                                break;
+                            }
+                        }
+                    }
                 } catch (ClassNotFoundException e) {
                     e.printStackTrace();
                 } catch (SecurityException e) {
@@ -109,4 +143,26 @@ public abstract class JavaCallBack extends CommonCallBack {
             }
         });
     }
+
+    private interface ArgConverter {
+        public Object convert(String s);
+    }
+
+    private static Object[] getArguments(Method m, String arg) {
+        Class<?>[] types = m.getParameterTypes();
+        if (types.length == 0 || arg == null || arg.isEmpty()) {
+            return null;
+        }
+
+        String[] args = arg.split(",");
+        final int l = Math.min(types.length, args.length);
+        Object[] _args = new Object[l];
+        for (int i = 0; i < l; i++) {
+            if (converters.containsKey(types[i])) {
+                _args[i] = converters.get(types[i]).convert(args[i].trim());
+            }
+        }
+
+        return _args;
+    }
 }
index 2ee75f2..2c0e5ef 100644 (file)
@@ -12,6 +12,7 @@
 
 package org.scilab.modules.renderer;
 
+import org.scilab.modules.graphic_objects.ScilabNativeView;
 import org.scilab.modules.graphic_objects.axes.Axes;
 import org.scilab.modules.graphic_objects.graphicController.GraphicController;
 import org.scilab.modules.graphic_objects.graphicObject.GraphicObject;
@@ -41,6 +42,10 @@ public final class CallRenderer {
         }
     }
 
+    public static void start_zoom(int figureId) {
+        startInteractiveZoom(ScilabNativeView.ScilabNativeView__getFigureFromIndex(figureId));
+    }
+
     public static double[] clickRubberBox(int id, double initialRect[]) {
         DrawerVisitor visitor = DrawerVisitor.getVisitor(id);
         if (visitor != null) {
index a15ec55..96c0f92 100644 (file)
@@ -175,7 +175,7 @@ public final class JoGLCanvas implements Canvas, GLEventListener {
     @Override
     public void redrawAndWait() {
         if (SwingUtilities.isEventDispatchThread()) {
-            if (autoDrawable!= null) {
+            if (autoDrawable != null) {
                 autoDrawable.display();
             }
             return;
@@ -242,19 +242,25 @@ public final class JoGLCanvas implements Canvas, GLEventListener {
         final BufferedImage[] image = new BufferedImage[1];
         final GLContext context = autoDrawable.getContext();
 
-        try {
-            SwingUtilities.invokeAndWait(new Runnable() {
-                public void run() {
-                    context.makeCurrent();
-                    image[0] = Screenshot.readToBufferedImage(autoDrawable.getWidth(), autoDrawable.getHeight());
-                    context.release();
-                }
-            });
-        } catch (InterruptedException e) {
+        if (SwingUtilities.isEventDispatchThread()) {
+            context.makeCurrent();
+            image[0] = Screenshot.readToBufferedImage(autoDrawable.getWidth(), autoDrawable.getHeight());
+            context.release();
+        } else {
+            try {
+                SwingUtilities.invokeAndWait(new Runnable() {
+                    public void run() {
+                        context.makeCurrent();
+                        image[0] = Screenshot.readToBufferedImage(autoDrawable.getWidth(), autoDrawable.getHeight());
+                        context.release();
+                    }
+                });
+            } catch (InterruptedException e) {
 
-        } catch (InvocationTargetException e) {
-            System.err.println(e);
-            e.printStackTrace();
+            } catch (InvocationTargetException e) {
+                System.err.println(e);
+                e.printStackTrace();
+            }
         }
 
         return image[0];