/** * Sets the VisParamEntry to VISUAL_PARAM_ENTRY_TYPE_STRING and assigns the string given as argument to it. * * @param param Pointer to the VisParamEntry to which a parameter is set. * @param string The string for this parameter. * * @return VISUAL_OK on succes, -VISUAL_ERROR_PARAM_NULL on failure. */ int visual_param_entry_set_string (VisParamEntry *param, char *string) { visual_log_return_val_if_fail (param != NULL, -VISUAL_ERROR_PARAM_NULL); param->type = VISUAL_PARAM_ENTRY_TYPE_STRING; if (string == NULL && param->string == NULL) return VISUAL_OK; if (string == NULL && param->string != NULL) { visual_mem_free (param->string); param->string = NULL; visual_param_entry_changed (param); } else if (param->string == NULL && string != NULL) { param->string = strdup (string); visual_param_entry_changed (param); } else if (strcmp (string, param->string) != 0) { visual_mem_free (param->string); param->string = strdup (string); visual_param_entry_changed (param); } return VISUAL_OK; }
/** * Adds a VisParamEntry to a VisParamContainer. * * @param paramcontainer A pointer to the VisParamContainer in which the VisParamEntry is added. * @param param A pointer to the VisParamEntry that is added to the VisParamContainer. * * @return VISUAL_OK on succes, -VISUAL_ERROR_PARAM_CONTAINER_NULL, -VISUAL_ERROR_PARAM_NULL or * error values returned by visual_list_add () on failure. */ int visual_param_container_add (VisParamContainer *paramcontainer, VisParamEntry *param) { visual_log_return_val_if_fail (paramcontainer != NULL, -VISUAL_ERROR_PARAM_CONTAINER_NULL); visual_log_return_val_if_fail (param != NULL, -VISUAL_ERROR_PARAM_NULL); param->parent = paramcontainer; /* On container add, we always set changed once, so vars can be synchronised in the plugin * it's event loop */ visual_param_entry_changed (param); return visual_list_add (¶mcontainer->entries, param); }
/** * Sets the VisParamEntry to VISUAL_PARAM_ENTRY_TYPE_COLOR and assigns the rgb values from the given VisColor as argument to it. * * @param param Pointer to the VisParamEntry to which a parameter is set. * @param color Pointer to the VisColor from which the rgb values are copied into the parameter. * * @return VISUAL_OK on succes, -VISUAL_ERROR_PARAM_NULL on failure. */ int visual_param_entry_set_color_by_color (VisParamEntry *param, VisColor *color) { visual_log_return_val_if_fail (param != NULL, -VISUAL_ERROR_PARAM_NULL); param->type = VISUAL_PARAM_ENTRY_TYPE_COLOR; if (visual_color_compare (¶m->color, color) == FALSE) { visual_color_copy (¶m->color, color); visual_param_entry_changed (param); } return VISUAL_OK; }
/** * Sets the VisParamEntry to VISUAL_PARAM_ENTRY_TYPE_COLOR and assigns the rgb values given as arguments to it. * * @param param Pointer to the VisParamEntry to which a parameter is set. * @param r The red value for this color parameter. * @param g The green value for this color parameter. * @param b The blue value for this color parameter. * * @return VISUAL_OK on succes, -VISUAL_ERROR_PARAM_NULL on failure. */ int visual_param_entry_set_color (VisParamEntry *param, uint8_t r, uint8_t g, uint8_t b) { visual_log_return_val_if_fail (param != NULL, -VISUAL_ERROR_PARAM_NULL); param->type = VISUAL_PARAM_ENTRY_TYPE_COLOR; if (param->color.r != r || param->color.g != g || param->color.b != b) { visual_color_set (¶m->color, r, g, b); visual_param_entry_changed (param); } return VISUAL_OK; }
/** * Sets the VisParamEntry to VISUAL_PARAM_ENTRY_TYPE_DOUBLE and assigns the double given as argument to it. * * @param param Pointer to the VisParamEntry to which a parameter is set. * @param doubleflt The double value for this parameter. * * @return VISUAL_OK on succes, -VISUAL_ERROR_PARAM_NULL on failure. */ int visual_param_entry_set_double (VisParamEntry *param, double doubleflt) { visual_log_return_val_if_fail (param != NULL, -VISUAL_ERROR_PARAM_NULL); param->type = VISUAL_PARAM_ENTRY_TYPE_DOUBLE; if (param->numeric.doubleflt != doubleflt) { param->numeric.doubleflt = doubleflt; visual_param_entry_changed (param); } return VISUAL_OK; }
/** * Sets the VisParamEntry to VISUAL_PARAM_ENTRY_TYPE_FLOAT and assigns the float given as argument to it. * * @param param Pointer to the VisParamEntry to which a parameter is set. * @param floating The float value for this parameter. * * @return VISUAL_OK on succes, -VISUAL_ERROR_PARAM_NULL on failure. */ int visual_param_entry_set_float (VisParamEntry *param, float floating) { visual_log_return_val_if_fail (param != NULL, -VISUAL_ERROR_PARAM_NULL); param->type = VISUAL_PARAM_ENTRY_TYPE_FLOAT; if (param->numeric.floating != floating) { param->numeric.floating = floating; visual_param_entry_changed (param); } return VISUAL_OK; }
/** * Sets the VisParamEntry to VISUAL_PARAM_ENTRY_TYPE_INTEGER and assigns the integer given as argument to it. * * @param param Pointer to the VisParamEntry to which a parameter is set. * @param integer The integer value for this parameter. * * @return VISUAL_OK on succes, -VISUAL_ERROR_PARAM_NULL on failure. */ int visual_param_entry_set_integer (VisParamEntry *param, int integer) { visual_log_return_val_if_fail (param != NULL, -VISUAL_ERROR_PARAM_NULL); param->type = VISUAL_PARAM_ENTRY_TYPE_INTEGER; if (param->numeric.integer != integer) { param->numeric.integer = integer; visual_param_entry_changed (param); } return VISUAL_OK; }
/** * Sets the VisParamEntry to VISUAL_PARAM_ENTRY_TYPE_OBJECT and assigns a VisObject to the VisParamEntry. * With a VisObject VisParamEntry, the VisObject is referenced, not cloned. * * @param param Pointer to the VisParamEntry to which a parameter is set. * @param object Pointer to the VisObject that is linked to the VisParamEntry. * * @return VISUAL_OK on succes, -VISUAL_ERROR_PARAM_NULL on failure. */ int visual_param_entry_set_object (VisParamEntry *param, VisObject *object) { visual_log_return_val_if_fail (param != NULL, -VISUAL_ERROR_PARAM_NULL); param->type = VISUAL_PARAM_ENTRY_TYPE_OBJECT; if (param->objdata != NULL) visual_object_unref (param->objdata); param->objdata = object; if (param->objdata != NULL) visual_object_ref (param->objdata); visual_param_entry_changed (param); return VISUAL_OK; }
/** * Sets the VisParamEntry to VISUAL_PARAM_ENTRY_TYPE_PALETTE and assigns a VisPalette to the VisParamEntry. * This function does not check if there is a difference between the prior set palette and the new one, and always * emits the changed event. so watch out with usage. * * @param param Pointer to the VisParamEntry to which a parameter is set. * @param pal Pointer to the VisPalette from which the palette data is retrieved for the VisParamEntry. * * @return VISUAL_OK on succes, -VISUAL_ERROR_PARAM_NULL on failure. */ int visual_param_entry_set_palette (VisParamEntry *param, VisPalette *pal) { visual_log_return_val_if_fail (param != NULL, -VISUAL_ERROR_PARAM_NULL); param->type = VISUAL_PARAM_ENTRY_TYPE_PALETTE; visual_palette_free_colors (¶m->pal); if (pal != NULL) { visual_palette_allocate_colors (¶m->pal, pal->ncolors); visual_palette_copy (¶m->pal, pal); } visual_param_entry_changed (param); return VISUAL_OK; }
/** * Adds a VisParamEntry to a VisParamContainer, storing default values in the process. * * @param paramcontainer A pointer to the VisParamContainer in which the VisParamEntry is added. * @param param A pointer to the VisParamEntry that is added to the VisParamContainer. * * @return VISUAL_OK on succes, -VISUAL_ERROR_PARAM_CONTAINER_NULL, -VISUAL_ERROR_PARAM_NULL or * error values returned by visual_list_add () on failure. */ int visual_param_container_add_with_defaults (VisParamContainer *paramcontainer, VisParamEntry *param) { visual_log_return_val_if_fail (paramcontainer != NULL, -VISUAL_ERROR_PARAM_CONTAINER_NULL); visual_log_return_val_if_fail (param != NULL, -VISUAL_ERROR_PARAM_NULL); param->parent = paramcontainer; visual_mem_copy(¶m->defaultnum, ¶m->numeric, sizeof(param->defaultnum)); if(param->type == VISUAL_PARAM_ENTRY_TYPE_STRING) param->defaultstring = strdup(param->string); /* if(param->type == VISUAL_PARAM_ENTRY_TYPE_COLOR) visual_color_copy(¶m->defaultcolor, ¶m->color); */ /* On container add, we always set changed once, so vars can be synchronised in the plugin * it's event loop */ visual_param_entry_changed (param); return visual_list_add (¶mcontainer->entries, param); }