Implementation of function datatipSetOrientation() for the new datatip object. 78/12378/1
Gustavo LIBOTTE [Wed, 28 Aug 2013 16:31:08 +0000 (13:31 -0300)]
Change-Id: Ie155b592a46baf1f8fbf56059987268b68c2d1f5

12 files changed:
scilab/modules/gui/Makefile.am
scilab/modules/gui/Makefile.in
scilab/modules/gui/includes/gw_gui.h
scilab/modules/gui/sci_gateway/c/gw_gui.c
scilab/modules/gui/sci_gateway/cpp/sci_datatip_set_orient.cpp [new file with mode: 0644]
scilab/modules/gui/sci_gateway/gui_gateway.xml
scilab/modules/gui/src/c/gui.vcxproj
scilab/modules/gui/src/c/gui.vcxproj.filters
scilab/modules/gui/src/java/org/scilab/modules/gui/datatip/DatatipOrientation.java
scilab/modules/gui/src/jni/Datatip.giws.xml
scilab/modules/gui/src/jni/DatatipOrientation.cpp [new file with mode: 0644]
scilab/modules/gui/src/jni/DatatipOrientation.hxx [new file with mode: 0644]

index 57cefea..2f82818 100755 (executable)
@@ -138,7 +138,8 @@ src/jni/DatatipManager.cpp \
 src/jni/DatatipCreate.cpp \
 src/jni/DatatipDelete.cpp \
 src/jni/DatatipDrag.cpp \
-src/jni/DatatipSetStyle.cpp
+src/jni/DatatipSetStyle.cpp \
+src/jni/DatatipOrientation.cpp
 
 GIWS_WRAPPERS = \
 src/jni/SwingView.giws.xml \
@@ -214,7 +215,8 @@ sci_gateway/cpp/sci_datatip_toggle.cpp \
 sci_gateway/cpp/sci_datatipmove.cpp \
 sci_gateway/cpp/sci_datatip_set_style.cpp \
 sci_gateway/cpp/sci_datatip_set_display.cpp \
-sci_gateway/cpp/sci_datatip_set_interp.cpp
+sci_gateway/cpp/sci_datatip_set_interp.cpp \
+sci_gateway/cpp/sci_datatip_set_orient.cpp
 
 libscigui_la_CPPFLAGS = \
                        -I$(srcdir)/includes/ \
index d7446a4..4813c54 100644 (file)
@@ -234,7 +234,8 @@ am__objects_2 = libscigui_algo_la-InitUIMenu.lo \
        libscigui_algo_la-DatatipCreate.lo \
        libscigui_algo_la-DatatipDelete.lo \
        libscigui_algo_la-DatatipDrag.lo \
-       libscigui_algo_la-DatatipSetStyle.lo
+       libscigui_algo_la-DatatipSetStyle.lo \
+       libscigui_algo_la-DatatipOrientation.lo
 am_libscigui_algo_la_OBJECTS = $(am__objects_1) $(am__objects_2)
 libscigui_algo_la_OBJECTS = $(am_libscigui_algo_la_OBJECTS)
 @GUI_TRUE@am_libscigui_algo_la_rpath =
@@ -276,7 +277,8 @@ am__objects_5 = libscigui_la-sci_printsetupbox.lo \
        libscigui_la-sci_datatipmove.lo \
        libscigui_la-sci_datatip_set_style.lo \
        libscigui_la-sci_datatip_set_display.lo \
-       libscigui_la-sci_datatip_set_interp.lo
+       libscigui_la-sci_datatip_set_interp.lo \
+       libscigui_la-sci_datatip_set_orient.lo
 am_libscigui_la_OBJECTS = $(am__objects_4) $(am__objects_5)
 libscigui_la_OBJECTS = $(am_libscigui_la_OBJECTS)
 @GUI_TRUE@am_libscigui_la_rpath = -rpath $(pkglibdir)
@@ -699,7 +701,8 @@ src/jni/DatatipManager.cpp \
 src/jni/DatatipCreate.cpp \
 src/jni/DatatipDelete.cpp \
 src/jni/DatatipDrag.cpp \
-src/jni/DatatipSetStyle.cpp
+src/jni/DatatipSetStyle.cpp \
+src/jni/DatatipOrientation.cpp
 
 GIWS_WRAPPERS = \
 src/jni/SwingView.giws.xml \
