summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: fc78b2d)
raw | patch | inline | side by side (parent: fc78b2d)
author | johanengelen <johanengelen@users.sourceforge.net> | |
Sat, 26 Jan 2008 16:44:00 +0000 (16:44 +0000) | ||
committer | johanengelen <johanengelen@users.sourceforge.net> | |
Sat, 26 Jan 2008 16:44:00 +0000 (16:44 +0000) |
index 67b174b3a9753c1bb919a4d349757d107f7efd38..c9ae68bd127498c5fdbd1a8dab779a5b31025f41 100644 (file)
\r
#include <2geom/matrix.h>\r
#include <libnr/nr-matrix.h>\r
+#include <2geom/d2.h>\r
+#include <libnr/nr-rect.h>\r
\r
inline Geom::Matrix to_2geom(NR::Matrix const & mat) {\r
Geom::Matrix mat2geom(mat[0], mat[1], mat[2], mat[3], mat[4], mat[5]);\r
return mat2geom;\r
}\r
\r
+inline NR::Rect from_2geom(Geom::Rect const & rect2geom) {\r
+ NR::Rect rect(rect2geom.min(), rect2geom.max());\r
+ return rect;\r
+}\r
+\r
#endif\r
\r
/*\r
index df904b8a12e2582d6870310938aee6463afd228e..7d7679496ba489b39174095ca3656cfa535ad7af 100644 (file)
static_cast<Gtk::HBox*>(_widget)->pack_start(*pButton, true, true);
tooltips->set_tip(*pButton, _("Edit on-canvas"));
+ pIcon = Gtk::manage( sp_icon_get_icon( GTK_STOCK_COPY, 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_copy_button_click));
+ static_cast<Gtk::HBox*>(_widget)->pack_start(*pButton, true, true);
+ tooltips->set_tip(*pButton, _("Copy path"));
+
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);
}
}
+void
+PathParam::on_copy_button_click()
+{
+ sp_selection_copy_lpe_pathparam(this);
+}
} /* namespace LivePathEffect */
index d6ea8d1cd2a6ce50c6a280685c3250f8968d1c0c..f02974bc7b9793de318ec7c910cef4e8a12ad4c1 100644 (file)
void on_edit_button_click();
void on_paste_button_click();
+ void on_copy_button_click();
gchar * defvalue;
};
index 381f45e0ddb736ad5053d1fbbb76c8cd73c504c3..caf32ce3e7a01968060bb461f081c0027b93ea89 100644 (file)
# include "config.h"
#endif
+#include "selection-chemistry.h"
+
#include <gtkmm/clipboard.h>
#include "svg/svg.h"
#include "gradient-drag.h"
#include "uri-references.h"
#include "live_effects/lpeobject.h"
+#include "live_effects/parameter/path.h"
+#include "libnr/nr-convert2geom.h"
using NR::X;
using NR::Y;
-#include "selection-chemistry.h"
-
/* fixme: find a better place */
Inkscape::XML::Document *clipboard_document = NULL;
GSList *clipboard = NULL;
g_slist_free ((GSList *) items);
}
+
+void sp_selection_copy_lpe_pathparam(Inkscape::LivePathEffect::PathParam * pathparam)
+{
+ if (pathparam == NULL)
+ return;
+
+ SPDesktop *desktop = SP_ACTIVE_DESKTOP;
+ if (desktop == NULL)
+ return;
+
+ if (!clipboard_document) {
+ clipboard_document = new Inkscape::XML::SimpleDocument();
+ }
+
+ // clear old defs clipboard
+ while (defs_clipboard) {
+ Inkscape::GC::release((Inkscape::XML::Node *) defs_clipboard->data);
+ defs_clipboard = g_slist_remove (defs_clipboard, defs_clipboard->data);
+ }
+
+ // clear style clipboard
+ if (style_clipboard) {
+ sp_repr_css_attr_unref (style_clipboard);
+ style_clipboard = NULL;
+ }
+
+ //clear main clipboard
+ while (clipboard) {
+ Inkscape::GC::release((Inkscape::XML::Node *) clipboard->data);
+ clipboard = g_slist_remove(clipboard, clipboard->data);
+ }
+
+ // make new path node and put svgd as 'd' attribute
+ Inkscape::XML::Node *newnode = clipboard_document->createElement("svg:path");
+ gchar * svgd = pathparam->param_writeSVGValue();
+ newnode->setAttribute("d", svgd);
+ g_free(svgd);
+
+ clipboard = g_slist_prepend(clipboard, newnode);
+
+ Geom::Rect bnds = Geom::bounds_exact(*pathparam);
+ size_clipboard = from_2geom(bnds);
+}
+
+
//____________________________________________________________________________
/** Paste the bitmap in the clipboard if one is in there.
index 0dc1da7e7ff7b1311d6a7d085b3c4959d6095e27..501dcc520ed8ee52b7f3ad96a538ebd0f2f49e63 100644 (file)
namespace Inkscape { class Selection; }
+namespace Inkscape {
+namespace LivePathEffect {
+ class PathParam;
+}
+}
+
class SPCSSAttr;
void sp_selection_delete();
void sp_selection_cut();
void sp_selection_copy();
+void sp_selection_copy_lpe_pathparam(Inkscape::LivePathEffect::PathParam * pathparam);
void sp_selection_paste(bool in_place);
void sp_selection_paste_style();
void sp_selection_paste_livepatheffect();