/*------------------------------------------------------------------------*/ int set_mark_foreground_property(char* pobjUID, size_t stackPointer, int valueType, int nbRow, int nbCol ) { BOOL status; int markForeground; if ( !isParameterDoubleMatrix( valueType ) ) { Scierror(999, _("Wrong type for '%s' property: Integer expected.\n"), "mark_foreground"); return SET_PROPERTY_ERROR; } markForeground = (int) getDoubleFromStack(stackPointer); status = setGraphicObjectProperty(pobjUID, __GO_MARK_FOREGROUND__, &markForeground, jni_int, 1); if (status == TRUE) { return SET_PROPERTY_SUCCEED; } else { Scierror(999, _("'%s' property does not exist for this handle.\n"),"mark_foreground"); return SET_PROPERTY_ERROR; } /* To be implemented since it involves color range checks */ #if 0 /* sciSetIsMark((sciPointObj *) pobj, TRUE); */ /* F.Leray 27.01.05 commented because mark_size is automatically launched */ /* in tcl/tk editor (which causes marks appearance even when unwanted). */ return sciSetMarkForeground( pobj, (int) getDoubleFromStack( stackPointer ) ) ; #endif }
/*------------------------------------------------------------------------*/ int set_labels_font_color_property(void* _pvCtx, char* pobjUID, size_t stackPointer, int valueType, int nbRow, int nbCol ) { BOOL status = FALSE; int fontColor = 0; if ( !( valueType == sci_matrix ) ) { Scierror(999, _("Wrong type for '%s' property: Integer expected.\n"), "labels_font_color"); return SET_PROPERTY_ERROR; } fontColor = (int) getDoubleFromStack(stackPointer); status = setGraphicObjectProperty(pobjUID, __GO_FONT_COLOR__, &fontColor, jni_int, 1); if (status == TRUE) { return SET_PROPERTY_SUCCEED; } else { Scierror(999, _("'%s' property does not exist for this handle.\n"), "labels_font_color"); return SET_PROPERTY_ERROR; } }
/*------------------------------------------------------------------------*/ int set_figure_id_property(void* _pvCtx, char* pobjUID, size_t stackPointer, int valueType, int nbRow, int nbCol ) { int id = 0; BOOL status = FALSE; if ( !( valueType == sci_matrix ) ) { Scierror(999, _("Wrong type for '%s' property: Integer expected.\n"), "figure_id"); return SET_PROPERTY_ERROR ; } id = (int) getDoubleFromStack( stackPointer ) ; status = setGraphicObjectProperty(pobjUID, __GO_ID__, &id, jni_int, 1); if (status == TRUE) { return SET_PROPERTY_SUCCEED; } else { Scierror(999, _("'%s' property does not exist for this handle.\n"), "figure_id"); return SET_PROPERTY_ERROR; } return SET_PROPERTY_ERROR ; }
/*------------------------------------------------------------------------*/ int set_color_mode_property(char* pobjUID, size_t stackPointer, int valueType, int nbRow, int nbCol ) { BOOL status; int colorMode; if ( !isParameterDoubleMatrix( valueType ) ) { Scierror(999, _("Wrong type for '%s' property: Integer expected.\n"), "color_mode"); return SET_PROPERTY_ERROR; } #if 0 if ( sciGetEntityType(pobj) != SCI_SURFACE ) { Scierror(999, _("'%s' property does not exist for this handle.\n"),"color_mode") ; return SET_PROPERTY_ERROR; } #endif colorMode = (int) getDoubleFromStack(stackPointer); status = setGraphicObjectProperty(pobjUID, __GO_COLOR_MODE__, &colorMode, jni_int, 1); if (status == FALSE) { Scierror(999, _("'%s' property does not exist for this handle.\n"),"color_mode"); return SET_PROPERTY_ERROR; } return SET_PROPERTY_SUCCEED; }
/*------------------------------------------------------------------------*/ int set_color_flag_property(void* _pvCtx, char* pobjUID, size_t stackPointer, int valueType, int nbRow, int nbCol ) { int type = -1; int *piType = &type; int flagcolor = (int) getDoubleFromStack( stackPointer ); if ( !( valueType == sci_matrix ) ) { Scierror(999, _("Wrong type for '%s' property: Real expected.\n"), "color_flag"); return SET_PROPERTY_ERROR; } if ( nbRow * nbCol != 1 ) { Scierror(999, _("Wrong size for '%s' property: Scalar expected.\n"), "color_flag"); return SET_PROPERTY_ERROR; } getGraphicObjectProperty(pobjUID, __GO_TYPE__, jni_int, (void **)&piType); if (type == __GO_PLOT3D__) { if ( flagcolor < 0 || flagcolor > 1 ) { Scierror(999, _("Wrong value for '%s' property: %s or %s expected.\n"), "color_flag", "0", "1"); return SET_PROPERTY_ERROR; } setGraphicObjectProperty(pobjUID, __GO_COLOR_FLAG__, &flagcolor, jni_int, 1); return SET_PROPERTY_SUCCEED; } else if (type == __GO_FAC3D__) { if ( flagcolor < 0 || flagcolor > 4 ) { Scierror(999, _("Wrong value for '%s' property: Must be in the set {%s}.\n"), "color_flag", "0, 1, 2, 3, 4"); return SET_PROPERTY_ERROR; } setGraphicObjectProperty(pobjUID, __GO_COLOR_FLAG__, &flagcolor, jni_int, 1); return SET_PROPERTY_SUCCEED; } else { Scierror(999, _("'%s' property does not exist for this handle.\n"), "color_flag"); return SET_PROPERTY_ERROR; } return SET_PROPERTY_SUCCEED; }
/*------------------------------------------------------------------------*/ int set_polyline_style_property(char* pobjUID, size_t stackPointer, int valueType, int nbRow, int nbCol ) { BOOL status; int value = 0; if ( !isParameterDoubleMatrix( valueType ) ) { Scierror(999, _("Wrong type for '%s' property: Integer expected.\n"), "polyline_style"); return SET_PROPERTY_ERROR; } #if 0 if (sciGetEntityType (pobj) != SCI_POLYLINE) { Scierror(999, _("'%s' property does not exist for this handle.\n"),"polyline_style"); return SET_PROPERTY_ERROR; } #endif value = (int) getDoubleFromStack( stackPointer ); if ( value < 1 || value > 7 ) { Scierror(999, _("Wrong value for '%s' property: Must be between %d and %d.\n"),"polyline_style",1,7); return SET_PROPERTY_ERROR; } status = setGraphicObjectProperty(pobjUID, __GO_POLYLINE_STYLE__, &value, jni_int, 1); if (status == TRUE) { return SET_PROPERTY_SUCCEED; } else { Scierror(999, _("'%s' property does not exist for this handle.\n"),"polyline_style"); return SET_PROPERTY_ERROR; } }
/*------------------------------------------------------------------------*/ int set_color_mode_property(void* _pvCtx, char* pobjUID, size_t stackPointer, int valueType, int nbRow, int nbCol ) { BOOL status = FALSE; int colorMode = 0; if ( !( valueType == sci_matrix ) ) { Scierror(999, _("Wrong type for '%s' property: Integer expected.\n"), "color_mode"); return SET_PROPERTY_ERROR; } colorMode = (int) getDoubleFromStack(stackPointer); status = setGraphicObjectProperty(pobjUID, __GO_COLOR_MODE__, &colorMode, jni_int, 1); if (status == FALSE) { Scierror(999, _("'%s' property does not exist for this handle.\n"), "color_mode"); return SET_PROPERTY_ERROR; } return SET_PROPERTY_SUCCEED; }
int SetUicontrolListboxTop(void* _pvCtx, char* sciObjUID, size_t stackPointer, int valueType, int nbRow, int nbCol) { int value = 0; int* valueTab; int valueSize = 0; int nbValues = 0; BOOL status = FALSE; if (valueType == sci_matrix) { if(nbCol > 1 || nbRow > 1) { /* Wrong value size */ Scierror(999, const_cast<char*>(_("Wrong size for '%s' property: A real expected.\n")), "ListboxTop"); return SET_PROPERTY_ERROR; } value = (int) getDoubleFromStack(stackPointer); } else if (valueType == sci_strings) // Ascendant compatibility { if(nbCol > 1 || nbRow > 1) { /* Wrong value size */ Scierror(999, const_cast<char*>(_("Wrong size for '%s' property: A real expected.\n")), "ListboxTop"); return SET_PROPERTY_ERROR; } nbValues = sscanf(getStringFromStack(stackPointer), "%d", &value); if(nbValues != 1) { /* Wrong value size */ Scierror(999, const_cast<char*>(_("Wrong value for '%s' property: A real expected.\n")), "ListboxTop"); return SET_PROPERTY_ERROR; } } else { /* Wrong datatype */ Scierror(999, const_cast<char*>(_("Wrong type for '%s' property: A real expected.\n")), "ListboxTop"); return SET_PROPERTY_ERROR; } valueSize = nbCol*nbRow; valueTab = new int[valueSize]; if (valueSize > 0) { valueTab[0] = value; } status = setGraphicObjectProperty(sciObjUID, __GO_UI_LISTBOXTOP__, valueTab, jni_int_vector, valueSize); delete[] valueTab; if (status == TRUE) { return SET_PROPERTY_SUCCEED; } else { Scierror(999, _("'%s' property does not exist for this handle.\n"), "ListboxTop"); return SET_PROPERTY_ERROR; } }
/*------------------------------------------------------------------------*/ int set_sub_tics_property(void* _pvCtx, char* pobjUID, size_t stackPointer, int valueType, int nbRow, int nbCol ) { BOOL status = FALSE; int result = 0; int type = -1; int *piType = &type; int axisSubticksPropertiesNames[3] = {__GO_X_AXIS_SUBTICKS__, __GO_Y_AXIS_SUBTICKS__, __GO_Z_AXIS_SUBTICKS__}; if ( !( valueType == sci_matrix ) ) { Scierror(999, _("Wrong type for '%s' property: Real matrix expected.\n"), "sub_tics"); return SET_PROPERTY_ERROR ; } getGraphicObjectProperty(pobjUID, __GO_TYPE__, jni_int, (void **)&piType); /* * Type test required as the Axis object stores subticks as a single int * whereas Axes maintain a 3-element int vector. */ if (type == __GO_AXIS__) { int nbTicks = (int) getDoubleFromStack(stackPointer); status = setGraphicObjectProperty(pobjUID, __GO_SUBTICKS__, &nbTicks, jni_int, 1); if (status == TRUE) { return SET_PROPERTY_SUCCEED; } else { Scierror(999, _("'%s' property does not exist for this handle.\n"), "sub_tics"); return SET_PROPERTY_ERROR; } } else if (type == __GO_AXES__) { int autoSubticks; int i; double * values = stk( stackPointer ); result = SET_PROPERTY_SUCCEED; if ( (nbCol != 3 ) && (nbCol != 2) ) { Scierror(999, _("Wrong size for '%s' property: %d or %d elements expected.\n"), "sub_tics", 2, 3); return SET_PROPERTY_ERROR; } /* * The AUTO_SUBTICKS property is shared by the 3 axes for now. * To be modified. */ autoSubticks = 0; status = setGraphicObjectProperty(pobjUID, __GO_AUTO_SUBTICKS__, &autoSubticks, jni_bool, 1); if (status == FALSE) { Scierror(999, _("'%s' property does not exist for this handle.\n"), "sub_ticks"); return SET_PROPERTY_ERROR; } for ( i = 0; i < nbCol ; i++ ) { int nbTicks; nbTicks = (int) values[i]; if ( nbTicks < 0 ) { nbTicks = 0; } status = setGraphicObjectProperty(pobjUID, axisSubticksPropertiesNames[i], &nbTicks, jni_int, 1); if (status == FALSE) { result = SET_PROPERTY_ERROR; } } if (result == SET_PROPERTY_ERROR) { Scierror(999, _("'%s' property does not exist for this handle.\n"), "sub_ticks"); } return result; } else { Scierror(999, _("'%s' property does not exist for this handle.\n"), "sub_ticks"); return SET_PROPERTY_ERROR; } return SET_PROPERTY_SUCCEED; }