@@ -767,7 +770,8 @@ sci_gateway/cpp/sci_datatip_toggle.cpp \
 sci_gateway/cpp/sci_datatipmove.cpp \
 sci_gateway/cpp/sci_datatip_set_style.cpp \
 sci_gateway/cpp/sci_datatip_set_display.cpp \
-sci_gateway/cpp/sci_datatip_set_interp.cpp
+sci_gateway/cpp/sci_datatip_set_interp.cpp \
+sci_gateway/cpp/sci_datatip_set_orient.cpp
 
 libscigui_la_CPPFLAGS = \
                        -I$(srcdir)/includes/ \
@@ -1133,6 +1137,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigui_algo_la-DatatipDelete.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigui_algo_la-DatatipDrag.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigui_algo_la-DatatipManager.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigui_algo_la-DatatipOrientation.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigui_algo_la-DatatipSetStyle.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigui_algo_la-EditorManager.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigui_algo_la-GetConsoleShowHiddenHandles.Plo@am__quote@
@@ -1213,6 +1218,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigui_la-sci_datatip_manager_mode.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigui_la-sci_datatip_set_display.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigui_la-sci_datatip_set_interp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigui_la-sci_datatip_set_orient.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigui_la-sci_datatip_set_style.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigui_la-sci_datatip_toggle.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libscigui_la-sci_datatipcreate.Plo@am__quote@
@@ -2097,6 +2103,13 @@ libscigui_algo_la-DatatipSetStyle.lo: src/jni/DatatipSetStyle.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-DatatipSetStyle.lo `test -f 'src/jni/DatatipSetStyle.cpp' || echo '$(srcdir)/'`src/jni/DatatipSetStyle.cpp
 
+libscigui_algo_la-DatatipOrientation.lo: src/jni/DatatipOrientation.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-DatatipOrientation.lo -MD -MP -MF $(DEPDIR)/libscigui_algo_la-DatatipOrientation.Tpo -c -o libscigui_algo_la-DatatipOrientation.lo `test -f 'src/jni/DatatipOrientation.cpp' || echo '$(srcdir)/'`src/jni/DatatipOrientation.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscigui_algo_la-DatatipOrientation.Tpo $(DEPDIR)/libscigui_algo_la-DatatipOrientation.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='src/jni/DatatipOrientation.cpp' object='libscigui_algo_la-DatatipOrientation.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-DatatipOrientation.lo `test -f 'src/jni/DatatipOrientation.cpp' || echo '$(srcdir)/'`src/jni/DatatipOrientation.cpp
+
 libscigui_la-sci_printsetupbox.lo: sci_gateway/cpp/sci_printsetupbox.cpp
 @am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigui_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscigui_la-sci_printsetupbox.lo -MD -MP -MF $(DEPDIR)/libscigui_la-sci_printsetupbox.Tpo -c -o libscigui_la-sci_printsetupbox.lo `test -f 'sci_gateway/cpp/sci_printsetupbox.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_printsetupbox.cpp
 @am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscigui_la-sci_printsetupbox.Tpo $(DEPDIR)/libscigui_la-sci_printsetupbox.Plo
@@ -2272,6 +2285,13 @@ libscigui_la-sci_datatip_set_interp.lo: sci_gateway/cpp/sci_datatip_set_interp.c
 @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_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscigui_la-sci_datatip_set_interp.lo `test -f 'sci_gateway/cpp/sci_datatip_set_interp.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_datatip_set_interp.cpp
 
+libscigui_la-sci_datatip_set_orient.lo: sci_gateway/cpp/sci_datatip_set_orient.cpp
+@am__fastdepCXX_TRUE@  $(LIBTOOL)  --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscigui_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libscigui_la-sci_datatip_set_orient.lo -MD -MP -MF $(DEPDIR)/libscigui_la-sci_datatip_set_orient.Tpo -c -o libscigui_la-sci_datatip_set_orient.lo `test -f 'sci_gateway/cpp/sci_datatip_set_orient.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_datatip_set_orient.cpp
+@am__fastdepCXX_TRUE@  $(am__mv) $(DEPDIR)/libscigui_la-sci_datatip_set_orient.Tpo $(DEPDIR)/libscigui_la-sci_datatip_set_orient.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='sci_gateway/cpp/sci_datatip_set_orient.cpp' object='libscigui_la-sci_datatip_set_orient.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_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libscigui_la-sci_datatip_set_orient.lo `test -f 'sci_gateway/cpp/sci_datatip_set_orient.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_datatip_set_orient.cpp
+
 mostlyclean-libtool:
        -rm -f *.lo
 
