livepatheffect-editor.cpp revision b4998608f5fbde14c744b6ab8020664300e11f80
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm * \brief LivePathEffect dialog
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm * Authors:
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm * Johan Engelen <j.b.c.engelen@utwente.nl>
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm * Copyright (C) 2007 Author
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm * Released under GNU GPL. Read the file 'COPYING' for more information.
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrmnamespace UI {
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm/*####################
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm * Callback functions
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrmstatic void lpeeditor_selection_changed (Inkscape::Selection * selection, gpointer data)
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm LivePathEffectEditor *lpeeditor = static_cast<LivePathEffectEditor *>(data);
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm/*#######################
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm * LivePathEffectEditor
963f23115db07f460bdd862b957f8bd9dba88b9bgustav_b : UI::Widget::Panel("", "dialogs.livepatheffect", SP_VERB_DIALOG_LIVE_PATH_EFFECT),
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm combo_effecttype(Inkscape::LivePathEffect::LPETypeConverter),
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm button_apply(_("_Apply"), _("Apply chosen effect to selection")),
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm button_remove(_("_Remove"), _("Remove effect from selection")),
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm effectapplication_hbox.pack_start(combo_effecttype, true, true);
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm effectapplication_hbox.pack_start(button_apply, true, true);
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm effectcontrol_vbox.pack_start(explain_label, true, true);
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm effectcontrol_vbox.pack_end(button_remove, true, true);
b4998608f5fbde14c744b6ab8020664300e11f80jucablues contents->pack_start(effectapplication_frame, false, false);
b4998608f5fbde14c744b6ab8020664300e11f80jucablues contents->pack_start(effectcontrol_frame, false, false);
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm // connect callback functions to buttons
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm button_apply.signal_clicked().connect(sigc::mem_fun(*this, &LivePathEffectEditor::onApply));
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm button_remove.signal_clicked().connect(sigc::mem_fun(*this, &LivePathEffectEditor::onRemove));
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrmLivePathEffectEditor::showParams(LivePathEffect::Effect* effect)
c5526a2c3001be486990d816757dd5ac028b3c3fjohanengelen explain_label.set_markup("<b>" + effect->getName() + "</b>");
c5526a2c3001be486990d816757dd5ac028b3c3fjohanengelen effectcontrol_vbox.pack_start(*effectwidget, true, true);
c5526a2c3001be486990d816757dd5ac028b3c3fjohanengelen // fixme: add resizing of dialog
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrmLivePathEffectEditor::showText(Glib::ustring const &str)
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm // fixme: do resizing of dialog ?
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrmLivePathEffectEditor::onSelectionChanged(Inkscape::Selection *sel)
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm LivePathEffectObject *lpeobj = sp_shape_get_livepatheffectobject(shape);
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm Inkscape::Selection *selection = sp_desktop_selection(desktop);
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm selection_changed_connection = selection->connectChanged(
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm sigc::bind (sigc::ptr_fun(&lpeeditor_selection_changed), this ) );
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm/*########################################################################
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm# BUTTON CLICK HANDLERS (callbacks)
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm########################################################################*/
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm// TODO: factor out the effect applying code which can be called from anywhere. (selection-chemistry.cpp also needs it)
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm const Util::EnumData<LivePathEffect::EffectType>* data = combo_effecttype.get_active_data();
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm if (!data) return;
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc);
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm Inkscape::XML::Node *repr = xml_doc->createElement("inkscape:path-effect");
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm SP_OBJECT_REPR(SP_DOCUMENT_DEFS(doc))->addChild(repr, NULL); // adds to <defs> and assigns the 'id' attribute
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm // make sure there is an original-d for paths!!!
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm pathrepr->setAttribute("inkscape:original-d", pathrepr->attribute("d"));
42e99769805c14a5cc01c805faa3c3b03f9dd1c0johanengelen LivePathEffectObject *lpeobj = sp_shape_get_livepatheffectobject(SP_SHAPE(item));
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm _("Create and apply path effect"));
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm sp_document_done ( sp_desktop_document (current_desktop), SP_VERB_DIALOG_LIVE_PATH_EFFECT,
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm _("Remove path effect") );
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm} // namespace Dialog
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm} // namespace UI
fd4b29a5cdef220804dfed85fec8acb5daceec5fpjrm} // namespace Inkscape