summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: aa21538)
raw | patch | inline | side by side (parent: aa21538)
author | gouldtj <gouldtj@users.sourceforge.net> | |
Wed, 27 Jun 2007 06:26:13 +0000 (06:26 +0000) | ||
committer | gouldtj <gouldtj@users.sourceforge.net> | |
Wed, 27 Jun 2007 06:26:13 +0000 (06:26 +0000) |
Wow, the basics are kinda working. Only for ints and floats, and it
seems to not like repeadative entry. But, it really is seeming very
feasible.
seems to not like repeadative entry. But, it really is seeming very
feasible.
index 80dc776e3aa62e789eea902b95cd872fb2aa6f71..6ae9eae50277086d0212ee2e8bc45fd4ec02ee5f 100644 (file)
--- a/src/extension/effect.cpp
+++ b/src/extension/effect.cpp
#include "inkscape-private.h"
#include "helper/action.h"
+#include "ui/view/view.h"
+#include "desktop-handles.h"
+#include "selection.h"
+#include "sp-namedview.h"
#include "document.h"
#include "prefdialog.h"
#include "implementation/implementation.h"
#include "gtkmm/messagedialog.h"
+#include "util/glib-list-iterators.h"
+
/* Inkscape::Extension::Effect */
namespace Inkscape {
bool _canceled;
Glib::RefPtr<Glib::MainLoop> _mainloop;
Inkscape::UI::View::View * _doc;
+ std::list<Glib::ustring> _selected;
public:
void run (void);
_canceled(false),
_doc(doc) {
+ SPDesktop *desktop = (SPDesktop *)_doc;
+ sp_namedview_document_from_window(desktop);
+
+ if (desktop != NULL) {
+ Inkscape::Util::GSListConstIterator<SPItem *> selected =
+ sp_desktop_selection(desktop)->itemList();
+ while ( selected != NULL ) {
+ Glib::ustring selected_id;
+ selected_id = SP_OBJECT_ID(*selected);
+ _selected.insert(_selected.end(), selected_id);
+ std::cout << "Selected: " << selected_id << std::endl;
+ ++selected;
+ }
+ }
+
_mainloop = Glib::MainLoop::create(false);
if (controls != NULL) {
}
void preferencesChange (void) {
+ std::cout << "Preferences are a changin'" << std::endl;
if (_humanWait) {
_mainloop->quit();
documentCancel();
Effect::set_last_effect(_effect);
return;
}
+
+ void reselect (void) {
+ SPDocument * doc = _doc->doc();
+
+ SPDesktop *desktop = (SPDesktop *)_doc;
+ sp_namedview_document_from_window(desktop);
+
+ if (desktop == NULL) { return; }
+
+ Inkscape::Selection * selection = sp_desktop_selection(desktop);
+
+ for (std::list<Glib::ustring>::iterator i = _selected.begin(); i != _selected.end(); i++) {
+ selection->add(doc->getObjectById(i->c_str()));
+ }
+
+ return;
+ }
};
void
}
if (_canceled) {
sp_document_cancel(_doc->doc());
+ reselect();
}
}
return;
index 20aff9c03519eaa311bee643460fe678d47dcb07..5082ba08e4bfc424fef7095e2940c6e7eec9a617 100644 (file)
@@ -631,7 +631,7 @@ Extension::autogui (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<v
for (GSList * list = parameters; list != NULL; list = g_slist_next(list)) {
Parameter * param = reinterpret_cast<Parameter *>(list->data);
- Gtk::Widget * widg = param->get_widget(doc, node);
+ Gtk::Widget * widg = param->get_widget(doc, node, changeSignal);
gchar const * tip = param->get_tooltip();
agui->addWidget(widg, tip);
}
index 96c436dfd0766f6bc5799c348369740cd443df4d..85b2addcb3e879dea714ee09b0279a3d62305c48 100644 (file)
first_select = SP_OBJECT_REPR(item);
}
- return module->autogui(current_document, first_select);
+ return module->autogui(current_document, first_select, changeSignal);
}
index 283ef8f5c23ffe30dfc4257a4b39192ff59cdcb1..b9dab676fc0e067107ddfb4f0e29b71d43f258e1 100644 (file)
\brief Creates a combobox widget for an enumeration parameter
*/
Gtk::Widget *
-ParamComboBox::get_widget (SPDocument * doc, Inkscape::XML::Node * node)
+ParamComboBox::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal)
{
Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4));
index 4ad4485496efb3b72d284885088e636bbfd78a6e..b5eaeded7bdbe4b011c7b44b3755369eafa21d82 100644 (file)
public:
ParamComboBox(const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml);
~ParamComboBox(void);
- Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node);
+ Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal);
Glib::ustring * string (void);
const gchar * get (const SPDocument * doc, const Inkscape::XML::Node * node) { return _value; }
index 50b90f71c6a1fee3c88069da0a21f85667edce16..4d66192366107f3ad1f763ce8c61f809883ecf84 100644 (file)
gchar * _value;
public:
ParamDescription(const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml);
- Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node);
+ Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal);
};
/** \brief A boolean parameter */
/** \brief Returns \c _value */
bool get (const SPDocument * doc, const Inkscape::XML::Node * node) { return _value; }
bool set (bool in, SPDocument * doc, Inkscape::XML::Node * node);
- Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node);
+ Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal);
Glib::ustring * string (void);
};
int set (int in, SPDocument * doc, Inkscape::XML::Node * node);
int max (void) { return _max; }
int min (void) { return _min; }
- Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node);
+ Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal);
Glib::ustring * string (void);
};
float set (float in, SPDocument * doc, Inkscape::XML::Node * node);
float max (void) { return _max; }
float min (void) { return _min; }
- Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node);
+ Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal);
Glib::ustring * string (void);
};
/** \brief Returns \c _value, with a \i const to protect it. */
const gchar * get (const SPDocument * doc, const Inkscape::XML::Node * node) { return _value; }
const gchar * set (const gchar * in, SPDocument * doc, Inkscape::XML::Node * node);
- Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node);
+ Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal);
Glib::ustring * string (void);
};
/** \brief Returns \c _value, with a \i const to protect it. */
const gchar * get (const SPDocument * doc, const Inkscape::XML::Node * node) { return _current_choice != NULL ? _current_choice->_value : NULL; }
const gchar * set (const gchar * in, SPDocument * doc, Inkscape::XML::Node * node);
- Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node);
+ Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal);
Glib::ustring * string (void);
}; /* class ParamEnum */
/** \brief Basically, if there is no widget pass a NULL. */
Gtk::Widget *
-Parameter::get_widget (SPDocument * doc, Inkscape::XML::Node * node)
+Parameter::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal)
{
return NULL;
}
ParamFloat * _pref;
SPDocument * _doc;
Inkscape::XML::Node * _node;
+ sigc::signal<void> * _changeSignal;
public:
/** \brief Make the adjustment using an extension and the string
describing the parameter. */
- ParamFloatAdjustment (ParamFloat * param, SPDocument * doc, Inkscape::XML::Node * node) :
- Gtk::Adjustment(0.0, param->min(), param->max(), 0.1), _pref(param), _doc(doc), _node(node) {
+ ParamFloatAdjustment (ParamFloat * param, SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal) :
+ Gtk::Adjustment(0.0, param->min(), param->max(), 0.1), _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;
void
ParamFloatAdjustment::val_changed (void)
{
- // std::cout << "Value Changed to: " << this->get_value() << std::endl;
+ std::cout << "Value Changed to: " << this->get_value() << std::endl;
_pref->set(this->get_value(), _doc, _node);
+ if (_changeSignal != NULL) {
+ _changeSignal->emit();
+ } else {
+ std::cout << "_changeSignal is NULL" << std::endl;
+ }
return;
}
ParamInt * _pref;
SPDocument * _doc;
Inkscape::XML::Node * _node;
+ sigc::signal<void> * _changeSignal;
public:
/** \brief Make the adjustment using an extension and the string
describing the parameter. */
- ParamIntAdjustment (ParamInt * param, SPDocument * doc, Inkscape::XML::Node * node) :
- Gtk::Adjustment(0.0, param->min(), param->max(), 1.0), _pref(param), _doc(doc), _node(node) {
+ ParamIntAdjustment (ParamInt * param, SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal) :
+ Gtk::Adjustment(0.0, param->min(), param->max(), 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, &ParamIntAdjustment::val_changed));
return;
void
ParamIntAdjustment::val_changed (void)
{
- // std::cout << "Value Changed to: " << this->get_value() << std::endl;
+ std::cout << "Value Changed to: " << this->get_value() << std::endl;
_pref->set((int)this->get_value(), _doc, _node);
+ if (_changeSignal != NULL) {
+ _changeSignal->emit();
+ } else {
+ std::cout << "_changeSignal is NULL" << std::endl;
+ }
return;
}
Builds a hbox with a label and a float adjustment in it.
*/
Gtk::Widget *
-ParamFloat::get_widget (SPDocument * doc, Inkscape::XML::Node * node)
+ParamFloat::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal)
{
Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4));
label->show();
hbox->pack_start(*label, true, true);
- ParamFloatAdjustment * fadjust = Gtk::manage(new ParamFloatAdjustment(this, doc, node));
+ ParamFloatAdjustment * fadjust = Gtk::manage(new ParamFloatAdjustment(this, doc, node, changeSignal));
Gtk::SpinButton * spin = Gtk::manage(new Gtk::SpinButton(*fadjust, 0.1, 1));
spin->show();
hbox->pack_start(*spin, false, false);
Builds a hbox with a label and a int adjustment in it.
*/
Gtk::Widget *
-ParamInt::get_widget (SPDocument * doc, Inkscape::XML::Node * node)
+ParamInt::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal)
{
Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4));
label->show();
hbox->pack_start(*label, true, true);
- ParamIntAdjustment * fadjust = Gtk::manage(new ParamIntAdjustment(this, doc, node));
+ ParamIntAdjustment * fadjust = Gtk::manage(new ParamIntAdjustment(this, doc, node, changeSignal));
Gtk::SpinButton * spin = Gtk::manage(new Gtk::SpinButton(*fadjust, 1.0, 0));
spin->show();
hbox->pack_start(*spin, false, false);
Builds a hbox with a label and a check button in it.
*/
Gtk::Widget *
-ParamBool::get_widget (SPDocument * doc, Inkscape::XML::Node * node)
+ParamBool::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal)
{
Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4));
Builds a hbox with a label and a text box in it.
*/
Gtk::Widget *
-ParamString::get_widget (SPDocument * doc, Inkscape::XML::Node * node)
+ParamString::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal)
{
Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4));
/** \brief Create a label for the description */
Gtk::Widget *
-ParamDescription::get_widget (SPDocument * doc, Inkscape::XML::Node * node)
+ParamDescription::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal)
{
Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_value)));
label->set_line_wrap();
}
Gtk::Widget *
-ParamEnum::get_widget (SPDocument * doc, Inkscape::XML::Node * node)
+ParamEnum::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal)
{
return NULL;
}
index e1e27302c4e021ada5b1a4271dde5a673cf50fbe..5ac1c9f5cb8fd810f533d1a2f09d6af392b089c2 100644 (file)
const gchar * name (void) {return _name;}
static Parameter * make (Inkscape::XML::Node * in_repr, Inkscape::Extension::Extension * in_ext);
- virtual Gtk::Widget * get_widget (SPDocument * doc, Inkscape::XML::Node * node);
+ virtual Gtk::Widget * get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal);
virtual Glib::ustring * string (void);
gchar const * get_tooltip (void) { return _desc; }
};
index e8bd1e902273b6c768a80d20d25b67d3b4010670..80a17b95b64c1e577ef3d884560f82477b4ed7f1 100644 (file)
ParamNotebookPage(const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml);
~ParamNotebookPage(void);
- Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node);
+ Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal);
Glib::ustring * paramString (void);
gchar * get_guitext (void) {return _text;};
@@ -187,7 +187,7 @@ ParamNotebookPage::makepage (Inkscape::XML::Node * in_repr, Inkscape::Extension:
Builds a notebook page (a vbox) and puts parameters on it.
*/
Gtk::Widget *
-ParamNotebookPage::get_widget (SPDocument * doc, Inkscape::XML::Node * node)
+ParamNotebookPage::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal)
{
if (!_tooltips) _tooltips = new Gtk::Tooltips();
// add parameters onto page (if any)
for (GSList * list = parameters; list != NULL; list = g_slist_next(list)) {
Parameter * param = reinterpret_cast<Parameter *>(list->data);
- Gtk::Widget * widg = param->get_widget(doc, node);
+ Gtk::Widget * widg = param->get_widget(doc, node, changeSignal);
gchar const * tip = param->get_tooltip();
vbox->pack_start(*widg, true, true, 2);
Builds a notebook and puts pages in it.
*/
Gtk::Widget *
-ParamNotebook::get_widget (SPDocument * doc, Inkscape::XML::Node * node)
+ParamNotebook::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal)
{
ParamNotebookWdg * nb = Gtk::manage(new ParamNotebookWdg(this, doc, node));
for (GSList * list = pages; list != NULL; list = g_slist_next(list)) {
i++;
ParamNotebookPage * page = reinterpret_cast<ParamNotebookPage *>(list->data);
- Gtk::Widget * widg = page->get_widget(doc, node);
+ Gtk::Widget * widg = page->get_widget(doc, node, changeSignal);
nb->append_page(*widg, _(page->get_guitext()));
if (!strcmp(_value, page->name())) {
pagenr = i; // this is the page to be displayed?
index f0ab15f5744ca9f9e6c4cff15f0485c5bdf7321d..d0603003eacae3c31f3b0d178660e4ae3e848d84 100644 (file)
public:
ParamNotebook(const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml);
~ParamNotebook(void);
- Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node);
+ Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal);
Glib::ustring * string (void);
const gchar * get (const SPDocument * doc, const Inkscape::XML::Node * node) { return _value; }
index 94270af84a1e9f7c1683afb1a47c487ed408af91..e88232932170776e74627e24dea91951eede7327 100644 (file)
\brief Creates a combobox widget for an enumeration parameter
*/
Gtk::Widget *
-ParamRadioButton::get_widget (SPDocument * doc, Inkscape::XML::Node * node)
+ParamRadioButton::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal)
{
Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4));
Gtk::VBox * vbox = Gtk::manage(new Gtk::VBox(false, 0));
index 8e1edf5b8f5f91d187d16b9f25c596cccbd9b5b5..6a5fd7d0de8804528f202a5727ff8d03dd19d9a6 100644 (file)
public:
ParamRadioButton(const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml);
~ParamRadioButton(void);
- Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node);
+ Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal);
Glib::ustring * string (void);
const gchar * get (const SPDocument * doc, const Inkscape::XML::Node * node) { return _value; }