index 69b7ffe..059bb98 100755 (executable)
@@ -65,6 +65,7 @@ GUI_IMPEXP int sci_datatipmove(char *fname, unsigned long fname_len);
 GUI_IMPEXP int sci_datatip_set_style(char *fname, unsigned long fname_len);
 GUI_IMPEXP int sci_datatip_set_display(char *fname, unsigned long fname_len);
 GUI_IMPEXP int sci_datatip_set_interp(char *fname, unsigned long fname_len);
+GUI_IMPEXP int sci_datatip_set_orient(char *fname, unsigned long fname_len);
 /*--------------------------------------------------------------------------*/
 #endif /*  __GW_GUI__ */
 /*--------------------------------------------------------------------------*/
index 83e7029..2a0102f 100755 (executable)
@@ -72,7 +72,8 @@ static gw_generic_table Tab[] =
     {sci_datatipmove, "datatipMove"},
     {sci_datatip_set_style, "datatipSetStyle"},
     {sci_datatip_set_display, "datatipSetDisplay"},
-    {sci_datatip_set_interp, "datatipSetInterp"}
+    {sci_datatip_set_interp, "datatipSetInterp"},
+    {sci_datatip_set_orient, "datatipSetOrientation"}
 };
 /*--------------------------------------------------------------------------*/
 int gw_gui(void)
diff --git a/scilab/modules/gui/sci_gateway/cpp/sci_datatip_set_orient.cpp b/scilab/modules/gui/sci_gateway/cpp/sci_datatip_set_orient.cpp
new file mode 100644 (file)
index 0000000..92ec780
--- /dev/null
@@ -0,0 +1,182 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2013 - Gustavo Barbosa Libotte <gustavolibotte@gmail.com>
+ *
+ * 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 "DatatipOrientation.hxx"
+
+extern "C"
+{
+#include "api_scilab.h"
+#include "getScilabJavaVM.h"
+#include "localization.h"
+#include "Scierror.h"
+#include "gw_gui.h"
+#include "HandleManagement.h"
+#include "getGraphicObjectProperty.h"
+#include "graphicObjectProperties.h"
+#include "string.h"
+}
+
+using namespace org_scilab_modules_gui_datatip;
+
+int sci_datatip_set_orient(char *fname, unsigned long fname_len)
+{
+
+    SciErr sciErr;
+    CheckInputArgument(pvApiCtx, 2, 2);
+    CheckOutputArgument(pvApiCtx, 0, 1);
+
+    int nbRow = 0, nbCol = 0, stkAdr = 0;
+    char* datatipUID = NULL;
+    int iType = 0;
+    int *piType = &iType;
+    int* piAddr = NULL;
+    int iRet = 0;
+    int compVar = 0;
+
+    if (nbInputArgument(pvApiCtx) == 2)
+    {
+
+        GetRhsVar(1, GRAPHICAL_HANDLE_DATATYPE, &nbRow, &nbCol, &stkAdr);
+        datatipUID = (char *)getObjectFromHandle((unsigned long) * (hstk(stkAdr)));
+
+        if (checkInputArgumentType(pvApiCtx, 1, sci_handles))
+        {
+
+            getGraphicObjectProperty(datatipUID, __GO_TYPE__, jni_int, (void**) &piType);
+            if (iType == __GO_DATATIP__)
+            {
+
+                if (checkInputArgumentType(pvApiCtx, 2, sci_strings))
+                {
+
+                    sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddr);
+                    if (sciErr.iErr)
+                    {
+                        printError(&sciErr, 0);
+                        return 0;
+                    }
+
+                    if (isScalar(pvApiCtx, piAddr))
+                    {
+
+                        char* pstData = NULL;
+
+                        iRet = getAllocatedSingleString(pvApiCtx, piAddr, &pstData);
+                        if (iRet)
+                        {
+                            freeAllocatedSingleString(pstData);
+                            return iRet;
+                        }
+
+                        compVar = strcmp(pstData, "upper left");
+                        if (compVar == 0)
+                        {
+                            DatatipOrientation::datatipSetOrientation(getScilabJavaVM(), (char*)datatipUID, (char*)pstData, 0);
+                            freeAllocatedSingleString(pstData);
+                            LhsVar(1) = 0;
+                            PutLhsVar();
+                            return TRUE;
+                        }
+
+                        compVar = strcmp(pstData, "upper right");
+                        if (compVar == 0)
+                        {
+                            DatatipOrientation::datatipSetOrientation(getScilabJavaVM(), (char*)datatipUID, (char*)pstData, 1);
+                            freeAllocatedSingleString(pstData);
+                            LhsVar(1) = 0;
+                            PutLhsVar();
+                            return TRUE;
+                        }
+
+                        compVar = strcmp(pstData, "lower left");
+                        if (compVar == 0)
+                        {
+                            DatatipOrientation::datatipSetOrientation(getScilabJavaVM(), (char*)datatipUID, (char*)pstData, 2);
+                            freeAllocatedSingleString(pstData);
+                            LhsVar(1) = 0;
+                            PutLhsVar();
+                            return TRUE;
+                        }
+
+                        compVar = strcmp(pstData, "lower right");
+                        if (compVar == 0)
+                        {
+                            DatatipOrientation::datatipSetOrientation(getScilabJavaVM(), (char*)datatipUID, (char*)pstData, 3);
+                            freeAllocatedSingleString(pstData);
+                            LhsVar(1) = 0;
+                            PutLhsVar();
+                            return TRUE;
+                        }
+
+                        compVar = strcmp(pstData, "automatic");
+                        if (compVar == 0)
+                        {
+                            DatatipOrientation::datatipSetOrientation(getScilabJavaVM(), (char*)datatipUID, (char*)pstData, 4);
+                            freeAllocatedSingleString(pstData);
+                            LhsVar(1) = 0;
+                            PutLhsVar();
+                            return TRUE;
+                        }
+
+
+                        DatatipOrientation::datatipSetOrientation(getScilabJavaVM(), (char*)datatipUID, (char*)pstData, -1);
+                        freeAllocatedSingleString(pstData);
+                        LhsVar(1) = 0;
+                        PutLhsVar();
+                        return TRUE;
+
+                    }
+                    else
+                    {
+
+                        Scierror(999, _("%s: Wrong dimension for input argument #%d: Single dimension string expected.\n"), fname, 2);
+                        return FALSE;
+
+                    }
+
+                }
+                else
+                {
+
+                    Scierror(999, _("%s: Wrong type for input argument #%d: String expected.\n"), fname, 2);
+                    return FALSE;
+
+                }
+
+            }
+            else
+            {
+
+                Scierror(999, _("%s: Wrong type for input argument #%d: Datatip handler expected.\n"), fname, 1);
+                return FALSE;
+
+            }
+
+        }
+        else
+        {
+
+            Scierror(999, _("%s: Wrong type for input argument #%d: Datatip handler expected.\n"), fname, 1);
+            return FALSE;
+
+        }
+
+    }
+    else
+    {
+
+        Scierror(999, _("%s: Wrong number of input arguments: %d expected.\n"), fname, 2);
+        return FALSE;
+
+    }
+
+}
\ No newline at end of file
index b9c76fd..ed4c913 100644 (file)
@@ -79,4 +79,5 @@
     <PRIMITIVE gatewayId="25" primitiveId="46" primitiveName="datatipSetStyle" />
     <PRIMITIVE gatewayId="25" primitiveId="47" primitiveName="datatipSetDisplay" />
     <PRIMITIVE gatewayId="25" primitiveId="48" primitiveName="datatipSetInterp" />
+    <PRIMITIVE gatewayId="25" primitiveId="49" primitiveName="datatipSetOrientation" />
 </GATEWAY>
index b46a8d8..dfaf79a 100755 (executable)
     <ClCompile Include="..\..\sci_gateway\cpp\sci_datatipmove.cpp" />
     <ClCompile Include="..\..\sci_gateway\cpp\sci_datatip_set_display.cpp" />
     <ClCompile Include="..\..\sci_gateway\cpp\sci_datatip_set_interp.cpp" />
