diff options
| author | Jabiertxo Arraiza Cenoz <jtx@jtx-desktop.markerlab.es> | 2017-09-14 09:05:47 +0000 |
|---|---|---|
| committer | Jabiertxo Arraiza Cenoz <jtx@jtx-desktop.markerlab.es> | 2017-09-14 09:05:47 +0000 |
| commit | bf5a9dd8028a965e4f072ea45a802b4feb6f821a (patch) | |
| tree | ed5b50a7d7bedb45d38f603b1122854c321da19f /src/live_effects/parameter/originalitemarray.h | |
| parent | Fixes for bug #1716926. Consider backport (diff) | |
| download | inkscape-bf5a9dd8028a965e4f072ea45a802b4feb6f821a.tar.gz inkscape-bf5a9dd8028a965e4f072ea45a802b4feb6f821a.zip | |
Added new LPE parameter to store Items array, also bugfixing in patharray parameter
Diffstat (limited to 'src/live_effects/parameter/originalitemarray.h')
| -rw-r--r-- | src/live_effects/parameter/originalitemarray.h | 120 |
1 files changed, 120 insertions, 0 deletions
diff --git a/src/live_effects/parameter/originalitemarray.h b/src/live_effects/parameter/originalitemarray.h new file mode 100644 index 000000000..3b300bd25 --- /dev/null +++ b/src/live_effects/parameter/originalitemarray.h @@ -0,0 +1,120 @@ +#ifndef INKSCAPE_LIVEPATHEFFECT_PARAMETER_ORIGINALITEMARRAY_H +#define INKSCAPE_LIVEPATHEFFECT_PARAMETER_ORIGINALITEMARRAY_H + +/* + * Inkscape::LivePathEffectParameters + * + * Copyright (C) Theodore Janeczko 2012 <flutterguy317@gmail.com> + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include <vector> + +#include <gtkmm/box.h> +#include <gtkmm/treeview.h> +#include <gtkmm/treestore.h> +#include <gtkmm/scrolledwindow.h> + +#include "live_effects/parameter/parameter.h" +#include "live_effects/parameter/item-reference.h" + +#include "svg/svg.h" +#include "svg/stringstream.h" +#include "item-reference.h" +#include "sp-object.h" + +namespace Inkscape { + +namespace LivePathEffect { + +class ItemAndActive { +public: + ItemAndActive(SPObject *owner) + : href(NULL), + ref(owner), + actived(true) + { + + } + gchar *href; + URIReference ref; + bool actived; + + sigc::connection linked_changed_connection; + sigc::connection linked_delete_connection; + sigc::connection linked_modified_connection; + sigc::connection linked_transformed_connection; +}; + +class OriginalItemArrayParam : public Parameter { +public: + class ModelColumns; + + OriginalItemArrayParam( const Glib::ustring& label, + const Glib::ustring& tip, + const Glib::ustring& key, + Inkscape::UI::Widget::Registry* wr, + Effect* effect); + + virtual ~OriginalItemArrayParam(); + + virtual Gtk::Widget * param_newWidget(); + virtual bool param_readSVGValue(const gchar * strvalue); + virtual gchar * param_getSVGValue() const; + virtual void param_set_default(); + virtual void param_update_default(const gchar * default_value){}; + /** Disable the canvas indicators of parent class by overriding this method */ + virtual void param_editOncanvas(SPItem * /*item*/, SPDesktop * /*dt*/) {}; + /** Disable the canvas indicators of parent class by overriding this method */ + virtual void addCanvasIndicators(SPLPEItem const* /*lpeitem*/, std::vector<Geom::PathVector> & /*hp_vec*/) {}; + + std::vector<ItemAndActive*> _vector; + +protected: + bool _updateLink(const Gtk::TreeIter& iter, ItemAndActive* pd); + bool _selectIndex(const Gtk::TreeIter& iter, int* i); + void unlink(ItemAndActive* to); + void remove_link(ItemAndActive* to); + void setItem(SPObject *linked_obj, guint flags, ItemAndActive* to); + + void linked_changed(SPObject *old_obj, SPObject *new_obj, ItemAndActive* to); + void linked_modified(SPObject *linked_obj, guint flags, ItemAndActive* to); + void linked_transformed(Geom::Affine const *, SPItem *, ItemAndActive*) {} + void linked_delete(SPObject *deleted, ItemAndActive* to); + + ModelColumns *_model; + Glib::RefPtr<Gtk::TreeStore> _store; + Gtk::TreeView _tree; + Gtk::CellRendererText *_text_renderer; + Gtk::CellRendererToggle *_toggle_renderer; + Gtk::TreeView::Column *_name_column; + Gtk::ScrolledWindow _scroller; + + void on_link_button_click(); + void on_remove_button_click(); + void on_up_button_click(); + void on_down_button_click(); + void on_active_toggled(const Glib::ustring& actived); + +private: + OriginalItemArrayParam(const OriginalItemArrayParam&); + OriginalItemArrayParam& operator=(const OriginalItemArrayParam&); +}; + +} //namespace LivePathEffect + +} //namespace Inkscape + +#endif + +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : |
