/** \brief Wrapper to cast to the object and use it's function. */ float Parameter::get_float (const SPDocument * doc, const Inkscape::XML::Node * node) { ParamFloat * floatpntr = dynamic_cast<ParamFloat *>(this); if (floatpntr == NULL) throw Extension::param_not_float_param(); return floatpntr->get(doc, node); }
/** Wrapper to cast to the object and use it's function. */ float Parameter::set_float (float in, SPDocument * doc, Inkscape::XML::Node * node) { ParamFloat * floatpntr; floatpntr = dynamic_cast<ParamFloat *>(this); if (floatpntr == NULL) throw Extension::param_not_float_param(); return floatpntr->set(in, doc, node); }
/** \brief A function to respond to the value_changed signal from the adjustment. This function just grabs the value from the adjustment and writes it to the parameter. Very simple, but yet beautiful. */ void ParamFloatAdjustment::val_changed (void) { //std::cout << "Value Changed to: " << this->get_value() << std::endl; _pref->set(this->get_value(), _doc, _node); if (_changeSignal != NULL) { _changeSignal->emit(); } return; }
/** \brief Make the adjustment using an extension and the string describing the parameter. */ ParamFloatAdjustment (ParamFloat * param, SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal) : Gtk::Adjustment(0.0, param->min(), param->max(), 0.1, 0), _pref(param), _doc(doc), _node(node), _changeSignal(changeSignal) { this->set_value(_pref->get(NULL, NULL) /* \todo fix */); this->signal_value_changed().connect(sigc::mem_fun(this, &ParamFloatAdjustment::val_changed)); return; };