+    <ClCompile Include="..\..\sci_gateway\cpp\sci_datatip_set_orient.cpp" />
     <ClCompile Include="..\..\sci_gateway\cpp\sci_datatip_set_style.cpp" />
     <ClCompile Include="..\..\sci_gateway\cpp\sci_datatip_toggle.cpp" />
     <ClCompile Include="..\..\sci_gateway\cpp\sci_datatip_manager_mode.cpp" />
     <ClCompile Include="..\jni\DatatipDrag.cpp" />
     <ClCompile Include="..\jni\DatatipManager.cpp" />
     <ClCompile Include="..\jni\EditorManager.cpp" />
+    <ClCompile Include="..\jni\DatatipOrientation.cpp" />
     <ClCompile Include="..\jni\StartGED.cpp" />
     <ClCompile Include="..\cpp\SetUicontrolTooltipString.cpp" />
     <ClCompile Include="..\jni\ScilabTermination_wrap.c" />
     <ClInclude Include="..\jni\DatatipDelete.hxx" />
     <ClInclude Include="..\jni\DatatipDrag.hxx" />
     <ClInclude Include="..\jni\DatatipManager.hxx" />
+    <ClInclude Include="..\jni\DatatipOrientation.hxx" />
     <ClInclude Include="..\jni\EditorManager.hxx" />
     <ClInclude Include="..\jni\StartGED.hxx" />
     <ClInclude Include="..\cpp\CallClipboard.hxx" />
index 49feb89..54480f1 100755 (executable)
     <ClCompile Include="..\..\sci_gateway\cpp\sci_datatip_set_interp.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\sci_gateway\cpp\sci_datatip_set_orient.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
     <ClCompile Include="..\jni\StartPlotBrowser.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
     <ClCompile Include="..\jni\DatatipDrag.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
+    <ClCompile Include="..\jni\DatatipOrientation.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <None Include="core_import.def">
     <ClInclude Include="..\jni\DatatipDrag.hxx">
       <Filter>Header Files</Filter>
     </ClInclude>
+    <ClInclude Include="..\jni\DatatipOrientation.hxx">
+      <Filter>Header Files</Filter>
+    </ClInclude>
   </ItemGroup>
 </Project>
index a89fcf4..f7f64ee 100644 (file)
@@ -18,6 +18,7 @@ import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProp
 import org.scilab.modules.gui.editor.AxesHandler;
 import org.scilab.modules.renderer.CallRenderer;
 
