summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f4ab745)
raw | patch | inline | side by side (parent: f4ab745)
author | johanengelen <johanengelen@users.sourceforge.net> | |
Wed, 16 Jan 2008 20:12:15 +0000 (20:12 +0000) | ||
committer | johanengelen <johanengelen@users.sourceforge.net> | |
Wed, 16 Jan 2008 20:12:15 +0000 (20:12 +0000) |
index 19513f531a9c1a1f9a4fee416eb7a1a1c70b0fda..de7d5ce7c6e846372cbcd3e951bf5f78ac8759ec 100644 (file)
transform.setTranslation( start );
Piecewise<D2<SBasis> > pwd2_out = (strokepath-stroke_origin) * transform;
// add stuff to one big pw<d2<sbasis> > and then outside the loop convert to path?
- std::vector<Path> result = Geom::path_from_piecewise(pwd2_out, LPE_CONVERSION_TOLERANCE);
+ std::vector<Geom::Path> result = Geom::path_from_piecewise(pwd2_out, LPE_CONVERSION_TOLERANCE);
path_out[i] = result[0];
gdouble sv = spacing_variation;
tA += incrementA * (1 + sv - spacing_variation.get_value()/2);
// set the stroke path to run horizontally in the middle of the bounding box of the original path
Piecewise<D2<SBasis> > pwd2;
- std::vector<Path> temppath = SVGD_to_2GeomPath( SP_OBJECT_REPR(item)->attribute("inkscape:original-d"));
+ std::vector<Geom::Path> temppath = SVGD_to_2GeomPath( SP_OBJECT_REPR(item)->attribute("inkscape:original-d"));
for (unsigned int i=0; i < temppath.size(); i++) {
pwd2.concat( temppath[i].toPwSb() );
}
index ef6373274462922def2c5a417aa0994815d70d88..b3d0fdd4cff70f29e0ce05c3d8232ac184acfa6c 100644 (file)
// set the bend path to run horizontally in the middle of the bounding box of the original path
Piecewise<D2<SBasis> > pwd2;
- std::vector<Path> temppath = SVGD_to_2GeomPath( SP_OBJECT_REPR(item)->attribute("inkscape:original-d"));
+ std::vector<Geom::Path> temppath = SVGD_to_2GeomPath( SP_OBJECT_REPR(item)->attribute("inkscape:original-d"));
for (unsigned int i=0; i < temppath.size(); i++) {
pwd2.concat( temppath[i].toPwSb() );
}
index f0f3b59f8fdeadc068e3caf56f9fc585e00a9046..1778af8f15e3ea37efe595ac9fd45320c6a2e449 100644 (file)
E default_value)
: Parameter(label, tip, key, wr, effect)
{
- regenum = NULL;
enumdataconv = &c;
defvalue = default_value;
value = defvalue;
};
- virtual ~EnumParam() {
- if (regenum)
- delete regenum;
- };
+
+ virtual ~EnumParam() { };
virtual Gtk::Widget * 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("EnumParam::param_newWidget still needs recoding to work with multiple document views");
- if (!regenum) {
- regenum = new Inkscape::UI::Widget::RegisteredEnum<E>();
- regenum->init(param_label, param_tooltip, param_key, *enumdataconv, *param_wr, param_effect->getRepr(), param_effect->getSPDoc());
- regenum->combobox()->set_active_by_id(value);
- regenum->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change enum parameter"));
- }
- return dynamic_cast<Gtk::Widget *> (regenum->labelled);
+ Inkscape::UI::Widget::RegisteredEnum<E> *regenum = Gtk::manage (
+ new Inkscape::UI::Widget::RegisteredEnum<E>( param_label, param_tooltip,
+ param_key, *enumdataconv, *param_wr, param_effect->getRepr(), param_effect->getSPDoc() ) );
+
+ regenum->set_active_by_id(value);
+ regenum->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change enum parameter"));
+
+ return dynamic_cast<Gtk::Widget *> (regenum);
};
bool param_readSVGValue(const gchar * strvalue) {
void param_set_value(E val) {
value = val;
- if (regenum)
- regenum->combobox()->set_active_by_id(value);
}
private:
EnumParam(const EnumParam&);
EnumParam& operator=(const EnumParam&);
- UI::Widget::RegisteredEnum<E> * regenum;
E value;
E defvalue;
index e3c72e821d3e9b1a6bd696590b5d7080cde15fc1..7397458170e7a21c77060e7db8981ad01d4e1679 100644 (file)
namespace UI {
namespace Widget {
-template<typename E> class RegisteredEnum : public RegisteredWdg
+template<typename E> class RegisteredEnum : public RegisteredWidget< LabelledComboBoxEnum<E> >
{
public:
- RegisteredEnum() {
- labelled = NULL;
- }
-
- ~RegisteredEnum() {
+ virtual ~RegisteredEnum() {
_changed_connection.disconnect();
- if (labelled)
- delete labelled;
}
- void init ( const Glib::ustring& label,
+ RegisteredEnum ( const Glib::ustring& label,
const Glib::ustring& tip,
const Glib::ustring& key,
const Util::EnumDataConverter<E>& c,
Registry& wr,
- Inkscape::XML::Node* repr_in,
- SPDocument *doc_in)
+ Inkscape::XML::Node* repr_in = NULL,
+ SPDocument *doc_in = NULL )
+ : RegisteredWidget< LabelledComboBoxEnum<E> >(label, tip, c)
{
- init_parent(key, wr, repr_in, doc_in);
-
- labelled = new LabelledComboBoxEnum<E> (label, tip, c);
+ RegisteredWidget< LabelledComboBoxEnum<E> >::init_parent(key, wr, repr_in, doc_in);
_changed_connection = combobox()->signal_changed().connect (sigc::mem_fun (*this, &RegisteredEnum::on_changed));
}
- inline void init ( const Glib::ustring& label,
- const Glib::ustring& key,
- Registry& wr)
- {
- init(label, key, wr, NULL, NULL);
- }
-
void set_active_by_id (E id) {
- ComboBoxEnum<E> * cb = combobox();
- if (cb)
- cb->set_active_by_id(id);
+ combobox()->set_active_by_id(id);
};
void set_active_by_key (const Glib::ustring& key) {
- ComboBoxEnum<E> * cb = combobox();
- if (cb)
- cb->set_active_by_key(key);
+ combobox()->set_active_by_key(key);
}
inline const Util::EnumData<E>* get_active_data() {
- ComboBoxEnum<E> * cb = combobox();
- if (cb)
- return cb->get_active_data();
- else
- return NULL;
+ combobox()->get_active_data();
}
ComboBoxEnum<E> * combobox() {
- if (labelled) {
- return labelled->getCombobox();
- } else {
- return NULL;
- }
+ return LabelledComboBoxEnum<E>::getCombobox();
}
- LabelledComboBoxEnum<E> * labelled;
sigc::connection _changed_connection;
protected:
return;
}
- if (_wr->isUpdating())
+ if (RegisteredWidget< LabelledComboBoxEnum<E> >::_wr->isUpdating())
return;
- _wr->setUpdating (true);
+
+ RegisteredWidget< LabelledComboBoxEnum<E> >::_wr->setUpdating (true);
const Util::EnumData<E>* data = combobox()->get_active_data();
if (data) {
- write_to_xml(data->key.c_str());
+ RegisteredWidget< LabelledComboBoxEnum<E> >::write_to_xml(data->key.c_str());
}
- _wr->setUpdating (false);
+ RegisteredWidget< LabelledComboBoxEnum<E> >::_wr->setUpdating (false);
}
};
index dfa42107e76e26948db8f09591f24caf0be87b5d..f471dc40d35d1d5f3caa5ec48be3861d3eed2965 100644 (file)
#include "svg/svg-color.h"
#include "svg/stringstream.h"
-#include "inkscape.h"
-#include "document.h"
-#include "desktop-handles.h"
-#include "sp-namedview.h"
-
#include "verbs.h"
// for interruptability bug:
//===================================================
-//---------------------------------------------------
-
-
-
-template<class W>
-void RegisteredWidget<W>::write_to_xml(const char * svgstr)
-{
- // Use local repr here. When repr is specified, use that one, but
- // if repr==NULL, get the repr of namedview of active desktop.
- Inkscape::XML::Node *local_repr = repr;
- SPDocument *local_doc = doc;
- if (!local_repr) {
- // no repr specified, use active desktop's namedview's repr
- SPDesktop* dt = SP_ACTIVE_DESKTOP;
- local_repr = SP_OBJECT_REPR (sp_desktop_namedview(dt));
- local_doc = sp_desktop_document(dt);
- }
-
- bool saved = sp_document_get_undo_sensitive (local_doc);
- sp_document_set_undo_sensitive (local_doc, false);
- if (!write_undo) local_repr->setAttribute(_key.c_str(), svgstr);
- sp_document_set_undo_sensitive (local_doc, saved);
-
- local_doc->setModifiedSinceSave();
-
- if (write_undo) {
- local_repr->setAttribute(_key.c_str(), svgstr);
- sp_document_done (local_doc, event_type, event_description);
- }
-}
-
void
RegisteredWdg::write_to_xml(const char * svgstr)
{
index 9a0ba46fc5ddb185c38e8da96cc8e7f8ad632349..900eaafbb7b0ddd0e71c443d9698282e47c6d8da 100644 (file)
#include "ui/widget/point.h"
#include "ui/widget/random.h"
+#include "inkscape.h"
+
+#include "document.h"
+#include "desktop-handles.h"
+#include "sp-namedview.h"
class SPUnit;
class SPDocument;
g_warning("Initialization of registered widget using defined repr but with doc==NULL");
}
- void write_to_xml(const char * svgstr);
+ void write_to_xml(const char * svgstr)
+ {
+ // Use local repr here. When repr is specified, use that one, but
+ // if repr==NULL, get the repr of namedview of active desktop.
+ Inkscape::XML::Node *local_repr = repr;
+ SPDocument *local_doc = doc;
+ if (!local_repr) {
+ // no repr specified, use active desktop's namedview's repr
+ SPDesktop* dt = SP_ACTIVE_DESKTOP;
+ local_repr = SP_OBJECT_REPR (sp_desktop_namedview(dt));
+ local_doc = sp_desktop_document(dt);
+ }
+
+ bool saved = sp_document_get_undo_sensitive (local_doc);
+ sp_document_set_undo_sensitive (local_doc, false);
+ if (!write_undo) local_repr->setAttribute(_key.c_str(), svgstr);
+ sp_document_set_undo_sensitive (local_doc, saved);
+
+ local_doc->setModifiedSinceSave();
+
+ if (write_undo) {
+ local_repr->setAttribute(_key.c_str(), svgstr);
+ sp_document_done (local_doc, event_type, event_description);
+ }
+ }
Registry * _wr;
Glib::ustring _key;