diff options
| author | schwieni <mschwienbacher@gmail.com> | 2019-03-24 09:14:33 +0000 |
|---|---|---|
| committer | Markus Schwienbacher <mschwienbacher@gmail.com> | 2019-03-25 17:15:50 +0000 |
| commit | 2d2c778340997b1d4370bb583e40a0e8dbebfc57 (patch) | |
| tree | 40727666a7aced4425ebd557a659a8f31041846c /src/live_effects/parameter/parameter.h | |
| parent | lpe-pts2ellipse: added perspective circle from 4 points (diff) | |
| download | inkscape-2d2c778340997b1d4370bb583e40a0e8dbebfc57.tar.gz inkscape-2d2c778340997b1d4370bb583e40a0e8dbebfc57.zip | |
lpe-pts2ellipse: added perspective circle from 4 points
improved tool-tips for better usability
Diffstat (limited to 'src/live_effects/parameter/parameter.h')
| -rw-r--r-- | src/live_effects/parameter/parameter.h | 102 |
1 files changed, 48 insertions, 54 deletions
diff --git a/src/live_effects/parameter/parameter.h b/src/live_effects/parameter/parameter.h index 62684b730..b3cbc039e 100644 --- a/src/live_effects/parameter/parameter.h +++ b/src/live_effects/parameter/parameter.h @@ -10,17 +10,18 @@ * Released under GNU GPL v2+, read the file 'COPYING' for more information. */ -#include <glibmm/ustring.h> +#include "ui/widget/registered-widget.h" #include <2geom/forward.h> #include <2geom/pathvector.h> -#include "ui/widget/registered-widget.h" +#include <glibmm/ustring.h> // In gtk2, this wasn't an issue; we could toss around // G_MAXDOUBLE and not worry about size allocations. But // in gtk3, it is an issue: it allocates widget size for the maxmium // value you pass to it, leading to some insane lengths. // If you need this to be more, please be conservative about it. -const double SCALARPARAM_G_MAXDOUBLE = 10000000000.0; // TODO fixme: using an arbitrary large number as a magic value seems fragile. +const double SCALARPARAM_G_MAXDOUBLE = + 10000000000.0; // TODO fixme: using an arbitrary large number as a magic value seems fragile. class KnotHolder; class SPLPEItem; @@ -28,97 +29,90 @@ class SPDesktop; class SPItem; namespace Gtk { - class Widget; +class Widget; } namespace Inkscape { namespace NodePath { - class Path ; +class Path; } namespace UI { namespace Widget { - class Registry; -} +class Registry; } +} // namespace UI namespace LivePathEffect { class Effect; class Parameter { -public: - Parameter( Glib::ustring label, - Glib::ustring tip, - Glib::ustring key, - Inkscape::UI::Widget::Registry* wr, - Effect* effect); - virtual ~Parameter() = default;; - - Parameter(const Parameter&) = delete; - Parameter& operator=(const Parameter&) = delete; - - virtual bool param_readSVGValue(const gchar * strvalue) = 0; // returns true if new value is valid / accepted. - virtual gchar * param_getSVGValue() const = 0; - virtual gchar * param_getDefaultSVGValue() const = 0; - virtual void param_widget_is_visible(bool is_visible) {widget_is_visible = is_visible;} - virtual void param_widget_is_enabled(bool is_enabled) {widget_is_enabled = is_enabled;} + public: + Parameter(Glib::ustring label, Glib::ustring tip, Glib::ustring key, Inkscape::UI::Widget::Registry *wr, + Effect *effect); + virtual ~Parameter() = default; + ; + + Parameter(const Parameter &) = delete; + Parameter &operator=(const Parameter &) = delete; + + virtual bool param_readSVGValue(const gchar *strvalue) = 0; // returns true if new value is valid / accepted. + virtual gchar *param_getSVGValue() const = 0; + virtual gchar *param_getDefaultSVGValue() const = 0; + virtual void param_widget_is_visible(bool is_visible) { widget_is_visible = is_visible; } + virtual void param_widget_is_enabled(bool is_enabled) { widget_is_enabled = is_enabled; } void write_to_SVG(); - + virtual void param_set_default() = 0; - virtual void param_update_default(const gchar * default_value) = 0; + virtual void param_update_default(const gchar *default_value) = 0; // This creates a new widget (newed with Gtk::manage(new ...);) - virtual Gtk::Widget * param_newWidget() = 0; + virtual Gtk::Widget *param_newWidget() = 0; - virtual Glib::ustring * param_getTooltip() { return ¶m_tooltip; }; + virtual Glib::ustring *param_getTooltip() { return ¶m_tooltip; }; // overload these for your particular parameter to make it provide knotholder handles or canvas helperpaths virtual bool providesKnotHolderEntities() const { return false; } - virtual void addKnotHolderEntities(KnotHolder */*knotholder*/, SPItem */*item*/) {}; - virtual void addCanvasIndicators(SPLPEItem const*/*lpeitem*/, std::vector<Geom::PathVector> &/*hp_vec*/) {}; + virtual void addKnotHolderEntities(KnotHolder * /*knotholder*/, SPItem * /*item*/){}; + virtual void addCanvasIndicators(SPLPEItem const * /*lpeitem*/, std::vector<Geom::PathVector> & /*hp_vec*/){}; - virtual void param_editOncanvas(SPItem * /*item*/, SPDesktop * /*dt*/) {}; - virtual void param_setup_nodepath(Inkscape::NodePath::Path */*np*/) {}; + virtual void param_editOncanvas(SPItem * /*item*/, SPDesktop * /*dt*/){}; + virtual void param_setup_nodepath(Inkscape::NodePath::Path * /*np*/){}; - virtual void param_transform_multiply(Geom::Affine const& /*postmul*/, bool /*set*/) {}; + virtual void param_transform_multiply(Geom::Affine const & /*postmul*/, bool /*set*/){}; Glib::ustring param_key; Glib::ustring param_tooltip; - Inkscape::UI::Widget::Registry * param_wr; + Inkscape::UI::Widget::Registry *param_wr; Glib::ustring param_label; bool oncanvas_editable; bool widget_is_visible; bool widget_is_enabled; -protected: - - Effect* param_effect; + protected: + Effect *param_effect; - void param_write_to_repr(const char * svgd); + void param_write_to_repr(const char *svgd); }; class ScalarParam : public Parameter { -public: - ScalarParam( const Glib::ustring& label, - const Glib::ustring& tip, - const Glib::ustring& key, - Inkscape::UI::Widget::Registry* wr, - Effect* effect, - gdouble default_value = 1.0); + public: + ScalarParam(const Glib::ustring &label, const Glib::ustring &tip, const Glib::ustring &key, + Inkscape::UI::Widget::Registry *wr, Effect *effect, gdouble default_value = 1.0); ~ScalarParam() override; - ScalarParam(const ScalarParam&) = delete; - ScalarParam& operator=(const ScalarParam&) = delete; + ScalarParam(const ScalarParam &) = delete; + ScalarParam &operator=(const ScalarParam &) = delete; - bool param_readSVGValue(const gchar * strvalue) override; - gchar * param_getSVGValue() const override; - gchar * param_getDefaultSVGValue() const override; + bool param_readSVGValue(const gchar *strvalue) override; + gchar *param_getSVGValue() const override; + gchar *param_getDefaultSVGValue() const override; void param_set_default() override; void param_update_default(gdouble default_value); - void param_update_default(const gchar * default_value) override; + void param_update_default(const gchar *default_value) override; void param_set_value(gdouble val); void param_make_integer(bool yes = true); void param_set_range(gdouble min, gdouble max); @@ -128,11 +122,11 @@ public: double param_get_max() { return max; }; double param_get_min() { return min; }; void param_set_undo(bool set_undo); - Gtk::Widget * param_newWidget() override; + Gtk::Widget *param_newWidget() override; inline operator gdouble() const { return value; }; -protected: + protected: gdouble value; gdouble min; gdouble max; @@ -145,9 +139,9 @@ protected: bool _set_undo; }; -} //namespace LivePathEffect +} // namespace LivePathEffect -} //namespace Inkscape +} // namespace Inkscape #endif |