+import org.scilab.modules.action_binding.InterpreterManagement;
 
 /**
  * Orientate the datatip for "upper left", "upper right", "lower left" or "lower right" according to the quadrant position.
@@ -88,7 +89,7 @@ public class DatatipOrientation {
         }
 
         String axesUid = (String)GraphicController.getController().getProperty(datatip, __GO_PARENT_AXES__);
-        if (AxesHandler.isZoomBoxEnabled(axesUid)){
+        if (AxesHandler.isZoomBoxEnabled(axesUid)) {
             bounds = (Double[])GraphicController.getController().getProperty(axesUid, __GO_ZOOM_BOX__);
         } else {
             bounds = (Double[])GraphicController.getController().getProperty(axesUid, __GO_DATA_BOUNDS__);
@@ -138,17 +139,52 @@ public class DatatipOrientation {
      * @return the flipped orientation
      */
     private static Integer flipOrientation(Integer orientation) {
-        switch(orientation) {
-            /* top left*/
-            case 0: return 3;
-            /* top right*/
-            case 1: return 2;
-            /* bottom left*/
-            case 2: return 1;
-            /* bottom right*/
-            case 3: return 0;
-            /* do nothing*/
-            default: return orientation;
+        switch (orientation) {
+                /* top left*/
+            case 0:
+                return 3;
+                /* top right*/
+            case 1:
+                return 2;
+                /* bottom left*/
+            case 2:
+                return 1;
+                /* bottom right*/
+            case 3:
+                return 0;
+                /* do nothing*/
+            default:
+                return orientation;
         }
     }
+
+    /**
+     * Setup the datatip orientation by program.
+     *
+     * @param datatipUid the datatip uid.
+     * @param datatipOrientation String with datatip orientation.
+     * @param datatipOrientationNum Integer with datatip orientation to set property.
+     */
+    public static void datatipSetOrientation (String datatipUid, String datatipOrientation, int datatipOrientationNum) {
+
+        if (datatipOrientationNum == 0) {
+            GraphicController.getController().setProperty(datatipUid, __GO_DATATIP_AUTOORIENTATION__, false);
+            GraphicController.getController().setProperty(datatipUid, __GO_DATATIP_ORIENTATION__, datatipOrientationNum);
+        } else if (datatipOrientationNum == 1) {
+            GraphicController.getController().setProperty(datatipUid, __GO_DATATIP_AUTOORIENTATION__, false);
+            GraphicController.getController().setProperty(datatipUid, __GO_DATATIP_ORIENTATION__, datatipOrientationNum);
+        } else if (datatipOrientationNum == 2) {
+            GraphicController.getController().setProperty(datatipUid, __GO_DATATIP_AUTOORIENTATION__, false);
+            GraphicController.getController().setProperty(datatipUid, __GO_DATATIP_ORIENTATION__, datatipOrientationNum);
+        } else if (datatipOrientationNum == 3) {
+            GraphicController.getController().setProperty(datatipUid, __GO_DATATIP_AUTOORIENTATION__, false);
+            GraphicController.getController().setProperty(datatipUid, __GO_DATATIP_ORIENTATION__, datatipOrientationNum);
+        } else if (datatipOrientationNum == 4) {
+            GraphicController.getController().setProperty(datatipUid, __GO_DATATIP_AUTOORIENTATION__, true);
+        } else {
+            String errorMsg = "error(msprintf(_( \"%s: Unknown input argument #%d: ''%s'' is not valid.\n\"),\"datatipSetOrientation\",2,\"" + datatipOrientation + "\"));";
+            InterpreterManagement.requestScilabExec(errorMsg);
+        }
+
+    }
 }
index c997697..7cfe884 100644 (file)
         <method name="datatipSetStyleWindow" returnType="int" modifier="static">
         </method>
     </object>
+    <object name="DatatipOrientation">
+        <method name="datatipSetOrientation" returnType="void" modifier="static">
+            <parameter name="datatipUid" type="String"/>
+            <parameter name="datatipOrientation" type="String"/>
+            <parameter name="datatipOrientationNum" type="int"/>
+        </method>
+    </object>
 </package>
