float.cpp revision 2992b54e5b7839b430b63a4df01abbc6f72f393f
/*
* Copyright (C) 2005-2007 Authors:
* Ted Gould <ted@gould.cx>
* Johan Engelen <johan@shouraizou.nl> *
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <gtkmm/adjustment.h>
#include <gtkmm/spinbutton.h>
#include "extension/extension.h"
#include "preferences.h"
#include "float.h"
namespace Inkscape {
namespace Extension {
/** \brief Use the superclass' allocator and set the \c _value */
bool gui_hidden,
{
if (defaultval != NULL) {
}
_precision = 1;
/* We're handling this by just killing both values */
_max = 10.0;
_min = 0.0;
}
// std::cout << "New Float:: value: " << _value << " max: " << _max << " min: " << _min << std::endl;
return;
}
/** \brief A function to set the \c _value
\param in The value to set to
\param doc A document that should be used to set the value.
\param node The node where the value may be placed
This function sets the internal value, but it also sets the value
in the preferences structure. To put it in the right place, \c PREF_DIR
and \c pref_name() are used.
*/
float
{
return _value;
}
/** \brief Return the value as a string */
void
{
string += startstring;
return;
}
/** \brief A class to make an adjustment that uses Extension params */
/** The parameter to adjust */
ParamFloat * _pref;
SPDocument * _doc;
public:
/** \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) {
return;
};
void val_changed (void);
}; /* class ParamFloatAdjustment */
/** \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;
if (_changeSignal != NULL) {
_changeSignal->emit();
}
return;
}
/**
\brief Creates a Float Adjustment for a float parameter
Builds a hbox with a label and a float adjustment in it.
*/
ParamFloat::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal)
{
if (_gui_hidden) return NULL;
ParamFloatAdjustment * fadjust = Gtk::manage(new ParamFloatAdjustment(this, doc, node, changeSignal));
scale->set_draw_value(false);
}
}
} /* namespace Extension */
} /* namespace Inkscape */