Ejemplo n.º 1
0
/**
 * Clones the source VisParamContainer into the destination VisParamContainer. When an entry with a certain name
 * already exists in the destination container, it will be overwritten with a new value.
 *
 * @param destcont A pointer to the VisParamContainer in which the VisParamEntry values are copied.
 * @param srccont A pointer to the VisParamContainer from which the VisParamEntry values are copied.
 *
 * @return VISUAL_OK on succes, -VISUAL_ERROR_PARAM_CONTAINER_NULL, on failure.
 */
int visual_param_container_copy (VisParamContainer *destcont, VisParamContainer *srccont)
{
	VisListEntry *le = NULL;
	VisParamEntry *destparam;
	VisParamEntry *srcparam;
	VisParamEntry *tempparam;

	visual_log_return_val_if_fail (destcont != NULL, -VISUAL_ERROR_PARAM_CONTAINER_NULL);
	visual_log_return_val_if_fail (srccont != NULL, -VISUAL_ERROR_PARAM_CONTAINER_NULL);

	while ((srcparam = visual_list_next (&srccont->entries, &le)) != NULL) {
		tempparam = visual_param_container_get (destcont, visual_param_entry_get_name (srcparam));

		/* Already exists, overwrite */
		if (tempparam != NULL) {
			visual_param_entry_set_from_param (tempparam, srcparam);

			continue;
		}

		/* Does not yet exist, create a new entry */
		destparam = visual_param_entry_new (visual_param_entry_get_name (srcparam));
		visual_param_entry_set_from_param (destparam, srcparam);

		visual_param_container_add (destcont, destparam);
	}

	return VISUAL_OK;
}
Ejemplo n.º 2
0
/**
 * Copies matching VisParamEntry elements from srccont into destcont, matching on the name.
 *
 * @param destcont A pointer to the VisParamContainer in which the VisParamEntry values are copied.
 * @param srccont A pointer to the VisParamContainer from which the VisParamEntry values are copied.
 *
 * @return VISUAL_OK on succes, -VISUAL_ERROR_PARAM_CONTAINER_NULL, on failure.
 */
int visual_param_container_copy_match (VisParamContainer *destcont, VisParamContainer *srccont)
{
	VisListEntry *le = NULL;
	VisParamEntry *destparam;
	VisParamEntry *srcparam;

	visual_log_return_val_if_fail (destcont != NULL, -VISUAL_ERROR_PARAM_CONTAINER_NULL);
	visual_log_return_val_if_fail (srccont != NULL, -VISUAL_ERROR_PARAM_CONTAINER_NULL);

	while ((destparam = visual_list_next (&destcont->entries, &le)) != NULL) {
		srcparam = visual_param_container_get (srccont, visual_param_entry_get_name (destparam));

		if (srcparam != NULL)
			visual_param_entry_set_from_param (destparam, srcparam);
	}

	return VISUAL_OK;
}
Ejemplo n.º 3
0
/**
 * Adds a list of VisParamEntry elements, the list is terminated by an entry of type VISUAL_PARAM_ENTRY_TYPE_END.
 * All the elements are reallocated, so this function can be used for static param lists.
 *
 * @param paramcontainer A pointer to the VisParamContainer in which the VisParamEntry elements are added.
 * @param params A pointer to the VisParamEntry elements that are added to the VisParamContainer.
 *
 * @return VISUAL_OK on succes, -VISUAL_ERROR_PARAM_CONTAINER_NULL or -VISUAL_ERROR_PARAM_NULL on failure.
 */
int visual_param_container_add_many (VisParamContainer *paramcontainer, VisParamEntry *params)
{
	VisParamEntry *pnew;
	int i = 0;

	visual_log_return_val_if_fail (paramcontainer != NULL, -VISUAL_ERROR_PARAM_CONTAINER_NULL);
	visual_log_return_val_if_fail (params != NULL, -VISUAL_ERROR_PARAM_NULL);

	while (params[i].type != VISUAL_PARAM_ENTRY_TYPE_END) {
		pnew = visual_param_entry_new (visual_param_entry_get_name (&params[i]));
		visual_param_entry_set_from_param (pnew, &params[i]);

		visual_param_container_add (paramcontainer, pnew);

		i++;
	}

	return VISUAL_OK;
}
Ejemplo n.º 4
0
static void show_options (AVSElement *element)
{
        return;
        VisParamEntry *param;
        VisHashmapChainEntry *mentry;
        VisCollectionIter *iter;

        if (element == NULL)
                return;

        printf ("Element options of element type: %d\n", element->type);

        iter = visual_collection_get_iter (VISUAL_COLLECTION (&element->pcont->entries));

        while (visual_collection_iter_has_more (iter)) {
            printf("Bleh\n");
                mentry = visual_collection_iter_get_data (iter);
                param = mentry->data;

                switch (param->type) {
                        case VISUAL_PARAM_ENTRY_TYPE_NULL:
                                printf ("\t%s: Type NULL\n",
                                                visual_param_entry_get_name (param));

                                break;

                        case VISUAL_PARAM_ENTRY_TYPE_STRING:
                                printf ("\t%s: Type STRING: %s\n",
                                                visual_param_entry_get_name (param),
                                                visual_param_entry_get_string (param));

                                break;

                        case VISUAL_PARAM_ENTRY_TYPE_INTEGER:
                                printf ("\t%s: Type INTEGER: %d\n",
                                                visual_param_entry_get_name (param),
                                                visual_param_entry_get_integer (param));

                                break;

                        case VISUAL_PARAM_ENTRY_TYPE_FLOAT:
                                printf ("\t%s: Type FLOAT: %f\n",
                                                visual_param_entry_get_name (param),
                                                visual_param_entry_get_float (param));

                                break;

                        case VISUAL_PARAM_ENTRY_TYPE_DOUBLE:
                                printf ("\t%s: Type DOUBLE: %f\n",
                                                visual_param_entry_get_name (param),
                                                visual_param_entry_get_double (param));

                                break;

                        case VISUAL_PARAM_ENTRY_TYPE_COLOR:
                                printf ("\t%s: Type COLOR: %d %d %d\n",
                                                visual_param_entry_get_name (param),
                                                param->color.r, param->color.g, param->color.b);

                                break;

                        case VISUAL_PARAM_ENTRY_TYPE_PALETTE:
                                {
                                        int i;

                                        printf ("\t%s: Type PALETTE:\n",
                                                        visual_param_entry_get_name (param));

                                        for (i = 0; i < param->pal.ncolors; i++) {
                                                printf ("\t\tcolor[%d] %d %d %d\n", i,
                                                                param->pal.colors[i].r,
                                                                param->pal.colors[i].g,
                                                                param->pal.colors[i].b);
                                        }
                                }
                                break;

            default:
                break;
                }
        }

        printf ("\n");
}