summaryrefslogtreecommitdiffstats
path: root/src/live_effects/parameter
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2008-01-15 14:29:14 +0000
committerjohanengelen <johanengelen@users.sourceforge.net>2008-01-15 14:29:14 +0000
commit63273692c4e638b46a9e84026f62721784ec2cb4 (patch)
treedbeabf7fddd50b809fee9384643a636c0a36438b /src/live_effects/parameter
parentM AUTHORS (diff)
downloadinkscape-63273692c4e638b46a9e84026f62721784ec2cb4.tar.gz
inkscape-63273692c4e638b46a9e84026f62721784ec2cb4.zip
prepare LPE parameter widgets to be owned by multiple dialogs, as it should be.
For each parameter function that has not been re-implemented, a warning is issued. Sorry for the huge number of warnings showing when working with LPE. It is important to fix this asap. (bzr r4495)
Diffstat (limited to 'src/live_effects/parameter')
-rw-r--r--src/live_effects/parameter/bool.cpp4
-rw-r--r--src/live_effects/parameter/bool.h2
-rw-r--r--src/live_effects/parameter/enum.h4
-rw-r--r--src/live_effects/parameter/parameter.cpp4
-rw-r--r--src/live_effects/parameter/parameter.h9
-rw-r--r--src/live_effects/parameter/path.cpp67
-rw-r--r--src/live_effects/parameter/path.h5
-rw-r--r--src/live_effects/parameter/point.cpp7
-rw-r--r--src/live_effects/parameter/point.h2
-rw-r--r--src/live_effects/parameter/random.cpp4
-rw-r--r--src/live_effects/parameter/random.h2
11 files changed, 54 insertions, 56 deletions
diff --git a/src/live_effects/parameter/bool.cpp b/src/live_effects/parameter/bool.cpp
index 78ce17939..14fd88423 100644
--- a/src/live_effects/parameter/bool.cpp
+++ b/src/live_effects/parameter/bool.cpp
@@ -58,8 +58,10 @@ BoolParam::param_writeSVGValue() const
}
Gtk::Widget *
-BoolParam::param_getWidget()
+BoolParam::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("BoolParam::param_newWidget still needs recoding to work with multiple document views");
if (!checkwdg) {
checkwdg = new Inkscape::UI::Widget::RegisteredCheckButton();
checkwdg->init(param_label, param_tooltip, param_key, *param_wr, false, param_effect->getRepr(), param_effect->getSPDoc());
diff --git a/src/live_effects/parameter/bool.h b/src/live_effects/parameter/bool.h
index 13dc57b6c..38811812d 100644
--- a/src/live_effects/parameter/bool.h
+++ b/src/live_effects/parameter/bool.h
@@ -31,7 +31,7 @@ public:
bool default_value = false);
virtual ~BoolParam();
- virtual Gtk::Widget * param_getWidget();
+ virtual Gtk::Widget * param_newWidget(Gtk::Tooltips * tooltips);
virtual bool param_readSVGValue(const gchar * strvalue);
virtual gchar * param_writeSVGValue() const;
diff --git a/src/live_effects/parameter/enum.h b/src/live_effects/parameter/enum.h
index 1c5384f57..f0f3b59f8 100644
--- a/src/live_effects/parameter/enum.h
+++ b/src/live_effects/parameter/enum.h
@@ -43,7 +43,9 @@ public:
delete regenum;
};
- Gtk::Widget * param_getWidget() {
+ 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());
diff --git a/src/live_effects/parameter/parameter.cpp b/src/live_effects/parameter/parameter.cpp
index 893f0d7f1..ca08b2b3d 100644
--- a/src/live_effects/parameter/parameter.cpp
+++ b/src/live_effects/parameter/parameter.cpp
@@ -136,8 +136,10 @@ ScalarParam::param_make_integer(bool yes)
}
Gtk::Widget *
-ScalarParam::param_getWidget()
+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());
diff --git a/src/live_effects/parameter/parameter.h b/src/live_effects/parameter/parameter.h
index e3d372706..67384a6e6 100644
--- a/src/live_effects/parameter/parameter.h
+++ b/src/live_effects/parameter/parameter.h
@@ -21,6 +21,7 @@ struct SPItem;
namespace Gtk {
class Widget;
+ class Tooltips;
}
namespace Inkscape {
@@ -47,9 +48,9 @@ public:
virtual void param_set_default() = 0;
- // This returns pointer to the parameter's widget to be put in the live-effects dialog. Must also create the
- // necessary widget if it does not exist yet.
- virtual Gtk::Widget * param_getWidget() = 0;
+ // This creates a new widget (newed with Gtk::manage(new ...);)
+ virtual Gtk::Widget * param_newWidget(Gtk::Tooltips * tooltips) = 0;
+
virtual Glib::ustring * param_getTooltip() { return &param_tooltip; };
virtual void param_editOncanvas(SPItem * /*item*/, SPDesktop * /*dt*/) {};
@@ -96,7 +97,7 @@ public:
void param_set_digits(unsigned digits);
void param_set_increments(double step, double page);
- virtual Gtk::Widget * param_getWidget();
+ virtual Gtk::Widget * param_newWidget(Gtk::Tooltips * tooltips);
inline operator gdouble()
{ return value; };
diff --git a/src/live_effects/parameter/path.cpp b/src/live_effects/parameter/path.cpp
index 1f0e6f3be..59655d62e 100644
--- a/src/live_effects/parameter/path.cpp
+++ b/src/live_effects/parameter/path.cpp
@@ -42,8 +42,6 @@ PathParam::PathParam( const Glib::ustring& label, const Glib::ustring& tip,
Effect* effect, const gchar * default_value)
: Parameter(label, tip, key, wr, effect)
{
- _widget = NULL;
- _tooltips = NULL;
edit_button = NULL;
defvalue = g_strdup(default_value);
param_readSVGValue(defvalue);
@@ -52,10 +50,6 @@ PathParam::PathParam( const Glib::ustring& label, const Glib::ustring& tip,
PathParam::~PathParam()
{
- if (_tooltips)
- delete _tooltips;
- // _widget is managed by GTK so do not delete!
-
g_free(defvalue);
}
@@ -92,40 +86,37 @@ PathParam::param_writeSVGValue() const
}
Gtk::Widget *
-PathParam::param_getWidget()
+PathParam::param_newWidget(Gtk::Tooltips * tooltips)
{
- if (!_widget) {
- _widget = Gtk::manage(new Gtk::HBox());
- _tooltips = new Gtk::Tooltips();
-
- Gtk::Label* pLabel = Gtk::manage(new Gtk::Label(param_label));
- static_cast<Gtk::HBox*>(_widget)->pack_start(*pLabel, true, true);
- _tooltips->set_tip(*pLabel, param_tooltip);
-
- Gtk::Widget* pIcon = Gtk::manage( sp_icon_get_icon( "draw_node", Inkscape::ICON_SIZE_BUTTON) );
- Gtk::Button * pButton = Gtk::manage(new Gtk::Button());
- pButton->set_relief(Gtk::RELIEF_NONE);
- pIcon->show();
- pButton->add(*pIcon);
- pButton->show();
- pButton->signal_clicked().connect(sigc::mem_fun(*this, &PathParam::on_edit_button_click));
- static_cast<Gtk::HBox*>(_widget)->pack_start(*pButton, true, true);
- _tooltips->set_tip(*pButton, _("Edit on-canvas"));
- edit_button = pButton;
-
- pIcon = Gtk::manage( sp_icon_get_icon( GTK_STOCK_PASTE, Inkscape::ICON_SIZE_BUTTON) );
- pButton = Gtk::manage(new Gtk::Button());
- pButton->set_relief(Gtk::RELIEF_NONE);
- pIcon->show();
- pButton->add(*pIcon);
- pButton->show();
- pButton->signal_clicked().connect(sigc::mem_fun(*this, &PathParam::on_paste_button_click));
- static_cast<Gtk::HBox*>(_widget)->pack_start(*pButton, true, true);
- _tooltips->set_tip(*pButton, _("Paste path"));
-
- static_cast<Gtk::HBox*>(_widget)->show_all_children();
+ Gtk::HBox * _widget = Gtk::manage(new Gtk::HBox());
+
+ Gtk::Label* pLabel = Gtk::manage(new Gtk::Label(param_label));
+ static_cast<Gtk::HBox*>(_widget)->pack_start(*pLabel, true, true);
+ tooltips->set_tip(*pLabel, param_tooltip);
+
+ Gtk::Widget* pIcon = Gtk::manage( sp_icon_get_icon( "draw_node", Inkscape::ICON_SIZE_BUTTON) );
+ Gtk::Button * pButton = Gtk::manage(new Gtk::Button());
+ pButton->set_relief(Gtk::RELIEF_NONE);
+ pIcon->show();
+ pButton->add(*pIcon);
+ pButton->show();
+ pButton->signal_clicked().connect(sigc::mem_fun(*this, &PathParam::on_edit_button_click));
+ static_cast<Gtk::HBox*>(_widget)->pack_start(*pButton, true, true);
+ tooltips->set_tip(*pButton, _("Edit on-canvas"));
+ edit_button = pButton;
+
+ pIcon = Gtk::manage( sp_icon_get_icon( GTK_STOCK_PASTE, Inkscape::ICON_SIZE_BUTTON) );
+ pButton = Gtk::manage(new Gtk::Button());
+ pButton->set_relief(Gtk::RELIEF_NONE);
+ pIcon->show();
+ pButton->add(*pIcon);
+ pButton->show();
+ pButton->signal_clicked().connect(sigc::mem_fun(*this, &PathParam::on_paste_button_click));
+ static_cast<Gtk::HBox*>(_widget)->pack_start(*pButton, true, true);
+ tooltips->set_tip(*pButton, _("Paste path"));
+
+ static_cast<Gtk::HBox*>(_widget)->show_all_children();
- }
return dynamic_cast<Gtk::Widget *> (_widget);
}
diff --git a/src/live_effects/parameter/path.h b/src/live_effects/parameter/path.h
index 82e240310..456a9ae0b 100644
--- a/src/live_effects/parameter/path.h
+++ b/src/live_effects/parameter/path.h
@@ -37,7 +37,7 @@ public:
const gchar * default_value = "M0,0 L1,1");
virtual ~PathParam();
- Gtk::Widget * param_getWidget();
+ virtual Gtk::Widget * param_newWidget(Gtk::Tooltips * tooltips);
bool param_readSVGValue(const gchar * strvalue);
gchar * param_writeSVGValue() const;
@@ -58,9 +58,6 @@ private:
PathParam(const PathParam&);
PathParam& operator=(const PathParam&);
- Gtk::Widget * _widget;
- Gtk::Tooltips * _tooltips;
-
void on_edit_button_click();
void on_paste_button_click();
diff --git a/src/live_effects/parameter/point.cpp b/src/live_effects/parameter/point.cpp
index eea337c85..5284bc797 100644
--- a/src/live_effects/parameter/point.cpp
+++ b/src/live_effects/parameter/point.cpp
@@ -80,8 +80,10 @@ PointParam::param_writeSVGValue() const
}
Gtk::Widget *
-PointParam::param_getWidget()
+PointParam::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("PointParam::param_newWidget still needs recoding to work with multiple document views");
if (!_widget) {
pointwdg = new Inkscape::UI::Widget::RegisteredPoint();
pointwdg->init(param_label, param_tooltip, param_key, *param_wr, param_effect->getRepr(), param_effect->getSPDoc());
@@ -104,8 +106,7 @@ PointParam::param_getWidget()
static_cast<Gtk::HBox*>(_widget)->pack_start(*(pointwdg->getPoint()), true, true);
static_cast<Gtk::HBox*>(_widget)->show_all_children();
- _tooltips = new Gtk::Tooltips();
- _tooltips->set_tip(*pButton, _("Edit on-canvas"));
+ tooltips->set_tip(*pButton, _("Edit on-canvas"));
}
return dynamic_cast<Gtk::Widget *> (_widget);
}
diff --git a/src/live_effects/parameter/point.h b/src/live_effects/parameter/point.h
index 688a50d4a..7eb1a70c1 100644
--- a/src/live_effects/parameter/point.h
+++ b/src/live_effects/parameter/point.h
@@ -35,7 +35,7 @@ public:
Geom::Point default_value = Geom::Point(0,0));
virtual ~PointParam();
- Gtk::Widget * param_getWidget();
+ virtual Gtk::Widget * param_newWidget(Gtk::Tooltips * tooltips);
bool param_readSVGValue(const gchar * strvalue);
gchar * param_writeSVGValue() const;
diff --git a/src/live_effects/parameter/random.cpp b/src/live_effects/parameter/random.cpp
index 959b21114..9ce4e41a9 100644
--- a/src/live_effects/parameter/random.cpp
+++ b/src/live_effects/parameter/random.cpp
@@ -130,8 +130,10 @@ RandomParam::resetRandomizer()
Gtk::Widget *
-RandomParam::param_getWidget()
+RandomParam::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("RandomParam::param_newWidget still needs recoding to work with multiple document views");
// TODO: add a button to set a different startseed
if (!regrandom) {
regrandom = new Inkscape::UI::Widget::RegisteredRandom();
diff --git a/src/live_effects/parameter/random.h b/src/live_effects/parameter/random.h
index 55171c973..1b7d4cf16 100644
--- a/src/live_effects/parameter/random.h
+++ b/src/live_effects/parameter/random.h
@@ -36,7 +36,7 @@ public:
virtual gchar * param_writeSVGValue() const;
virtual void param_set_default();
- virtual Gtk::Widget * param_getWidget();
+ virtual Gtk::Widget * param_newWidget(Gtk::Tooltips * tooltips);
void param_set_value(gdouble val, long newseed);
void param_make_integer(bool yes = true);