Add new positions for datatips (left, right, upper, lower). 85/16185/3
Charlotte HECQUET [Thu, 19 Mar 2015 10:13:54 +0000 (11:13 +0100)]
Change-Id: I2a1836e8c4235d3999cf7cfb6450aa8f76ba380a

scilab/CHANGES_5.5.X
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/datatip/Datatip.java
scilab/modules/graphics/help/en_US/datatips/datatipSetOrientation.xml
scilab/modules/graphics/help/en_US/datatips/datatip_properties.xml
scilab/modules/gui/sci_gateway/cpp/sci_datatip_set_orient.cpp
scilab/modules/gui/src/java/org/scilab/modules/gui/datatip/DatatipOrientation.java
scilab/modules/renderer/src/java/org/scilab/modules/renderer/JoGLView/datatip/DatatipTextDrawer.java

index 601b834..91404b7 100644 (file)
@@ -50,6 +50,8 @@ Graphics Evolutions
 
 * fec function can now plot meshes based on any convex polygon type (not only triangles).
 
+* New datatips positions available: "left", "right", "upper", "lower".
+
 
 Scilab Bug Fixes
 ================
index 43f1773..6001729 100755 (executable)
@@ -59,7 +59,7 @@ public class Datatip extends Text {
 
 
     enum DatatipObjectProperty { TIP_DATA, TIP_BOX_MODE, TIP_LABEL_MODE, TIP_ORIENTATION, TIP_AUTOORIENTATION, TIP_3COMPONENT, TIP_INTERP_MODE, TIP_DISPLAY_FNC, TIP_INDEXES};
-    enum TipOrientation { TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_RIGHT;
+    enum TipOrientation { TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_RIGHT, LEFT, RIGHT, TOP, BOTTOM;
 
                           /**
                            * Transform a integer to a TipOrientation enum.
@@ -74,6 +74,14 @@ public class Datatip extends Text {
                 return TipOrientation.BOTTOM_LEFT;
             case 3:
                 return TipOrientation.BOTTOM_RIGHT;
+            case 4:
+                return TipOrientation.LEFT;
+            case 5:
+                return TipOrientation.RIGHT;
+            case 6:
+                return TipOrientation.TOP;
+            case 7:
+                return TipOrientation.BOTTOM;
             default:
                 return TipOrientation.TOP_RIGHT;
         }
index 82c594f..f088574 100644 (file)
                 <listitem>
                     <para>
                         A character string with possible values:
-                        <literal>"automatic"</literal> <literal>"upper
+                        <literal>"automatic"</literal>, <literal>"upper
                             left"
                         </literal>
-                        <literal>"upper right"</literal>,
-                        <literal>"lower left"</literal>, <literal>"lower
-                            right"
-                        </literal>
-                        .
+                        ,<literal>"upper right"</literal>,
+                        <literal>"lower left"</literal>, <literal>"lower right"</literal>, 
+                        <literal>"left"</literal>, <literal>"right"</literal>, 
+                        <literal>"upper"</literal>, or <literal>"lower"</literal>.
                     </para>
                 </listitem>
             </varlistentry>
             </member>
         </simplelist>
     </refsection>
+    <refsection>
+        <title>History</title>
+        <revhistory>
+            <revision>
+                <revnumber>5.5.2</revnumber>
+                <revremark>
+                    <para>
+                        New "orient" values available: "left", "right", "upper", "lower".
+                    </para>
+                </revremark>
+            </revision>
+        </revhistory>
+    </refsection>
 </refentry>
index 959f9d3..4672575 100644 (file)
@@ -19,7 +19,7 @@
                         <literal>
                             <link linkend="polyline_properties">polyline_properties</link>
                         </literal>
-                         help page.
+                        help page.
                     </para>
                 </listitem>
             </varlistentry>
@@ -30,7 +30,7 @@
                         <literal>
                             <link linkend="polyline_properties">polyline_properties</link>
                         </literal>
-                         help page.
+                        help page.
                     </para>
                 </listitem>
             </varlistentry>
@@ -41,7 +41,7 @@
                         <literal>
                             <link linkend="polyline_properties">polyline_properties</link>
                         </literal>
-                         help page.
+                        help page.
                     </para>
                 </listitem>
             </varlistentry>
@@ -52,7 +52,7 @@
                         <literal>
                             <link linkend="polyline_properties">polyline_properties</link>
                         </literal>
-                         help page.
+                        help page.
                     </para>
                 </listitem>
             </varlistentry>
@@ -80,7 +80,8 @@
                 <term>orientation: </term>
                 <listitem>
                     <para>This field sets the position on the text box with respect to polyline point. 
-                        The possible values are 0, 1, 2 or 3.
+                        The possible values are 0 (upper left), 1 (upper right), 2 (lower left), 3 (lower right), 4 (left), 5 (right), 
+                        6 (upper) or 7 (lower).
                     </para>
                 </listitem>
             </varlistentry>
                     <para>This field sets the interpolation mode for tip location. Its value should be 
                         <literal>"on" </literal>(interpolation is made between mesh points) or <literal>"off"
                         </literal>
-                         (the tips can only be located at the mesh points).
+                        (the tips can only be located at the mesh points).
                     </para>
                 </listitem>
             </varlistentry>
                         <literal>
                             <link linkend="polyline_properties">polyline_properties</link>
                         </literal>
-                         help page.
+                        help page.
                     </para>
                 </listitem>
             </varlistentry>
                         <literal>
                             <link linkend="polyline_properties">polyline_properties</link>
                         </literal>
-                         help page.
+                        help page.
                     </para>
                 </listitem>
             </varlistentry>
                         <literal>
                             <link linkend="polyline_properties">polyline_properties</link>
                         </literal>
-                         help page.
+                        help page.
                     </para>
                 </listitem>
             </varlistentry>
                         <literal>
                             <link linkend="polyline_properties">polyline_properties</link>
                         </literal>
-                         help page.
+                        help page.
                     </para>
                 </listitem>
             </varlistentry>
                         <literal>
                             <link linkend="polyline_properties">polyline_properties</link>
                         </literal>
-                         help page.
+                        help page.
                     </para>
                 </listitem>
             </varlistentry>
                         <literal>
                             <link linkend="polyline_properties">polyline_properties</link>
                         </literal>
-                         help page.
+                        help page.
                     </para>
                 </listitem>
             </varlistentry>
                         <literal>
                             <link linkend="polyline_properties">polyline_properties</link>
                         </literal>
-                         help page.
+                        help page.
                     </para>
                 </listitem>
             </varlistentry>
                         <literal>
                             <link linkend="polyline_properties">polyline_properties</link>
                         </literal>
-                         help page.
+                        help page.
                     </para>
                 </listitem>
             </varlistentry>
                         <literal>
                             <link linkend="polyline_properties">polyline_properties</link>
                         </literal>
-                         help page.
+                        help page.
                     </para>
                 </listitem>
             </varlistentry>
                         See <literal>
                             <link linkend="figure_properties">figure_properties</link>
                         </literal>
-                         help page.
+                        help page.
                     </para>
                 </listitem>
             </varlistentry>
             </member>
         </simplelist>
     </refsection>
+    <refsection>
+        <title>History</title>
+        <revhistory>
+            <revision>
+                <revnumber>5.5.2</revnumber>
+                <revremark>
+                    <para>
+                        New "orientation" values available: "left", "right", "upper", "lower".
+                    </para>
+                </revremark>
+            </revision>
+        </revhistory>
+    </refsection>
 </refentry>
index 84a0d2a..4e96e79 100644 (file)
@@ -126,7 +126,7 @@ int sci_datatip_set_orient(char *fname, unsigned long fname_len)
                             return 0;
                         }
 
-                        compVar = stricmp(pstData, "automatic");
+                        compVar = stricmp(pstData, "left");
                         if (compVar == 0)
                         {
                             DatatipOrientation::datatipSetOrientation(getScilabJavaVM(), iDatatipUID, (char*)pstData, 4);
@@ -136,6 +136,46 @@ int sci_datatip_set_orient(char *fname, unsigned long fname_len)
                             return 0;
                         }
 
+                        compVar = stricmp(pstData, "right");
+                        if (compVar == 0)
+                        {
+                            DatatipOrientation::datatipSetOrientation(getScilabJavaVM(), iDatatipUID, (char*)pstData, 5);
+                            freeAllocatedSingleString(pstData);
+                            AssignOutputVariable(pvApiCtx, 1) = 0;
+                            ReturnArguments(pvApiCtx);
+                            return 0;
+                        }
+
+                        compVar = stricmp(pstData, "upper");
+                        if (compVar == 0)
+                        {
+                            DatatipOrientation::datatipSetOrientation(getScilabJavaVM(), iDatatipUID, (char*)pstData, 6);
+                            freeAllocatedSingleString(pstData);
+                            AssignOutputVariable(pvApiCtx, 1) = 0;
+                            ReturnArguments(pvApiCtx);
+                            return 0;
+                        }
+
+                        compVar = stricmp(pstData, "lower");
+                        if (compVar == 0)
+                        {
+                            DatatipOrientation::datatipSetOrientation(getScilabJavaVM(), iDatatipUID, (char*)pstData, 7);
+                            freeAllocatedSingleString(pstData);
+                            AssignOutputVariable(pvApiCtx, 1) = 0;
+                            ReturnArguments(pvApiCtx);
+                            return 0;
+                        }
+
+                        compVar = stricmp(pstData, "automatic");
+                        if (compVar == 0)
+                        {
+                            DatatipOrientation::datatipSetOrientation(getScilabJavaVM(), iDatatipUID, (char*)pstData, 8);
+                            freeAllocatedSingleString(pstData);
+                            AssignOutputVariable(pvApiCtx, 1) = 0;
+                            ReturnArguments(pvApiCtx);
+                            return 0;
+                        }
+
                         DatatipOrientation::datatipSetOrientation(getScilabJavaVM(), iDatatipUID, (char*)pstData, -1);
                         freeAllocatedSingleString(pstData);
                         AssignOutputVariable(pvApiCtx, 1) = 0;
index 4f8e48f..0fed7da 100644 (file)
@@ -181,7 +181,23 @@ public class DatatipOrientation {
                 GraphicController.getController().setProperty(datatipUid, __GO_DATATIP_AUTOORIENTATION__, false);
                 GraphicController.getController().setProperty(datatipUid, __GO_DATATIP_ORIENTATION__, 3);
                 break;
-            case 4: // automatic
+            case 4: // left
+                GraphicController.getController().setProperty(datatipUid, __GO_DATATIP_AUTOORIENTATION__, false);
+                GraphicController.getController().setProperty(datatipUid, __GO_DATATIP_ORIENTATION__, 4);
+                break;
+            case 5: // right
+                GraphicController.getController().setProperty(datatipUid, __GO_DATATIP_AUTOORIENTATION__, false);
+                GraphicController.getController().setProperty(datatipUid, __GO_DATATIP_ORIENTATION__, 5);
+                break;
+            case 6: // upper
+                GraphicController.getController().setProperty(datatipUid, __GO_DATATIP_AUTOORIENTATION__, false);
+                GraphicController.getController().setProperty(datatipUid, __GO_DATATIP_ORIENTATION__, 6);
+                break;
+            case 7: // lower
+                GraphicController.getController().setProperty(datatipUid, __GO_DATATIP_AUTOORIENTATION__, false);
+                GraphicController.getController().setProperty(datatipUid, __GO_DATATIP_ORIENTATION__, 7);
+                break;
+            case 8: // automatic
                 GraphicController.getController().setProperty(datatipUid, __GO_DATATIP_AUTOORIENTATION__, true);
                 break;
             default:
index 6bd10a4..bc78543 100644 (file)
@@ -143,6 +143,28 @@ public class DatatipTextDrawer extends TextManager {
                 cornerPositions[0] = cornerPositions[0].minus(textBoxVectors[0]);
                 delta = delta.setX(-finalSize);
             }
+            if (datatip.getOrientation() == 4) {
+                cornerPositions[0] = cornerPositions[0].minus(textBoxVectors[0]);
+                cornerPositions[0] = cornerPositions[0].minus(textBoxVectors[1].times(0.5));
+                delta = delta.setY(0);
+                delta = delta.setX(Math.sqrt(2)*(-finalSize));
+            }
+            if (datatip.getOrientation() == 5) {
+                cornerPositions[0] = cornerPositions[0].minus(textBoxVectors[1].times(0.5));
+                delta = delta.setY(0);
+                delta = delta.setX(Math.sqrt(2)*finalSize);
+            }
+            if (datatip.getOrientation() == 6) {
+                cornerPositions[0] = cornerPositions[0].minus(textBoxVectors[0].times(0.5));
+                delta = delta.setX(0);
+                delta = delta.setY(Math.sqrt(2)*finalSize);
+            }
+            if (datatip.getOrientation() == 7) {
+                cornerPositions[0] = cornerPositions[0].minus(textBoxVectors[0].times(0.5));
+                cornerPositions[0] = cornerPositions[0].minus(textBoxVectors[1]);
+                delta = delta.setX(0);
+                delta = delta.setY(Math.sqrt(2)*(-finalSize));
+            }
         }
 
         cornerPositions[0] = cornerPositions[0].plus(delta);
@@ -203,6 +225,28 @@ public class DatatipTextDrawer extends TextManager {
                 cornerPositions[0] = cornerPositions[0].minus(textBoxVectors[0]);
                 delta = delta.setX(-finalSize);
             }
+            if (datatip.getOrientation() == 4) {
+                cornerPositions[0] = cornerPositions[0].minus(textBoxVectors[0]);
+                cornerPositions[0] = cornerPositions[0].minus(textBoxVectors[1].times(0.5));
+                delta = delta.setY(0);
+                delta = delta.setX(Math.sqrt(2)*(-finalSize));
+            }
+            if (datatip.getOrientation() == 5) {
+                cornerPositions[0] = cornerPositions[0].minus(textBoxVectors[1].times(0.5));
+                delta = delta.setY(0);
+                delta = delta.setX(Math.sqrt(2)*finalSize);
+            }
+            if (datatip.getOrientation() == 6) {
+                cornerPositions[0] = cornerPositions[0].minus(textBoxVectors[0].times(0.5));
+                delta = delta.setX(0);
+                delta = delta.setY(Math.sqrt(2)*finalSize);
+            }
+            if (datatip.getOrientation() == 7) {
+                cornerPositions[0] = cornerPositions[0].minus(textBoxVectors[0].times(0.5));
+                cornerPositions[0] = cornerPositions[0].minus(textBoxVectors[1]);
+                delta = delta.setX(0);
+                delta = delta.setY(Math.sqrt(2)*(-finalSize));
+            }
 
             cornerPositions[0] = cornerPositions[0].plus(delta);
             cornerPositions[1] = cornerPositions[1].plus(delta);