summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJabiertxof <jtx@jtx>2017-01-24 00:39:06 +0000
committerJabiertxof <jtx@jtx>2017-01-24 00:39:06 +0000
commitda07c5edaeefe35a92662e42579b3e0b36621cbb (patch)
treebd783169733a4b06927601fca59ec569dc5317b5 /src
parentUpdate to trunk (diff)
parentfix nodes reverting back during editing (diff)
downloadinkscape-da07c5edaeefe35a92662e42579b3e0b36621cbb.tar.gz
inkscape-da07c5edaeefe35a92662e42579b3e0b36621cbb.zip
Remove some code and make dependant of rotate copies
(bzr r15295.1.63)
Diffstat (limited to 'src')
-rw-r--r--src/extension/internal/cdr-input.cpp7
-rw-r--r--src/extension/internal/vsd-input.cpp7
-rw-r--r--src/extension/internal/wpg-input.cpp7
-rw-r--r--src/file.cpp6
-rw-r--r--src/helper/geom.cpp7
-rw-r--r--src/helper/geom.h2
-rw-r--r--src/live_effects/effect.h15
-rw-r--r--src/live_effects/lpe-copy_rotate.cpp1
-rw-r--r--src/live_effects/lpe-measure-line.cpp9
-rw-r--r--src/live_effects/lpe-measure-line.h6
-rw-r--r--src/live_effects/lpe-mirror_symmetry.cpp69
-rw-r--r--src/live_effects/lpe-patternalongpath.cpp14
-rw-r--r--src/live_effects/lpe-perspective-envelope.cpp2
-rw-r--r--src/live_effects/parameter/bool.cpp3
-rw-r--r--src/live_effects/parameter/text.cpp3
-rw-r--r--src/live_effects/parameter/vector.cpp2
-rw-r--r--src/main.cpp2
-rw-r--r--src/object-set.h2
-rw-r--r--src/selection-chemistry.cpp71
-rw-r--r--src/sp-item-group.cpp9
-rw-r--r--src/sp-item.cpp1
-rw-r--r--src/sp-lpe-item.cpp13
-rw-r--r--src/sp-lpe-item.h2
-rw-r--r--src/sp-object.cpp15
-rw-r--r--src/sp-object.h3
-rw-r--r--src/ui/clipboard.cpp40
-rw-r--r--src/ui/tool/transform-handle-set.cpp5
-rw-r--r--src/ui/widget/selected-style.cpp57
-rw-r--r--src/verbs.cpp5
-rw-r--r--src/verbs.h1
30 files changed, 202 insertions, 184 deletions
diff --git a/src/extension/internal/cdr-input.cpp b/src/extension/internal/cdr-input.cpp
index 92a11a6ac..0435f1396 100644
--- a/src/extension/internal/cdr-input.cpp
+++ b/src/extension/internal/cdr-input.cpp
@@ -214,6 +214,13 @@ void CdrImportDialog::_setPreviewPage()
SPDocument *CdrInput::open(Inkscape::Extension::Input * /*mod*/, const gchar * uri)
{
+ #ifdef WIN32
+ // RVNGFileStream uses fopen() internally which unfortunately only uses ANSI encoding on Windows
+ // therefore attempt to convert uri to the system codepage
+ // even if this is not possible the alternate short (8.3) file name will be used if available
+ uri = g_win32_locale_filename_from_utf8(uri);
+ #endif
+
RVNGFileStream input(uri);
if (!libcdr::CDRDocument::isSupported(&input)) {
diff --git a/src/extension/internal/vsd-input.cpp b/src/extension/internal/vsd-input.cpp
index 2fb4acf22..78783aa2d 100644
--- a/src/extension/internal/vsd-input.cpp
+++ b/src/extension/internal/vsd-input.cpp
@@ -216,6 +216,13 @@ void VsdImportDialog::_setPreviewPage()
SPDocument *VsdInput::open(Inkscape::Extension::Input * /*mod*/, const gchar * uri)
{
+ #ifdef WIN32
+ // RVNGFileStream uses fopen() internally which unfortunately only uses ANSI encoding on Windows
+ // therefore attempt to convert uri to the system codepage
+ // even if this is not possible the alternate short (8.3) file name will be used if available
+ uri = g_win32_locale_filename_from_utf8(uri);
+ #endif
+
RVNGFileStream input(uri);
if (!libvisio::VisioDocument::isSupported(&input)) {
diff --git a/src/extension/internal/wpg-input.cpp b/src/extension/internal/wpg-input.cpp
index 54a14fc72..12457791b 100644
--- a/src/extension/internal/wpg-input.cpp
+++ b/src/extension/internal/wpg-input.cpp
@@ -81,6 +81,13 @@ namespace Internal {
SPDocument *WpgInput::open(Inkscape::Extension::Input * /*mod*/, const gchar * uri)
{
+ #ifdef WIN32
+ // RVNGFileStream uses fopen() internally which unfortunately only uses ANSI encoding on Windows
+ // therefore attempt to convert uri to the system codepage
+ // even if this is not possible the alternate short (8.3) file name will be used if available
+ uri = g_win32_locale_filename_from_utf8(uri);
+ #endif
+
RVNGInputStream* input = new RVNGFileStream(uri);
#if WITH_LIBWPG03
if (input->isStructured()) {
diff --git a/src/file.cpp b/src/file.cpp
index 9e96361c3..e8248bb8e 100644
--- a/src/file.cpp
+++ b/src/file.cpp
@@ -1631,8 +1631,12 @@ void sp_import_document(SPDesktop *desktop, SPDocument *clipdoc, bool in_place)
for (Inkscape::XML::Node *obj = clipboard->firstChild() ; obj ; obj = obj->next()) {
if(target_document->getObjectById(obj->attribute("id"))) continue;
Inkscape::XML::Node *obj_copy = obj->duplicate(target_document->getReprDoc());
- target_parent->appendChild(obj_copy);
+ SPObject * pasted = desktop->currentLayer()->appendChildRepr(obj_copy);
Inkscape::GC::release(obj_copy);
+ SPLPEItem * pasted_lpe_item = dynamic_cast<SPLPEItem *>(pasted);
+ if (pasted_lpe_item){
+ pasted_lpe_item->forkPathEffectsIfNecessary(1);
+ }
pasted_objects_not.push_back(obj_copy);
}
Inkscape::Selection *selection = desktop->getSelection();
diff --git a/src/helper/geom.cpp b/src/helper/geom.cpp
index e1f05c3ce..42c494c00 100644
--- a/src/helper/geom.cpp
+++ b/src/helper/geom.cpp
@@ -843,13 +843,6 @@ recursive_bezier4(const double x1, const double y1,
recursive_bezier4(x1234, y1234, x234, y234, x34, y34, x4, y4, m_points, level + 1);
}
-void
-swap(Geom::Point &A, Geom::Point &B){
- Geom::Point tmp = A;
- A = B;
- B = tmp;
-}
-
/*
Local Variables:
mode:c++
diff --git a/src/helper/geom.h b/src/helper/geom.h
index b3d907e51..d49e2070c 100644
--- a/src/helper/geom.h
+++ b/src/helper/geom.h
@@ -32,7 +32,7 @@ void recursive_bezier4(const double x1, const double y1, const double x2, const
const double x3, const double y3, const double x4, const double y4,
std::vector<Geom::Point> &pointlist,
int level);
-void swap(Geom::Point &A, Geom::Point &B);
+
#endif // INKSCAPE_HELPER_GEOM_H
/*
diff --git a/src/live_effects/effect.h b/src/live_effects/effect.h
index 9a2d4c67d..1997ff0ca 100644
--- a/src/live_effects/effect.h
+++ b/src/live_effects/effect.h
@@ -19,7 +19,7 @@
class SPDocument;
class SPDesktop;
class SPItem;
-class LivePathEffectObject;
+class LivePathEffectObject;
class SPLPEItem;
class KnotHolder;
class KnotHolderEntity;
@@ -44,12 +44,6 @@ enum LPEPathFlashType {
DEFAULT
};
-enum LpeAction {
- LPE_ERASE = 0,
- LPE_TO_OBJECTS,
- LPE_VISIBILITY
-};
-
class Effect {
public:
static Effect* New(EffectType lpenr, LivePathEffectObject *lpeobj);
@@ -131,9 +125,7 @@ public:
bool apply_to_clippath_and_mask;
bool erase_extra_objects; // set this to false allow retain extra generated objects, see measure line LPE
bool upd_params;
- BoolParam is_visible;
- SPCurve * sp_curve;
- Geom::PathVector pathvector_before_effect;
+
protected:
Effect(LivePathEffectObject *lpeobject);
@@ -158,6 +150,7 @@ protected:
bool _provides_knotholder_entities;
int oncanvasedit_it;
+ BoolParam is_visible;
bool show_orig_path; // set this to true in derived effects to automatically have the original
// path displayed as helperpath
@@ -173,6 +166,8 @@ protected:
SPLPEItem * sp_lpe_item; // these get stored in doBeforeEffect_impl, and derived classes may do as they please with them.
double current_zoom;
std::vector<Geom::Point> selectedNodesPoints;
+ SPCurve * sp_curve;
+ Geom::PathVector pathvector_before_effect;
private:
bool provides_own_flash_paths; // if true, the standard flash path is suppressed
diff --git a/src/live_effects/lpe-copy_rotate.cpp b/src/live_effects/lpe-copy_rotate.cpp
index 250f6aa29..813f25d3d 100644
--- a/src/live_effects/lpe-copy_rotate.cpp
+++ b/src/live_effects/lpe-copy_rotate.cpp
@@ -125,6 +125,7 @@ void
LPECopyRotate::transform_multiply(Geom::Affine const& postmul, bool set)
{
// cycle through all parameters. Most parameters will not need transformation, but path and point params do.
+
for (std::vector<Parameter *>::iterator it = param_vector.begin(); it != param_vector.end(); ++it) {
Parameter * param = *it;
param->param_transform_multiply(postmul, set);
diff --git a/src/live_effects/lpe-measure-line.cpp b/src/live_effects/lpe-measure-line.cpp
index e07335e1c..af2a8e919 100644
--- a/src/live_effects/lpe-measure-line.cpp
+++ b/src/live_effects/lpe-measure-line.cpp
@@ -21,9 +21,7 @@
#include "svg/svg-color.h"
#include "svg/svg.h"
#include "display/curve.h"
-#include "helper/geom.h"
#include "2geom/affine.h"
-#include "path-chemistry.h"
#include "style.h"
#include "sp-root.h"
#include "sp-defs.h"
@@ -167,6 +165,12 @@ LPEMeasureLine::LPEMeasureLine(LivePathEffectObject *lpeobject) :
LPEMeasureLine::~LPEMeasureLine() {}
+void swap(Geom::Point &A, Geom::Point &B){
+ Geom::Point tmp = A;
+ A = B;
+ B = tmp;
+}
+
void
LPEMeasureLine::createArrowMarker(const char * mode)
{
@@ -664,7 +668,6 @@ LPEMeasureLine::doBeforeEffect (SPLPEItem const* lpeitem)
}
}
-//TODO: Migrate the tree next function to effect.cpp/h to avoid duplication
void
LPEMeasureLine::doOnVisibilityToggled(SPLPEItem const* /*lpeitem*/)
{
diff --git a/src/live_effects/lpe-measure-line.h b/src/live_effects/lpe-measure-line.h
index cb531affe..c69921a4d 100644
--- a/src/live_effects/lpe-measure-line.h
+++ b/src/live_effects/lpe-measure-line.h
@@ -35,6 +35,12 @@ enum OrientationMethod {
OM_END
};
+enum LpeAction {
+ LPE_ERASE = 0,
+ LPE_TO_OBJECTS,
+ LPE_VISIBILITY
+};
+
class LPEMeasureLine : public Effect {
public:
LPEMeasureLine(LivePathEffectObject *lpeobject);
diff --git a/src/live_effects/lpe-mirror_symmetry.cpp b/src/live_effects/lpe-mirror_symmetry.cpp
index 3e46422a0..e94ad496e 100644
--- a/src/live_effects/lpe-mirror_symmetry.cpp
+++ b/src/live_effects/lpe-mirror_symmetry.cpp
@@ -237,38 +237,42 @@ LPEMirrorSymmetry::toMirror(Geom::Affine transform)
phantom = elemref->getRepr();
} else {
phantom = sp_lpe_item->getRepr()->duplicate(xml_doc);
- phantom->setAttribute("inkscape:path-effect", NULL);
- phantom->setAttribute("inkscape:original-d", NULL);
- phantom->setAttribute("sodipodi:type", NULL);
- phantom->setAttribute("sodipodi:rx", NULL);
- phantom->setAttribute("sodipodi:ry", NULL);
- phantom->setAttribute("sodipodi:cx", NULL);
- phantom->setAttribute("sodipodi:cy", NULL);
- phantom->setAttribute("sodipodi:end", NULL);
- phantom->setAttribute("sodipodi:start", NULL);
- phantom->setAttribute("inkscape:flatsided", NULL);
- phantom->setAttribute("inkscape:randomized", NULL);
- phantom->setAttribute("inkscape:rounded", NULL);
- phantom->setAttribute("sodipodi:arg1", NULL);
- phantom->setAttribute("sodipodi:arg2", NULL);
- phantom->setAttribute("sodipodi:r1", NULL);
- phantom->setAttribute("sodipodi:r2", NULL);
- phantom->setAttribute("sodipodi:sides", NULL);
- phantom->setAttribute("inkscape:randomized", NULL);
- phantom->setAttribute("sodipodi:argument", NULL);
- phantom->setAttribute("sodipodi:expansion", NULL);
- phantom->setAttribute("sodipodi:radius", NULL);
- phantom->setAttribute("sodipodi:revolution", NULL);
- phantom->setAttribute("sodipodi:t0", NULL);
- phantom->setAttribute("inkscape:randomized", NULL);
- phantom->setAttribute("inkscape:randomized", NULL);
- phantom->setAttribute("inkscape:randomized", NULL);
- phantom->setAttribute("x", NULL);
- phantom->setAttribute("y", NULL);
- phantom->setAttribute("rx", NULL);
- phantom->setAttribute("ry", NULL);
- phantom->setAttribute("width", NULL);
- phantom->setAttribute("height", NULL);
+ std::vector<const char *> attrs;
+ attrs->push_back("inkscape:path-effect");
+ attrs->push_back("inkscape:original-d");
+ attrs->push_back("sodipodi:type");
+ attrs->push_back("sodipodi:rx");
+ attrs->push_back("sodipodi:ry");
+ attrs->push_back("sodipodi:cx");
+ attrs->push_back("sodipodi:cy");
+ attrs->push_back("sodipodi:end");
+ attrs->push_back("sodipodi:start");
+ attrs->push_back("inkscape:flatsided");
+ attrs->push_back("inkscape:randomized");
+ attrs->push_back("inkscape:rounded");
+ attrs->push_back("sodipodi:arg1");
+ attrs->push_back("sodipodi:arg2");
+ attrs->push_back("sodipodi:r1");
+ attrs->push_back("sodipodi:r2");
+ attrs->push_back("sodipodi:sides");
+ attrs->push_back("inkscape:randomized");
+ attrs->push_back("sodipodi:argument");
+ attrs->push_back("sodipodi:expansion");
+ attrs->push_back("sodipodi:radius");
+ attrs->push_back("sodipodi:revolution");
+ attrs->push_back("sodipodi:t0");
+ attrs->push_back("inkscape:randomized");
+ attrs->push_back("inkscape:randomized");
+ attrs->push_back("inkscape:randomized");
+ attrs->push_back("x");
+ attrs->push_back("y");
+ attrs->push_back("rx");
+ attrs->push_back("ry");
+ attrs->push_back("width");
+ attrs->push_back("height");
+ for(const char * attr : attrs) {
+ phantom->setAttribute(attr, NULL);
+ }
}
phantom->setAttribute("id", elemref_id);
if (!elemref) {
@@ -404,7 +408,6 @@ LPEMirrorSymmetry::transform_multiply(Geom::Affine const& postmul, bool set)
param->param_transform_multiply(postmul, set);
}
previous_center = Geom::middle_point((Geom::Point)start_point, (Geom::Point)end_point);
- sp_lpe_item_update_patheffect(sp_lpe_item, false, false);
}
void
diff --git a/src/live_effects/lpe-patternalongpath.cpp b/src/live_effects/lpe-patternalongpath.cpp
index c1853ef22..966e9020e 100644
--- a/src/live_effects/lpe-patternalongpath.cpp
+++ b/src/live_effects/lpe-patternalongpath.cpp
@@ -11,6 +11,7 @@
#include <2geom/bezier-to-sbasis.h>
#include "knotholder.h"
+#include <cmath>
#include <algorithm>
// TODO due to internal breakage in glibmm headers, this must be last:
#include <glibmm/i18n.h>
@@ -161,7 +162,7 @@ LPEPatternAlongPath::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > con
// spacing.param_set_range(-pattBndsX.extent()*.9, Geom::infinity());
// }
- y0+=noffset;
+ y0 += noffset;
std::vector<Geom::Piecewise<Geom::D2<Geom::SBasis> > > paths_in;
paths_in = split_at_discontinuities(pwd2_in);
@@ -197,7 +198,7 @@ LPEPatternAlongPath::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > con
case PAPCT_REPEATED_STRETCHED:
// if uskeleton is closed:
- if(path_i.segs.front().at0() == path_i.segs.back().at1()){
+ if (are_near(path_i.segs.front().at0(), path_i.segs.back().at1())){
nbCopies = std::max(1, static_cast<int>(std::floor((uskeleton.domain().extent() - toffset)/(pattBndsX->extent()+xspace))));
pattBndsX = Interval(pattBndsX->min(),pattBndsX->max()+xspace);
scaling = (uskeleton.domain().extent() - toffset)/(((double)nbCopies)*pattBndsX->extent());
@@ -213,11 +214,13 @@ LPEPatternAlongPath::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > con
return pwd2_in;
};
+ //Ceil to 6 decimals
+ scaling = ceil(scaling * 1000000) / 1000000;
double pattWidth = pattBndsX->extent() * scaling;
- x*=scaling;
+ x *= scaling;
if ( scale_y_rel.get_value() ) {
- y*=(scaling * prop_scale);
+ y *= prop_scale * scaling;
} else {
y *= prop_scale;
}
@@ -235,7 +238,7 @@ LPEPatternAlongPath::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > con
offs+=pattWidth;
}
}
- if (fuse_tolerance > 0){
+ if (fuse_tolerance > 0){
pre_output = fuse_nearby_ends(pre_output, fuse_tolerance);
for (unsigned i=0; i<pre_output.size(); i++){
output.concat(pre_output[i]);
@@ -264,7 +267,6 @@ LPEPatternAlongPath::transform_multiply(Geom::Affine const& postmul, bool set)
pattern.param_transform_multiply(postmul, set);
pattern.write_to_SVG();
}
- sp_lpe_item_update_patheffect (sp_lpe_item, false, true);
}
void
diff --git a/src/live_effects/lpe-perspective-envelope.cpp b/src/live_effects/lpe-perspective-envelope.cpp
index e0dac0687..18b5b724d 100644
--- a/src/live_effects/lpe-perspective-envelope.cpp
+++ b/src/live_effects/lpe-perspective-envelope.cpp
@@ -379,7 +379,7 @@ LPEPerspectiveEnvelope::newWidget()
hbox_down_handles->pack_start(*widg, true, true, 2);
}
if (tip) {
- widg->set_tooltip_text(*tip);
+ widg->set_tooltip_markup(*tip);
} else {
widg->set_tooltip_text("");
widg->set_has_tooltip(false);
diff --git a/src/live_effects/parameter/bool.cpp b/src/live_effects/parameter/bool.cpp
index 813c06b4e..af99ef362 100644
--- a/src/live_effects/parameter/bool.cpp
+++ b/src/live_effects/parameter/bool.cpp
@@ -72,7 +72,7 @@ BoolParam::param_newWidget()
checkwdg->setActive(value);
checkwdg->setProgrammatically = false;
checkwdg->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change bool parameter"));
- param_effect->upd_params = false;
+
return dynamic_cast<Gtk::Widget *> (checkwdg);
} else {
return NULL;
@@ -82,7 +82,6 @@ BoolParam::param_newWidget()
void
BoolParam::param_setValue(bool newvalue)
{
- param_effect->upd_params = true;
value = newvalue;
}
diff --git a/src/live_effects/parameter/text.cpp b/src/live_effects/parameter/text.cpp
index 5c4cdf4c6..8cab68ad0 100644
--- a/src/live_effects/parameter/text.cpp
+++ b/src/live_effects/parameter/text.cpp
@@ -125,14 +125,13 @@ TextParam::param_newWidget()
rsu->setProgrammatically = false;
rsu->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change text parameter"));
- param_effect->upd_params = false;
+
return dynamic_cast<Gtk::Widget *> (rsu);
}
void
TextParam::param_setValue(const Glib::ustring newvalue)
{
- param_effect->upd_params = true;
value = newvalue;
if (!_hide_canvas_text) {
sp_canvastext_set_text (canvas_text, newvalue.c_str());
diff --git a/src/live_effects/parameter/vector.cpp b/src/live_effects/parameter/vector.cpp
index aa16a2b98..55b4d4b32 100644
--- a/src/live_effects/parameter/vector.cpp
+++ b/src/live_effects/parameter/vector.cpp
@@ -116,7 +116,7 @@ VectorParam::set_and_write_new_values(Geom::Point const &new_origin, Geom::Point
void
VectorParam::param_transform_multiply(Geom::Affine const& postmul, bool /*set*/)
{
- set_and_write_new_values( origin * postmul, vector * postmul.withoutTranslation() );
+ set_and_write_new_values( origin * postmul, vector * postmul.withoutTranslation() );
}
diff --git a/src/main.cpp b/src/main.cpp
index fb627a020..605c1207e 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -420,7 +420,7 @@ struct poptOption options[] = {
{"export-pdf-version", 0,
POPT_ARG_STRING, &sp_export_pdf_version, SP_ARG_EXPORT_PDF_VERSION,
// TRANSLATORS: "--export-pdf-version" is an Inkscape command line option; see "inkscape --help"
- N_("Export PDF to given version. (hint: make sure to input the exact string found in the PDF export dialog, e.g. \"PDF 1.4\" which is PDF-a conformant)"),
+ N_("Export PDF to given version. (hint: make sure to input a version found in the PDF export dialog, e.g. \"1.4\" which is PDF-a conformant)"),
N_("PDF_VERSION")},
{"export-latex", 0,
diff --git a/src/object-set.h b/src/object-set.h
index a89a299bd..7c224f640 100644
--- a/src/object-set.h
+++ b/src/object-set.h
@@ -447,7 +447,7 @@ public:
// various
void getExportHints(Glib::ustring &filename, float *xdpi, float *ydpi);
bool fitCanvas(bool with_margins, bool skip_undo = false);
-
+ void swapFillStroke();
protected:
virtual void _connectSignals(SPObject* object) {};
diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp
index f8ab33ac4..67972cabb 100644
--- a/src/selection-chemistry.cpp
+++ b/src/selection-chemistry.cpp
@@ -97,6 +97,7 @@ SPCycleType SP_CYCLING = SP_CYCLE_FOCUS;
#include "live_effects/parameter/originalpath.h"
#include "layer-manager.h"
#include "object-set.h"
+#include "svg/svg-color.h"
// For clippath editing
#include "ui/tools/node-tool.h"
@@ -1242,7 +1243,6 @@ void ObjectSet::pasteStyle()
}
}
-
void ObjectSet::pastePathEffect()
{
Inkscape::UI::ClipboardManager *cm = Inkscape::UI::ClipboardManager::get();
@@ -4169,6 +4169,75 @@ bool ObjectSet::fitCanvas(bool with_margins, bool skip_undo)
}
}
+void ObjectSet::swapFillStroke()
+{
+ if (desktop() == NULL) {
+ return;
+ }
+
+ SPIPaint *paint;
+ SPPaintServer *server;
+ Glib::ustring _paintserver_id;
+
+ auto list= items();
+ for (auto itemlist=list.begin();itemlist!=list.end();++itemlist) {
+ SPItem *item = *itemlist;
+
+ SPCSSAttr *css = sp_repr_css_attr_new ();
+
+ _paintserver_id.clear();
+ paint = &(item->style->fill);
+ if (paint->set && paint->isNone())
+ sp_repr_css_set_property (css, "stroke", "none");
+ else if (paint->set && paint->isColor()) {
+ guint32 color = paint->value.color.toRGBA32(SP_SCALE24_TO_FLOAT (item->style->fill_opacity.value));
+ gchar c[64];
+ sp_svg_write_color (c, sizeof(c), color);
+ sp_repr_css_set_property (css, "stroke", c);
+ }
+ else if (!paint->set)
+ sp_repr_css_unset_property (css, "stroke");
+ else if (paint->set && paint->isPaintserver()) {
+ server = SP_STYLE_FILL_SERVER(item->style);
+ if (server) {
+ Inkscape::XML::Node *srepr = server->getRepr();
+ _paintserver_id += "url(#";
+ _paintserver_id += srepr->attribute("id");
+ _paintserver_id += ")";
+ sp_repr_css_set_property (css, "stroke", _paintserver_id.c_str());
+ }
+ }
+
+ _paintserver_id.clear();
+ paint = &(item->style->stroke);
+ if (paint->set && paint->isNone())
+ sp_repr_css_set_property (css, "fill", "none");
+ else if (paint->set && paint->isColor()) {
+ guint32 color = paint->value.color.toRGBA32(SP_SCALE24_TO_FLOAT (item->style->stroke_opacity.value));
+ gchar c[64];
+ sp_svg_write_color (c, sizeof(c), color);
+ sp_repr_css_set_property (css, "fill", c);
+ }
+ else if (!paint->set)
+ sp_repr_css_unset_property (css, "fill");
+ else if (paint->set && paint->isPaintserver()) {
+ server = SP_STYLE_STROKE_SERVER(item->style);
+ if (server) {
+ Inkscape::XML::Node *srepr = server->getRepr();
+ _paintserver_id += "url(#";
+ _paintserver_id += srepr->attribute("id");
+ _paintserver_id += ")";
+ sp_repr_css_set_property (css, "fill", _paintserver_id.c_str());
+ }
+ }
+
+ sp_desktop_apply_css_recursive(item, css, true);
+ sp_repr_css_attr_unref (css);
+ }
+
+ DocumentUndo::done(document(), SP_VERB_EDIT_SWAP_FILL_STROKE,
+ _("Swap fill and stroke of an object"));
+}
/**
* \param with_margins margins defined in the xml under <sodipodi:namedview>
diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp
index b9a8fb83f..7b2507b5e 100644
--- a/src/sp-item-group.cpp
+++ b/src/sp-item-group.cpp
@@ -925,15 +925,6 @@ void SPGroup::update_patheffect(bool write) {
}
sp_group_perform_patheffect(this, this, write);
-
- for (PathEffectList::iterator it = this->path_effect_list->begin(); it != this->path_effect_list->end(); ++it)
- {
- LivePathEffectObject *lpeobj = (*it)->lpeobject;
-
- if (lpeobj && lpeobj->get_lpe()) {
- lpeobj->get_lpe()->doAfterEffect(this);
- }
- }
}
}
diff --git a/src/sp-item.cpp b/src/sp-item.cpp
index 05af12229..5d02020c6 100644
--- a/src/sp-item.cpp
+++ b/src/sp-item.cpp
@@ -121,6 +121,7 @@ void SPItem::setLocked(bool locked) {
setAttribute("sodipodi:insensitive",
( locked ? "1" : NULL ));
updateRepr();
+ document->_emitModified();
}
bool SPItem::isHidden() const {
diff --git a/src/sp-lpe-item.cpp b/src/sp-lpe-item.cpp
index 7ad428383..e2f61bfb5 100644
--- a/src/sp-lpe-item.cpp
+++ b/src/sp-lpe-item.cpp
@@ -24,7 +24,6 @@
#include "live_effects/lpeobject.h"
#include "live_effects/lpeobject-reference.h"
#include "live_effects/lpe-measure-line.h"
-#include "live_effects/lpe-mirror_symmetry.h"
#include "sp-path.h"
#include "sp-item-group.h"
@@ -127,9 +126,7 @@ void SPLPEItem::set(unsigned int key, gchar const* value) {
if (!value) {
LivePathEffectObject *lpeobj = (*it)->lpeobject;
Inkscape::LivePathEffect::Effect * lpe = lpeobj->get_lpe();
- if (dynamic_cast<Inkscape::LivePathEffect::LPEMirrorSymmetry *>(lpe) ||
- dynamic_cast<Inkscape::LivePathEffect::LPEMeasureLine *>(lpe) )
- {
+ if (dynamic_cast<Inkscape::LivePathEffect::LPEMeasureLine *>(lpe)){
lpe->doOnRemove(this);
}
}
@@ -260,8 +257,6 @@ bool SPLPEItem::performPathEffect(SPCurve *curve, bool is_clip_or_mask) {
return false;
}
if (!SP_IS_GROUP(this)) {
- lpe->pathvector_before_effect = curve->get_pathvector();
- lpe->sp_curve->set_pathvector(lpe->pathvector_before_effect);
lpe->doAfterEffect(this);
}
}
@@ -609,7 +604,7 @@ bool SPLPEItem::hasPathEffect() const
return true;
}
-bool SPLPEItem::hasPathEffectOfType(int const type, bool is_ready) const
+bool SPLPEItem::hasPathEffectOfType(int const type) const
{
if (path_effect_list->empty()) {
return false;
@@ -621,9 +616,7 @@ bool SPLPEItem::hasPathEffectOfType(int const type, bool is_ready) const
if (lpeobj) {
Inkscape::LivePathEffect::Effect const* lpe = lpeobj->get_lpe();
if (lpe && (lpe->effectType() == type)) {
- if (is_ready || lpe->isReady()) {
- return true;
- }
+ return true;
}
}
}
diff --git a/src/sp-lpe-item.h b/src/sp-lpe-item.h
index db4a0c7a3..9e5cb3329 100644
--- a/src/sp-lpe-item.h
+++ b/src/sp-lpe-item.h
@@ -73,7 +73,7 @@ public:
bool pathEffectsEnabled() const;
bool hasPathEffect() const;
- bool hasPathEffectOfType(int const type, bool is_ready = true) const;
+ bool hasPathEffectOfType(int const type) const;
bool hasPathEffectRecursive() const;
Inkscape::LivePathEffect::Effect* getPathEffectOfType(int type);
Inkscape::LivePathEffect::Effect const* getPathEffectOfType(int type) const;
diff --git a/src/sp-object.cpp b/src/sp-object.cpp
index 0dc301c49..75f4657ef 100644
--- a/src/sp-object.cpp
+++ b/src/sp-object.cpp
@@ -775,21 +775,6 @@ void SPObject::appendChild(Inkscape::XML::Node *child) {
repr->appendChild(child);
}
-SPObject* SPObject::nthChild(unsigned index) {
- g_assert(this->repr);
- if (hasChildren()) {
- std::vector<SPObject*> l;
- unsigned counter = 0;
- for (auto& child: children) {
- if (counter == index) {
- return &child;
- }
- counter++;
- }
- }
- return NULL;
-}
-
void SPObject::addChild(Inkscape::XML::Node *child, Inkscape::XML::Node * prev)
{
g_assert(this->repr);
diff --git a/src/sp-object.h b/src/sp-object.h
index d145e966b..9abbd324b 100644
--- a/src/sp-object.h
+++ b/src/sp-object.h
@@ -318,9 +318,6 @@ public:
SPObject *lastChild() { return children.empty() ? nullptr : &children.back(); }
SPObject const *lastChild() const { return children.empty() ? nullptr : &children.back(); }
- SPObject *nthChild(unsigned index);
- SPObject const *nthChild(unsigned index) const;
-
enum Action { ActionGeneral, ActionBBox, ActionUpdate, ActionShow };
/**
diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp
index a8e708597..c1e824c1e 100644
--- a/src/ui/clipboard.cpp
+++ b/src/ui/clipboard.cpp
@@ -643,7 +643,6 @@ Glib::ustring ClipboardManagerImpl::getShapeOrTextObjectId(SPDesktop *desktop)
return svgd;
}
-
/**
* Iterate over a list of items and copy them to the clipboard.
*/
@@ -689,25 +688,6 @@ void ClipboardManagerImpl::_copySelection(ObjectSet *selection)
else
obj_copy = _copyNode(obj, _doc, _clipnode);
- // For lpe items, copy lpe stack if applicable
- SPLPEItem *lpeitem = dynamic_cast<SPLPEItem *>(item);
- if (lpeitem) {
- Inkscape::SVGOStringStream os;
- if (lpeitem->hasPathEffect()) {
- for (PathEffectList::iterator it = lpeitem->path_effect_list->begin(); it != lpeitem->path_effect_list->end(); ++it)
- {
- LivePathEffectObject *lpeobj = (*it)->lpeobject;
- if (lpeobj) {
- Inkscape::XML::Node * lpeobjcopy = _copyNode(lpeobj->getRepr(), _doc, _defs);
- gchar *new_conflict_id = sp_object_get_unique_id(lpeobj, lpeobj->getAttribute("id"));
- lpeobjcopy->setAttribute("id", new_conflict_id);
- g_free(new_conflict_id);
- os << "#" << lpeobjcopy->attribute("id") << ";";
- }
- }
- }
- obj_copy->setAttribute("inkscape:path-effect", os.str().c_str());
- }
// copy complete inherited style
SPCSSAttr *css = sp_repr_css_attr_inherited(obj, "style");
sp_repr_css_set(obj_copy, css, "style");
@@ -739,6 +719,13 @@ void ClipboardManagerImpl::_copySelection(ObjectSet *selection)
sp_repr_css_set(_clipnode, style, "style");
sp_repr_css_attr_unref(style);
}
+ // copy path effect from the first path
+ if (object) {
+ gchar const *effect =object->getRepr()->attribute("inkscape:path-effect");
+ if (effect) {
+ _clipnode->setAttribute("inkscape:path-effect", effect);
+ }
+ }
}
Geom::OptRect size = selection->visualBounds();
@@ -841,6 +828,19 @@ void ClipboardManagerImpl::_copyUsedDefs(SPItem *item)
}
}
+ // For lpe items, copy lpe stack if applicable
+ SPLPEItem *lpeitem = dynamic_cast<SPLPEItem *>(item);
+ if (lpeitem) {
+ if (lpeitem->hasPathEffect()) {
+ for (PathEffectList::iterator it = lpeitem->path_effect_list->begin(); it != lpeitem->path_effect_list->end(); ++it){
+ LivePathEffectObject *lpeobj = (*it)->lpeobject;
+ if (lpeobj) {
+ _copyNode(lpeobj->getRepr(), _doc, _defs);
+ }
+ }
+ }
+ }
+
// recurse
for(auto& o: item->children) {
SPItem *childItem = dynamic_cast<SPItem *>(&o);
diff --git a/src/ui/tool/transform-handle-set.cpp b/src/ui/tool/transform-handle-set.cpp
index 33015fe11..083a7d0ba 100644
--- a/src/ui/tool/transform-handle-set.cpp
+++ b/src/ui/tool/transform-handle-set.cpp
@@ -183,6 +183,11 @@ void TransformHandle::ungrabbed(GdkEventButton *)
_setState(_state);
endTransform();
_th.signal_commit.emit(getCommitEvent());
+
+ //updates the positions of the nodes
+ Inkscape::UI::Tools::NodeTool *nt = INK_NODE_TOOL(_th._desktop->event_context);
+ ControlPointSelection* selection = nt->_selected_nodes;
+ selection->setOriginalPoints();
}
diff --git a/src/ui/widget/selected-style.cpp b/src/ui/widget/selected-style.cpp
index fa7a83732..0370d55db 100644
--- a/src/ui/widget/selected-style.cpp
+++ b/src/ui/widget/selected-style.cpp
@@ -781,62 +781,7 @@ void SelectedStyle::on_stroke_paste() {
}
void SelectedStyle::on_fillstroke_swap() {
- SPCSSAttr *css = sp_repr_css_attr_new ();
-
- switch (_mode[SS_FILL]) {
- case SS_NA:
- case SS_MANY:
- break;
- case SS_NONE:
- sp_repr_css_set_property (css, "stroke", "none");
- break;
- case SS_UNSET:
- sp_repr_css_unset_property (css, "stroke");
- break;
- case SS_COLOR:
- gchar c[64];
- sp_svg_write_color (c, sizeof(c), _thisselected[SS_FILL]);
- sp_repr_css_set_property (css, "stroke", c);
- break;
- case SS_LGRADIENT:
- case SS_RGRADIENT:
-#ifdef WITH_MESH
- case SS_MGRADIENT:
-#endif
- case SS_PATTERN:
- sp_repr_css_set_property (css, "stroke", _paintserver_id[SS_FILL].c_str());
- break;
- }
-
- switch (_mode[SS_STROKE]) {
- case SS_NA:
- case SS_MANY:
- break;
- case SS_NONE:
- sp_repr_css_set_property (css, "fill", "none");
- break;
- case SS_UNSET:
- sp_repr_css_unset_property (css, "fill");
- break;
- case SS_COLOR:
- gchar c[64];
- sp_svg_write_color (c, sizeof(c), _thisselected[SS_STROKE]);
- sp_repr_css_set_property (css, "fill", c);
- break;
- case SS_LGRADIENT:
- case SS_RGRADIENT:
-#ifdef WITH_MESH
- case SS_MGRADIENT:
-#endif
- case SS_PATTERN:
- sp_repr_css_set_property (css, "fill", _paintserver_id[SS_STROKE].c_str());
- break;
- }
-
- sp_desktop_set_style (_desktop, css);
- sp_repr_css_attr_unref (css);
- DocumentUndo::done(_desktop->getDocument(), SP_VERB_DIALOG_FILL_STROKE,
- _("Swap fill and stroke"));
+ _desktop->getSelection()->swapFillStroke();
}
void SelectedStyle::on_fill_edit() {
diff --git a/src/verbs.cpp b/src/verbs.cpp
index 975a3679e..aeb742105 100644
--- a/src/verbs.cpp
+++ b/src/verbs.cpp
@@ -1086,6 +1086,9 @@ void EditVerb::perform(SPAction *action, void *data)
case SP_VERB_EDIT_NEXT_PATHEFFECT_PARAMETER:
sp_selection_next_patheffect_param(dt);
break;
+ case SP_VERB_EDIT_SWAP_FILL_STROKE:
+ dt->selection->swapFillStroke();
+ break;
case SP_VERB_EDIT_LINK_COLOR_PROFILE:
break;
case SP_VERB_EDIT_REMOVE_COLOR_PROFILE:
@@ -2585,6 +2588,8 @@ Verb *Verb::_base_verbs[] = {
N_("Create four guides aligned with the page borders"), NULL),
new EditVerb(SP_VERB_EDIT_NEXT_PATHEFFECT_PARAMETER, "EditNextPathEffectParameter", N_("Next path effect parameter"),
N_("Show next editable path effect parameter"), INKSCAPE_ICON("path-effect-parameter-next")),
+ new EditVerb(SP_VERB_EDIT_SWAP_FILL_STROKE, "EditSwapFillStroke", N_("Swap fill and stroke"),
+ N_("Swap fill and stroke of an object"), NULL),
// Selection
new SelectionVerb(SP_VERB_SELECTION_TO_FRONT, "SelectionToFront", N_("Raise to _Top"),
diff --git a/src/verbs.h b/src/verbs.h
index d7e966ae4..76a7d19a6 100644
--- a/src/verbs.h
+++ b/src/verbs.h
@@ -110,6 +110,7 @@ enum {
SP_VERB_EDIT_GUIDES_TOGGLE_LOCK,
SP_VERB_EDIT_GUIDES_AROUND_PAGE,
SP_VERB_EDIT_NEXT_PATHEFFECT_PARAMETER,
+ SP_VERB_EDIT_SWAP_FILL_STROKE,
/* Selection */
SP_VERB_SELECTION_TO_FRONT,
SP_VERB_SELECTION_TO_BACK,