summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 800e100)
raw | patch | inline | side by side (parent: 800e100)
author | johanengelen <johanengelen@users.sourceforge.net> | |
Wed, 16 Jan 2008 19:21:46 +0000 (19:21 +0000) | ||
committer | johanengelen <johanengelen@users.sourceforge.net> | |
Wed, 16 Jan 2008 19:21:46 +0000 (19:21 +0000) |
index 65caa41cb5b13cbe21172c33bd18b2cdbe995bb8..51aa4378313b31ad88569d2821ce32e648eb7f31 100644 (file)
CanvasAxonomGrid::newSpecificWidget()
{
Gtk::Table * table = Gtk::manage( new Gtk::Table(1,1) );
+ table->set_spacings(2);
+
+_wr.setUpdating (true);
Inkscape::UI::Widget::RegisteredUnitMenu *_rumg = new Inkscape::UI::Widget::RegisteredUnitMenu();
Inkscape::UI::Widget::RegisteredScalarUnit *_rsu_ox = new Inkscape::UI::Widget::RegisteredScalarUnit();
Inkscape::UI::Widget::RegisteredScalarUnit *_rsu_oy = new Inkscape::UI::Widget::RegisteredScalarUnit();
Inkscape::UI::Widget::RegisteredScalarUnit *_rsu_sy = new Inkscape::UI::Widget::RegisteredScalarUnit();
- Inkscape::UI::Widget::RegisteredScalar *_rsu_ax = new Inkscape::UI::Widget::RegisteredScalar();
- Inkscape::UI::Widget::RegisteredScalar *_rsu_az = new Inkscape::UI::Widget::RegisteredScalar();
+ Inkscape::UI::Widget::RegisteredScalar *_rsu_ax = Gtk::manage( new Inkscape::UI::Widget::RegisteredScalar(
+ _("Angle X:"), _("Angle of x-axis"), "gridanglex", _wr, repr, doc ) );
+ Inkscape::UI::Widget::RegisteredScalar *_rsu_az = Gtk::manage( new Inkscape::UI::Widget::RegisteredScalar(
+ _("Angle Z:"), _("Angle of z-axis"), "gridanglez", _wr, repr, doc ) );
Inkscape::UI::Widget::RegisteredColorPicker *_rcp_gcol = new Inkscape::UI::Widget::RegisteredColorPicker();
Inkscape::UI::Widget::RegisteredColorPicker *_rcp_gmcol = new Inkscape::UI::Widget::RegisteredColorPicker();
Inkscape::UI::Widget::RegisteredSuffixedInteger *_rsi = new Inkscape::UI::Widget::RegisteredSuffixedInteger();
- // initialize widgets:
- table->set_spacings(2);
-
-_wr.setUpdating (true);
Inkscape::UI::Widget::ScalarUnit * sutemp = NULL;
_rumg->init (_("Grid _units:"), "units", _wr, repr, doc);
_rsu_ox->init (_("_Origin X:"), _("X coordinate of grid origin"),
sutemp = _rsu_sy->getSU();
sutemp->setDigits(4);
sutemp->setIncrements(0.1, 1.0);
- _rsu_ax->init (_("Angle X:"), _("Angle of x-axis"),
- "gridanglex", _wr, repr, doc);
- _rsu_az->init (_("Angle Z:"), _("Angle of z-axis"),
- "gridanglez", _wr, repr, doc);
_rcp_gcol->init (_("Grid line _color:"), _("Grid line color"),
_("Color of grid lines"), "color", "opacity", _wr, repr, doc);
_rcp_gmcol->init (_("Ma_jor grid line color:"), _("Major grid line color"),
0, _rsu_ox->getSU(),
0, _rsu_oy->getSU(),
0, _rsu_sy->getSU(),
- 0, _rsu_ax->getS(),
- 0, _rsu_az->getS(),
+ 0, _rsu_ax,
+ 0, _rsu_az,
_rcp_gcol->_label, _rcp_gcol->_cp,
0, 0,
_rcp_gmcol->_label, _rcp_gmcol->_cp,
index ca08b2b3da0bf9569409279c2843a608804ae7ea..67111ef9e003cca691a0dc1522dc0f6c25587d62 100644 (file)
min = -NR_HUGE;
max = NR_HUGE;
integer = false;
- rsu = NULL;
inc_step = 0.1;
inc_page = 1;
digits = 2;
ScalarParam::~ScalarParam()
{
- if (rsu)
- delete rsu;
}
bool
value = max;
if (value < min)
value = min;
-
- if (rsu && !rsu->is_updating())
- rsu->setValue(value);
}
void
{
this->min = min;
this->max = max;
- if (rsu)
- rsu->getS()->setRange(this->min, this->max);
param_set_value(value); // reset value to see whether it is in ranges
}
digits = 0;
inc_step = 1;
inc_page = 10;
- if (rsu) {
- rsu->getS()->setDigits(digits);
- rsu->getS()->setIncrements(inc_step, inc_page);
- }
}
Gtk::Widget *
ScalarParam::param_newWidget(Gtk::Tooltips * tooltips)
{
- // WIDGET TODO: This implementation is incorrect, it should create a *new* widget for the caller, not just return an already created widget
- g_warning("ScalarParam::param_newWidget still needs recoding to work with multiple document views");
- if (!rsu) {
- rsu = new Inkscape::UI::Widget::RegisteredScalar();
- rsu->init(param_label, param_tooltip, param_key, *param_wr, param_effect->getRepr(), param_effect->getSPDoc());
- rsu->setValue(value);
- rsu->getS()->setDigits(digits);
- rsu->getS()->setIncrements(inc_step, inc_page);
- rsu->getS()->setRange(min, max);
-
- rsu->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change scalar parameter"));
- }
- return dynamic_cast<Gtk::Widget *> (rsu->getS());
+ Inkscape::UI::Widget::RegisteredScalar *rsu = Gtk::manage( new Inkscape::UI::Widget::RegisteredScalar(
+ param_label, param_tooltip, param_key, *param_wr, param_effect->getRepr(), param_effect->getSPDoc() ) );
+
+ rsu->setValue(value);
+ rsu->setDigits(digits);
+ rsu->setIncrements(inc_step, inc_page);
+ rsu->setRange(min, max);
+
+ rsu->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change scalar parameter"));
+
+ return dynamic_cast<Gtk::Widget *> (rsu);
}
void
ScalarParam::param_set_digits(unsigned digits)
{
this->digits = digits;
- if (rsu) {
- rsu->getS()->setDigits(digits);
- }
}
void
{
inc_step = step;
inc_page = page;
- if (rsu) {
- rsu->getS()->setIncrements(inc_step, inc_page);
- }
}
index 67384a6e62320f2af9b103620a5c639232d0cf6e..256ab343f4ca7cb14f29812969b9000d0a5f3088 100644 (file)
gdouble max;
bool integer;
gdouble defvalue;
- Inkscape::UI::Widget::RegisteredScalar * rsu;
unsigned digits;
double inc_step;
double inc_page;
index 6848dbe051070ca0852cf1f33ff65b4de3742c4d..dfa42107e76e26948db8f09591f24caf0be87b5d 100644 (file)
}
-RegisteredScalar::RegisteredScalar()
-{
- _widget = NULL;
-}
+/*#########################################
+ * Registered SCALAR
+ */
RegisteredScalar::~RegisteredScalar()
{
- if (_widget)
- delete _widget;
-
_value_changed_connection.disconnect();
}
-void
-RegisteredScalar::init ( const Glib::ustring& label, const Glib::ustring& tip,
+RegisteredScalar::RegisteredScalar ( const Glib::ustring& label, const Glib::ustring& tip,
const Glib::ustring& key, Registry& wr, Inkscape::XML::Node* repr_in,
SPDocument * doc_in )
+ : RegisteredWidget<Scalar>(label, tip)
{
init_parent(key, wr, repr_in, doc_in);
- _widget = new Scalar (label, tip);
- _widget->setRange (-1e6, 1e6);
- _widget->setDigits (2);
- _widget->setIncrements(0.1, 1.0);
- _value_changed_connection = _widget->signal_value_changed().connect (sigc::mem_fun (*this, &RegisteredScalar::on_value_changed));
-}
-
-Scalar*
-RegisteredScalar::getS()
-{
- return _widget;
-}
-
-void
-RegisteredScalar::setValue (double val)
-{
- if (_widget)
- _widget->setValue (val);
+ setRange (-1e6, 1e6);
+ setDigits (2);
+ setIncrements(0.1, 1.0);
+ _value_changed_connection = signal_value_changed().connect (sigc::mem_fun (*this, &RegisteredScalar::on_value_changed));
}
void
RegisteredScalar::on_value_changed()
{
- if (_widget->setProgrammatically) {
- _widget->setProgrammatically = false;
+ if (setProgrammatically) {
+ setProgrammatically = false;
return;
}
_wr->setUpdating (true);
Inkscape::SVGOStringStream os;
- os << _widget->getValue();
+ os << getValue();
- _widget->set_sensitive(false);
+ set_sensitive(false);
write_to_xml(os.str().c_str());
- _widget->set_sensitive(true);
+ set_sensitive(true);
_wr->setUpdating (false);
}
+/*#########################################
+ * Registered COLORPICKER
+ */
+
RegisteredColorPicker::RegisteredColorPicker()
: _label(0), _cp(0)
{
index 185d1e3b4b973800310aa9796a9b6830d255ff03..9a0ba46fc5ddb185c38e8da96cc8e7f8ad632349 100644 (file)
void on_value_changed();
};
-class RegisteredScalar : public RegisteredWdg {
+class RegisteredScalar : public RegisteredWidget<Scalar> {
public:
- RegisteredScalar();
- ~RegisteredScalar();
- void init (const Glib::ustring& label,
+ virtual ~RegisteredScalar();
+ RegisteredScalar (const Glib::ustring& label,
const Glib::ustring& tip,
const Glib::ustring& key,
Registry& wr,
- Inkscape::XML::Node* repr_in,
- SPDocument *doc_in);
- inline void init ( const Glib::ustring& label,
- const Glib::ustring& tip,
- const Glib::ustring& key,
- Registry& wr)
- { init(label, tip, key, wr, NULL, NULL); };
-
- Scalar* getS();
- void setValue (double);
+ Inkscape::XML::Node* repr_in = NULL,
+ SPDocument *doc_in = NULL );
protected:
- Scalar *_widget;
sigc::connection _value_changed_connection;
void on_value_changed();
};