summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3a6cb6f)
raw | patch | inline | side by side (parent: 3a6cb6f)
author | johanengelen <johanengelen@users.sourceforge.net> | |
Tue, 15 Jan 2008 14:29:14 +0000 (14:29 +0000) | ||
committer | johanengelen <johanengelen@users.sourceforge.net> | |
Tue, 15 Jan 2008 14:29:14 +0000 (14:29 +0000) |
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.
Sorry for the huge number of warnings showing when working with LPE. It is important to fix this asap.
15 files changed:
index 543d60fc043220c46947c7f3ad29c7dfe46d2b1d..bdbc4dd52e1142612ecde365ca8e2426ffecc2de 100644 (file)
Effect::Effect(LivePathEffectObject *lpeobject)
{
- vbox = NULL;
- tooltips = NULL;
lpeobj = lpeobject;
oncanvasedit_it = 0;
}
Effect::~Effect()
{
- if (tooltips) {
- delete tooltips;
- }
}
Glib::ustring
param_vector.push_back(param);
}
+/**
+* This *creates* a new widget, management of deletion should be done by the caller
+*/
Gtk::Widget *
-Effect::getWidget()
+Effect::newWidget(Gtk::Tooltips * tooltips)
{
- if (!vbox) {
- vbox = Gtk::manage( new Gtk::VBox() ); // use manage here, because after deletion of Effect object, others might still be pointing to this widget.
- //if (!tooltips)
- tooltips = new Gtk::Tooltips();
-
- vbox->set_border_width(5);
-
- std::vector<Parameter *>::iterator it = param_vector.begin();
- while (it != param_vector.end()) {
- Parameter * param = *it;
- Gtk::Widget * widg = param->param_getWidget();
- Glib::ustring * tip = param->param_getTooltip();
- if (widg) {
- vbox->pack_start(*widg, true, true, 2);
- if (tip != NULL) {
- tooltips->set_tip(*widg, *tip);
- }
- }
+ // use manage here, because after deletion of Effect object, others might still be pointing to this widget.
+ Gtk::VBox * vbox = Gtk::manage( new Gtk::VBox() );
- it++;
+ vbox->set_border_width(5);
+
+ std::vector<Parameter *>::iterator it = param_vector.begin();
+ while (it != param_vector.end()) {
+ Parameter * param = *it;
+ Gtk::Widget * widg = param->param_newWidget(tooltips);
+ Glib::ustring * tip = param->param_getTooltip();
+ if (widg) {
+ vbox->pack_start(*widg, true, true, 2);
+ if (tip != NULL) {
+ tooltips->set_tip(*widg, *tip);
+ }
}
+
+ it++;
}
return dynamic_cast<Gtk::Widget *>(vbox);
index 535cec0b6c12ea92830e723b3a7ae05b88de31bc..8354c218b1809d4ca4a4b2a9e3097131e795bae3 100644 (file)
virtual void doEffect (SPCurve * curve);
- virtual Gtk::Widget * getWidget();
+ virtual Gtk::Widget * newWidget(Gtk::Tooltips * tooltips);
virtual void resetDefaults(SPItem * item);
Inkscape::UI::Widget::Registry wr;
- Gtk::VBox * vbox;
- Gtk::Tooltips * tooltips;
LivePathEffectObject *lpeobj;
index 78ce179391264dc541eb6b59f80120dc369a24c6..14fd88423821c7aa406e33190b48efdd3a7ece72 100644 (file)
}
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());
index 13dc57b6c56510823003b7aaea16650e03dcd81c..38811812d6ebe48c382a319d49603a4baa8a9073 100644 (file)
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;
index 1c5384f57dda03e2ff6c363e6738840f43ca50af..f0f3b59f8fdeadc068e3caf56f9fc585e00a9046 100644 (file)
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());
index 893f0d7f1c88478e4833ad85f311f52c7a9d5200..ca08b2b3da0bf9569409279c2843a608804ae7ea 100644 (file)
}
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());
index e3d372706560af5e967239bf665145707c22d6c0..67384a6e62320f2af9b103620a5c639232d0cf6e 100644 (file)
namespace Gtk {
class Widget;
+ class Tooltips;
}
namespace Inkscape {
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 ¶m_tooltip; };
virtual void param_editOncanvas(SPItem * /*item*/, SPDesktop * /*dt*/) {};
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; };
index 1f0e6f3be181c658c9404ee42bc717bd52e1af8a..59655d62ed28cd9efa62139812450b0191598587 100644 (file)
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);
PathParam::~PathParam()
{
- if (_tooltips)
- delete _tooltips;
- // _widget is managed by GTK so do not delete!
-
g_free(defvalue);
}
}
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);
}
index 82e240310d7bf82dc4e70956cc6af53f13ba21d3..456a9ae0b1dd8ced3c8c40a3b4172b33d94e9850 100644 (file)
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;
PathParam(const PathParam&);
PathParam& operator=(const PathParam&);
- Gtk::Widget * _widget;
- Gtk::Tooltips * _tooltips;
-
void on_edit_button_click();
void on_paste_button_click();
index eea337c8599a46e6eb2a9f476776ab1b5b0713df..5284bc7975ea9244257de670ae2e1c2989456357 100644 (file)
}
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());
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);
}
index 688a50d4abe9d53d5e835498dae5f72328f1e3e0..7eb1a70c1e0f91953c8984fd12939fd530939c9a 100644 (file)
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;
index 959b21114a3713493fd1bb8680ae8d31eb6bb920..9ce4e41a935a3d4baf7b4ae4b29efc5ce8d3aba5 100644 (file)
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();
index 55171c973131140628c6548990856cca5f003203..1b7d4cf16d3f248ea14222640525a7e027423315 100644 (file)
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);
index b1dfda573861272d7e91e45cd4e368687b27e493..93e17c324c59feb2426384b1e26701f99120dcee 100644 (file)
{
if (effectwidget) {
effectcontrol_vbox.remove(*effectwidget);
+ delete effectwidget;
effectwidget = NULL;
}
{
if (effectwidget) {
effectcontrol_vbox.remove(*effectwidget);
+ delete effectwidget;
effectwidget = NULL;
}
explain_label.set_markup("<b>" + effect->getName() + "</b>");
- effectwidget = effect->getWidget();
+ effectwidget = effect->newWidget(&tooltips);
if (effectwidget) {
effectcontrol_vbox.pack_start(*effectwidget, true, true);
}
{
if (effectwidget) {
effectcontrol_vbox.remove(*effectwidget);
+ delete effectwidget;
effectwidget = NULL;
}
index 2ec1f9d1474a31d34926131e0fdb09466e91efbe..aed17434d8a58935aa9d101b985734150243b5b0 100644 (file)
#include <gtkmm/label.h>
#include <gtkmm/comboboxtext.h>
#include <gtkmm/frame.h>
+#include <gtkmm/tooltip.h>
#include "ui/widget/combo-enums.h"
#include "live_effects/effect.h"
Gtk::Frame effectcontrol_frame;
Gtk::HBox effectapplication_hbox;
Gtk::VBox effectcontrol_vbox;
+ Gtk::Tooltips tooltips;
SPDesktop * current_desktop;