diff --git a/scilab/modules/gui/src/jni/DatatipOrientation.cpp b/scilab/modules/gui/src/jni/DatatipOrientation.cpp
new file mode 100644 (file)
index 0000000..3ecb438
--- /dev/null
@@ -0,0 +1,204 @@
+#include "DatatipOrientation.hxx"
+/* Generated by GIWS (version 2.0.1) with command:
+giws --disable-return-size-array --throws-exception-on-error --description-file ../../../scilab/scilab/modules/gui/src/jni/Datatip.giws.xml
+*/
+/*
+
+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_datatip
+{
+
+// Static declarations (if any)
+
+// Returns the current env
+
+JNIEnv * DatatipOrientation::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
+
+DatatipOrientation::~DatatipOrientation()
+{
+    JNIEnv * curEnv = NULL;
+    this->jvm->AttachCurrentThread(reinterpret_cast<void **>(&curEnv), NULL);
+
+    curEnv->DeleteGlobalRef(this->instance);
+    curEnv->DeleteGlobalRef(this->instanceClass);
+}
+// Constructors
+DatatipOrientation::DatatipOrientation(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 */
+    voiddatatipSetOrientationjstringjava_lang_Stringjstringjava_lang_StringjintintID = NULL;
+
+
+}
+
+DatatipOrientation::DatatipOrientation(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 */
+    voiddatatipSetOrientationjstringjava_lang_Stringjstringjava_lang_StringjintintID = NULL;
+
+
+}
+
+// Generic methods
+
+void DatatipOrientation::synchronize()
+{
+    if (getCurrentEnv()->MonitorEnter(instance) != JNI_OK)
+    {
+        throw GiwsException::JniMonitorException(getCurrentEnv(), "DatatipOrientation");
+    }
+}
+
+void DatatipOrientation::endSynchronize()
+{
+    if ( getCurrentEnv()->MonitorExit(instance) != JNI_OK)
+    {
+        throw GiwsException::JniMonitorException(getCurrentEnv(), "DatatipOrientation");
+    }
+}
+// Method(s)
+
+void DatatipOrientation::datatipSetOrientation (JavaVM * jvm_, char const* datatipUid, char const* datatipOrientation, int datatipOrientationNum)
+{
+
+    JNIEnv * curEnv = NULL;
+    jvm_->AttachCurrentThread(reinterpret_cast<void **>(&curEnv), NULL);
+    jclass cls = curEnv->FindClass( className().c_str() );
+
+    jmethodID voiddatatipSetOrientationjstringjava_lang_Stringjstringjava_lang_StringjintintID = curEnv->GetStaticMethodID(cls, "datatipSetOrientation", "(Ljava/lang/String;Ljava/lang/String;I)V" ) ;
+    if (voiddatatipSetOrientationjstringjava_lang_Stringjstringjava_lang_StringjintintID == NULL)
+    {
+        throw GiwsException::JniMethodNotFoundException(curEnv, "datatipSetOrientation");
+    }
+
+    jstring datatipUid_ = curEnv->NewStringUTF( datatipUid );
+    if (datatipUid != NULL && datatipUid_ == NULL)
+    {
+        throw GiwsException::JniBadAllocException(curEnv);
+    }
+
+
+    jstring datatipOrientation_ = curEnv->NewStringUTF( datatipOrientation );
+    if (datatipOrientation != NULL && datatipOrientation_ == NULL)
+    {
+        throw GiwsException::JniBadAllocException(curEnv);
+    }
+
+
+    curEnv->CallStaticVoidMethod(cls, voiddatatipSetOrientationjstringjava_lang_Stringjstringjava_lang_StringjintintID , datatipUid_, datatipOrientation_, datatipOrientationNum);
+    curEnv->DeleteLocalRef(datatipUid_);
+    curEnv->DeleteLocalRef(datatipOrientation_);
+    curEnv->DeleteLocalRef(cls);
+    if (curEnv->ExceptionCheck())
+    {
+        throw GiwsException::JniCallMethodException(curEnv);
+    }
+}
+
+}
diff --git a/scilab/modules/gui/src/jni/DatatipOrientation.hxx b/scilab/modules/gui/src/jni/DatatipOrientation.hxx
new file mode 100644 (file)
index 0000000..1c431fc
--- /dev/null
@@ -0,0 +1,158 @@
+/* Generated by GIWS (version 2.0.1) with command:
+giws --disable-return-size-array --throws-exception-on-error --description-file ../../../scilab/scilab/modules/gui/src/jni/Datatip.giws.xml
+*/
+/*
+
+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_DATATIP_DATATIPORIENTATION__
+#define __ORG_SCILAB_MODULES_GUI_DATATIP_DATATIPORIENTATION__
+#include <iostream>
+#include <string>
+#include <string.h>
+#include <stdlib.h>
+#include <jni.h>
+
+#include "GiwsException.hxx"
+
+#if defined(_MSC_VER) /* Defined anyway with Visual */
+#include <Windows.h>
+#else
+typedef signed char byte;
+#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_datatip
+{
+class GIWSEXPORT DatatipOrientation
+{
+
+private:
+    JavaVM * jvm;
+
+protected:
+    jmethodID voiddatatipSetOrientationjstringjava_lang_Stringjstringjava_lang_StringjintintID; // 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
+    */
+    DatatipOrientation(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
+    */
+    DatatipOrientation(JavaVM * jvm_, jobject JObj);
+
+
+    /**
+    * This is a fake constructor to avoid the constructor
+    * chaining when dealing with extended giws classes
+    */
+#ifdef FAKEGIWSDATATYPE
+    DatatipOrientation(fakeGiwsDataType::fakeGiwsDataType /* unused */) {}
+#endif
+
+    // Destructor
+    ~DatatipOrientation();
+
+    // 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 datatipSetOrientation(JavaVM * jvm_, char const* datatipUid, char const* datatipOrientation, int datatipOrientationNum);
+
+
+    /**
+    * 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/datatip/DatatipOrientation";
+    }
+
+};
+
+
+}
+#endif