Logo Search packages:      
Sourcecode: inkscape version File versions

float Inkscape::Extension::Extension::set_param_float ( const gchar *  name,
float  value,
SPReprDoc *  doc = NULL 

Sets a parameter identified by name with the integer in the parameter value.

The passed in value
name The name of the parameter to set
value The value to set the parameter to
doc The document to look in for document specific parameters
To get the parameter to be used the function param_shared is called. This function is inline so it shouldn't cause the stack to build or anything like that. If it can't find the parameter, it will throw and exception - we aren't catching that because we want the calling function to catch it.

Next up, the parameter that we got, we're making sure that it is a integer parameter. If it isn't, then we throw a param_wrong_type exception.

Finally, if everything is okay, the integer value that was passed in is placed in the param.

Definition at line 731 of file extension.cpp.

References PARAM_FLOAT, param_shared(), parameters, Inkscape::Extension::Extension::param_switch_t::t_float, Inkscape::Extension::Extension::param_t::type, and Inkscape::Extension::Extension::param_t::val.

Referenced by Inkscape::Extension::Plugin::PrefAdjustment::val_changed().

    Extension::param_t * param;
      gchar * param_name;
    param = Extension::param_shared(name, parameters);

    if (param->type != Extension::PARAM_FLOAT) {
        throw Extension::param_wrong_type();

    param->val.t_float = value;

      param_name = g_strdup_printf("%s.%s", id, name);
      prefs_set_double_attribute("extensions", param_name, value);

    return value;

Generated by  Doxygen 1.6.0   Back to index