figure : fix axes_axes changes with resize=%f 56/14356/2
Antoine ELIAS [Mon, 7 Apr 2014 10:18:33 +0000 (12:18 +0200)]
Change-Id: Ic0a1f656a10c4723d5f71e836f93030789ab02e6

scilab/modules/gui/sci_gateway/c/sci_figure.c

index fdd16b8..5d294d0 100644 (file)
@@ -63,6 +63,7 @@ int sci_figure(char * fname, unsigned long fname_len)
     BOOL bMenuBar = TRUE;
     BOOL bToolBar = TRUE;
     BOOL bInfoBar = TRUE;
+    BOOL bResize = TRUE;
     int iMenubarType = 1; // Create a 'figure' menubar by default
     int iToolbarType = 1; // Create a 'figure' toolbar by default
     double dblId = 0;
@@ -199,6 +200,7 @@ int sci_figure(char * fname, unsigned long fname_len)
                     stricmp(pstProName, "position") != 0 &&
                     stricmp(pstProName, "menubar_visible") != 0 &&
                     stricmp(pstProName, "toolbar_visible") != 0 &&
+                    stricmp(pstProName, "resize") != 0 &&
                     stricmp(pstProName, "infobar_visible") != 0)
             {
                 freeAllocatedSingleString(pstProName);
@@ -378,6 +380,16 @@ int sci_figure(char * fname, unsigned long fname_len)
                     return 1;
                 }
             }
+            else if (stricmp(pstProName, "resize") == 0)
+            {
+                bResize = getStackArgumentAsBoolean(pvApiCtx, piAddrData);
+                if (bResize == -1)
+                {
+                    Scierror(999, _("Wrong value for '%s' property: '%s' or '%s' expected."), "resize", "on", "off");
+                    freeAllocatedSingleString(pstProName);
+                    return 1;
+                }
+            }
             else if (stricmp(pstProName, "menubar_visible") == 0)
             {
                 bMenuBar = getStackArgumentAsBoolean(pvApiCtx, piAddrData);
@@ -451,6 +463,7 @@ int sci_figure(char * fname, unsigned long fname_len)
                     stricmp(pstProName, "figure_size") == 0 ||
                     stricmp(pstProName, "axes_size") == 0 ||
                     stricmp(pstProName, "position") == 0 ||
+                    stricmp(pstProName, "resize") == 0 ||
                     stricmp(pstProName, "menubar_visible") == 0 ||
                     stricmp(pstProName, "toolbar_visible") == 0 ||
                     stricmp(pstProName, "infobar_visible") == 0))
@@ -587,6 +600,9 @@ int sci_figure(char * fname, unsigned long fname_len)
         setGraphicObjectProperty(iFig, __GO_SIZE__, figure, jni_int_vector, 2);
     }
 
+
+    setGraphicObjectProperty(iFig, __GO_RESIZE__, (void*)&bResize, jni_bool, 1);
+
     //return new created fig
     createScalarHandle(pvApiCtx, iRhs + 1, getHandle(iFig));
     AssignOutputVariable(pvApiCtx, 1) = iRhs + 1;