/*------------------------------------------------------------------------*/ int get_auto_ticks_property(void* _pvCtx, int iObjUID) { char * auto_ticks[3] = { NULL, NULL, NULL }; int const axesAutoTicksPropertiesNames[3] = {__GO_X_AXIS_AUTO_TICKS__, __GO_Y_AXIS_AUTO_TICKS__, __GO_Z_AXIS_AUTO_TICKS__}; int iAutoTicks = 0; int* piAutoTicks = &iAutoTicks; int i = 0; int j = 0; int status = -1; for (i = 0 ; i < 3 ; i++) { getGraphicObjectProperty(iObjUID, axesAutoTicksPropertiesNames[i], jni_bool, (void **)&piAutoTicks); if (piAutoTicks == NULL) { Scierror(999, _("'%s' property does not exist for this handle.\n"), "auto_ticks"); return -1; } if (iAutoTicks) { auto_ticks[i] = strdup("on"); } else { auto_ticks[i] = strdup("off"); } if (auto_ticks[i] == NULL) { for (j = 0 ; j < i ; j++) { FREE(auto_ticks[j]); } Scierror(999, _("%s: No more memory.\n"), "get_auto_ticks_property"); return -1; } } status = sciReturnRowStringVector(_pvCtx, auto_ticks, 3); for (i = 0 ; i < 3 ; i++) { FREE(auto_ticks[i]); } return status; }
/*------------------------------------------------------------------------*/ void* get_tight_limits_property(void* _pvCtx, int iObjUID) { char * tightLimits[3] = { NULL, NULL, NULL }; int const axesTightLimitsPropertiesNames[3] = {__GO_X_TIGHT_LIMITS__, __GO_Y_TIGHT_LIMITS__, __GO_Z_TIGHT_LIMITS__}; int iTightLimits = 0; int* piTightLimits = &iTightLimits; int i = 0; int j = 0; void* status = NULL; for (i = 0 ; i < 3 ; i++) { getGraphicObjectProperty(iObjUID, axesTightLimitsPropertiesNames[i], jni_bool, (void **)&piTightLimits); if (piTightLimits == NULL) { Scierror(999, _("'%s' property does not exist for this handle.\n"), "tight_limits"); return -1; } if (iTightLimits) { tightLimits[i] = os_strdup("on"); } else { tightLimits[i] = os_strdup("off"); } if (tightLimits[i] == NULL) { for (j = 0 ; j < i ; j++) { FREE(tightLimits[j]); } Scierror(999, _("%s: No more memory.\n"), "get_tight_limits_property"); return -1; } } status = sciReturnRowStringVector(tightLimits, 3); for (i = 0 ; i < 3 ; i++) { FREE(tightLimits[i]); } return status; }
/*------------------------------------------------------------------------*/ void* get_axes_visible_property(void* _pvCtx, int iObjUID) { char * axes_visible[3] = { NULL, NULL, NULL }; int const axesVisiblePropertiesNames[3] = {__GO_X_AXIS_VISIBLE__, __GO_Y_AXIS_VISIBLE__, __GO_Z_AXIS_VISIBLE__}; int iAxesVisible = 0; int* piAxesVisible = &iAxesVisible; int i = 0; int j = 0; void* status = NULL; for (i = 0 ; i < 3 ; i++) { getGraphicObjectProperty(iObjUID, axesVisiblePropertiesNames[i], jni_bool, (void **)&piAxesVisible); if (piAxesVisible == NULL) { Scierror(999, _("'%s' property does not exist for this handle.\n"), "axes_visible"); return NULL; } if (iAxesVisible) { axes_visible[i] = os_strdup("on"); } else { axes_visible[i] = os_strdup("off"); } if (axes_visible[i] == NULL) { for (j = 0 ; j < i ; j++) { FREE(axes_visible[j]); } Scierror(999, _("%s: No more memory.\n"), "get_axes_visible_property"); return NULL; } } status = sciReturnRowStringVector(axes_visible, 3); for (i = 0 ; i < 3 ; i++) { FREE(axes_visible[i]); } return status; }