From 6813c18d7497f999fdf326e2746f8ba7c0c9da99 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Wed, 2 Nov 2016 15:49:37 +0100 Subject: Close the bounding box path LPE (bzr r15197) --- src/live_effects/lpe-bounding-box.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/live_effects/lpe-bounding-box.cpp b/src/live_effects/lpe-bounding-box.cpp index cfe1f5165..2de768c3a 100644 --- a/src/live_effects/lpe-bounding-box.cpp +++ b/src/live_effects/lpe-bounding-box.cpp @@ -41,6 +41,7 @@ void LPEBoundingBox::doEffect (SPCurve * curve) p.appendNew(Geom::Point(bbox->right(), bbox->bottom())); p.appendNew(Geom::Point(bbox->left(), bbox->bottom())); p.appendNew(Geom::Point(bbox->left(), bbox->top())); + p.close(); Geom::PathVector out; out.push_back(p); curve->set_pathvector(out); -- cgit v1.2.3 From b49cad5aefd16b340307056a5e959a62548a8fe1 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Wed, 2 Nov 2016 16:02:59 +0100 Subject: Fix fill between many LPE to start up with current path (bzr r15198) --- src/live_effects/lpe-fill-between-many.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/live_effects/lpe-fill-between-many.cpp b/src/live_effects/lpe-fill-between-many.cpp index ccb9cf56d..2087925fa 100644 --- a/src/live_effects/lpe-fill-between-many.cpp +++ b/src/live_effects/lpe-fill-between-many.cpp @@ -57,6 +57,9 @@ void LPEFillBetweenMany::doEffect (SPCurve * curve) if (!res_pathv.empty()) { res_pathv.front().close(); } + if (res_pathv.empty()) { + res_pathv = curve->get_pathvector(); + } curve->set_pathvector(res_pathv); } -- cgit v1.2.3 From 1745fbc8feec44b064ef92cb0f1f78789342e311 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Wed, 2 Nov 2016 20:53:08 +0100 Subject: Fix bug:1013141 crash deleting LPE Fixed bugs: - https://launchpad.net/bugs/1013141 (bzr r15200) --- src/ui/dialog/livepatheffect-editor.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp index b97b0e63a..4d60d610e 100644 --- a/src/ui/dialog/livepatheffect-editor.cpp +++ b/src/ui/dialog/livepatheffect-editor.cpp @@ -547,7 +547,17 @@ void LivePathEffectEditor::on_effect_selection_changed() if (lperef && current_lpeitem && current_lperef != lperef) { //The last condition ignore Gtk::TreeModel may occasionally be changed emitted when nothing has happened - if (lperef->lpeobject->get_lpe()) { + Glib::RefPtr model = effectlist_view.get_model(); + Gtk::TreeNodeChildren childs = model->children(); + Gtk::TreeNodeChildren::iterator row; + bool removed = true; + for( row = childs.begin() ; row!=childs.end(); ++row) + { + if ( (*row)[columns.lperef] == current_lperef ) { + removed = false; + } + } + if (!removed && lperef->lpeobject->get_lpe()) { lpe_list_locked = true; // prevent reload of the list which would lose selection current_lpeitem->setCurrentPathEffect(lperef); current_lperef = lperef; -- cgit v1.2.3 From 11eec0018a69b8f4c0c4598fed568621e491dcf3 Mon Sep 17 00:00:00 2001 From: Tobias Ellinghaus Date: Wed, 2 Nov 2016 23:42:08 +0100 Subject: fix none color in palettes with scrollbars (bzr r15201) --- src/widgets/eek-preview.cpp | 36 ++++++++++++++---------------------- 1 file changed, 14 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/widgets/eek-preview.cpp b/src/widgets/eek-preview.cpp index 5f1997672..38d5173fa 100644 --- a/src/widgets/eek-preview.cpp +++ b/src/widgets/eek-preview.cpp @@ -61,11 +61,11 @@ typedef struct { int scaledW; int scaledH; - + int r; int g; int b; - + gboolean hot; gboolean within; gboolean takesFocus; @@ -227,7 +227,7 @@ gboolean eek_preview_draw(GtkWidget *widget, GtkAllocation allocation; gtk_widget_get_allocation(widget, &allocation); - + gint insetTop = 0, insetBottom = 0; gint insetLeft = 0, insetRight = 0; @@ -245,12 +245,12 @@ gboolean eek_preview_draw(GtkWidget *widget, } auto context = gtk_widget_get_style_context(widget); - + gtk_render_frame(context, cr, 0, 0, allocation.width, allocation.height); - + gtk_render_background(context, cr, 0, 0, @@ -269,26 +269,19 @@ gboolean eek_preview_draw(GtkWidget *widget, if (priv->previewPixbuf ) { - GtkDrawingArea *da = &(preview->drawing); - GdkWindow *da_window = gtk_widget_get_window(GTK_WIDGET(da)); - cairo_t *cr = gdk_cairo_create(da_window); - - gint w = gdk_window_get_width(da_window); - gint h = gdk_window_get_height(da_window); - - if ((w != priv->scaledW) || (h != priv->scaledH)) { + if ((allocation.width != priv->scaledW) || (allocation.height != priv->scaledH)) { if (priv->scaled) { g_object_unref(priv->scaled); } + priv->scaledW = allocation.width - (insetLeft + insetRight); + priv->scaledH = allocation.height - (insetTop + insetBottom); + priv->scaled = gdk_pixbuf_scale_simple(priv->previewPixbuf, - w - (insetLeft + insetRight), - h - (insetTop + insetBottom), + priv->scaledW, + priv->scaledH, GDK_INTERP_BILINEAR); - - priv->scaledW = w - (insetLeft + insetRight); - priv->scaledH = h - (insetTop + insetBottom); } GdkPixbuf *pix = (priv->scaled) ? priv->scaled : priv->previewPixbuf; @@ -302,7 +295,6 @@ gboolean eek_preview_draw(GtkWidget *widget, gdk_cairo_set_source_pixbuf(cr, pix, insetLeft, insetTop); cairo_paint(cr); - cairo_destroy(cr); } if (priv->linked) @@ -479,7 +471,7 @@ static gboolean eek_preview_button_release_cb( GtkWidget* widget, GdkEventButton gtk_widget_set_state_flags( widget, GTK_STATE_FLAG_NORMAL, false ); if ( priv->within && - (event->button == PRIME_BUTTON_MAGIC_NUMBER || + (event->button == PRIME_BUTTON_MAGIC_NUMBER || event->button == 2)) { gboolean isAlt = ( ((event->state & GDK_SHIFT_MASK) == GDK_SHIFT_MASK) || @@ -607,7 +599,7 @@ eek_preview_set_linked(EekPreview *preview, EekPreviewPrivate *priv = EEK_PREVIEW_GET_PRIVATE(preview); g_return_if_fail(IS_EEK_PREVIEW(preview)); - + link = (LinkType)(link & PREVIEW_LINK_ALL); if (link != (LinkType)priv->linked) @@ -656,7 +648,7 @@ eek_preview_set_details(EekPreview *preview, guint border) { EekPreviewPrivate *priv = EEK_PREVIEW_GET_PRIVATE(preview); - + g_return_if_fail(IS_EEK_PREVIEW(preview)); priv->view = view; -- cgit v1.2.3 From a5ea253b4b4d94659e0e0992b51853ffd4debbf9 Mon Sep 17 00:00:00 2001 From: Tobias Ellinghaus Date: Wed, 2 Nov 2016 23:42:43 +0100 Subject: fix prefs icon Fixed bugs: - https://launchpad.net/bugs/1638353 (bzr r15202) --- src/verbs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/verbs.cpp b/src/verbs.cpp index 7a9875c69..dc92545e2 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -2942,7 +2942,7 @@ Verb *Verb::_base_verbs[] = { // Dialogs new DialogVerb(SP_VERB_DIALOG_DISPLAY, "DialogPreferences", N_("P_references..."), - N_("Edit global Inkscape preferences"), INKSCAPE_ICON("preferences-system")), + N_("Edit global Inkscape preferences"), INKSCAPE_ICON("gtk-preferences")), new DialogVerb(SP_VERB_DIALOG_NAMEDVIEW, "DialogDocumentProperties", N_("_Document Properties..."), N_("Edit properties of this document (to be saved with the document)"), INKSCAPE_ICON("document-properties")), new DialogVerb(SP_VERB_DIALOG_METADATA, "DialogMetadata", N_("Document _Metadata..."), -- cgit v1.2.3 From 6162cf1a9f6953319e0e3d6b56354c5cb0f26352 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Thu, 3 Nov 2016 00:08:41 +0100 Subject: Add some unit tests for object-set cppification (bzr r15203) --- src/object-set.cpp | 4 ++-- src/selection-chemistry.cpp | 6 +++--- src/sp-item.cpp | 11 +++++++++++ src/sp-item.h | 1 + src/ui/dialog/align-and-distribute.cpp | 2 +- 5 files changed, 18 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/object-set.cpp b/src/object-set.cpp index fd0b908d1..65e7d45d6 100644 --- a/src/object-set.cpp +++ b/src/object-set.cpp @@ -204,7 +204,7 @@ SPItem *ObjectSet::_sizeistItem(bool sml, CompareSize compare) { SPItem *ist = NULL; for (auto i = items.begin(); i != items.end(); ++i) { - Geom::OptRect obox = SP_ITEM(*i)->desktopPreferredBounds(); + Geom::OptRect obox = SP_ITEM(*i)->documentPreferredBounds(); if (!obox || obox.empty()) { continue; } @@ -212,7 +212,7 @@ SPItem *ObjectSet::_sizeistItem(bool sml, CompareSize compare) { Geom::Rect bbox = *obox; gdouble size = compare == AREA ? bbox.area() : - (compare == VERTICAL ? bbox.width() : bbox.height()); + (compare == VERTICAL ? bbox.height() : bbox.width()); size = sml ? size : size * -1; if (size < max) { max = size; diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index 2f9e72e2c..2db059afe 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -946,7 +946,7 @@ enclose_items(std::vector const &items) Geom::OptRect r; for (std::vector::const_iterator i = items.begin();i!=items.end();++i) { - r.unionWith((*i)->desktopVisualBounds()); + r.unionWith((*i)->documentVisualBounds()); } return r; } @@ -1000,7 +1000,7 @@ void ObjectSet::raise(bool skip_undo){ // if the sibling is an item AND overlaps our selection, SPItem *newItem = dynamic_cast(newref); if (newItem) { - Geom::OptRect newref_bbox = newItem->desktopVisualBounds(); + Geom::OptRect newref_bbox = newItem->documentVisualBounds(); if ( newref_bbox && selected->intersects(*newref_bbox) ) { // AND if it's not one of our selected objects, if ( std::find(items_copy.begin(),items_copy.end(),newref)==items_copy.end()) { @@ -1077,7 +1077,7 @@ void ObjectSet::lower(bool skip_undo){ // if the sibling is an item AND overlaps our selection, SPItem *newItem = dynamic_cast(newref); if (newItem) { - Geom::OptRect ref_bbox = newItem->desktopVisualBounds(); + Geom::OptRect ref_bbox = newItem->documentVisualBounds(); if ( ref_bbox && selected->intersects(*ref_bbox) ) { // AND if it's not one of our selected objects, if (items_copy.end()==std::find(items_copy.begin(),items_copy.end(),newref)) { diff --git a/src/sp-item.cpp b/src/sp-item.cpp index f52784489..36a9c3c9d 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -868,6 +868,17 @@ Geom::OptRect SPItem::bounds(BBoxType type, Geom::Affine const &transform) const } } +Geom::OptRect SPItem::documentPreferredBounds() const +{ + if (Inkscape::Preferences::get()->getInt("/tools/bounding_box") == 0) { + return documentBounds(SPItem::VISUAL_BBOX); + } else { + return documentBounds(SPItem::GEOMETRIC_BBOX); + } +} + + + Geom::OptRect SPItem::documentGeometricBounds() const { return geometricBounds(i2doc_affine()); diff --git a/src/sp-item.h b/src/sp-item.h index bdc6a0ad9..a03bab9f3 100644 --- a/src/sp-item.h +++ b/src/sp-item.h @@ -258,6 +258,7 @@ public: Geom::OptRect documentVisualBounds() const; Geom::OptRect documentBounds(BBoxType type) const; + Geom::OptRect documentPreferredBounds() const; /** * Get item's geometric bbox in desktop coordinate system. diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp index 7ba6df978..236832beb 100644 --- a/src/ui/dialog/align-and-distribute.cpp +++ b/src/ui/dialog/align-and-distribute.cpp @@ -129,7 +129,7 @@ void ActionAlign::do_action(SPDesktop *desktop, int index) SPItem *focus = NULL; Geom::OptRect b = Geom::OptRect(); Selection::CompareSize horiz = (a.mx0 != 0.0) || (a.mx1 != 0.0) - ? Selection::HORIZONTAL : Selection::VERTICAL; + ? Selection::VERTICAL : Selection::HORIZONTAL; switch (AlignTarget(prefs->getInt("/dialogs/align/align-to", 6))) { -- cgit v1.2.3 From f3a1e56cfdaa68c8de656cfb351c1ca6f29d7387 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Thu, 3 Nov 2016 02:55:39 +0100 Subject: Revert two changes from r15177 Fixed bugs: - https://launchpad.net/bugs/1636475 - https://launchpad.net/bugs/1637885 (bzr r15204) --- src/display/drawing-shape.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/display/drawing-shape.cpp b/src/display/drawing-shape.cpp index ba95a63ce..d7329e670 100644 --- a/src/display/drawing-shape.cpp +++ b/src/display/drawing-shape.cpp @@ -217,7 +217,7 @@ DrawingShape::_renderItem(DrawingContext &dc, Geom::IntRect const &area, unsigne } { Inkscape::DrawingContext::Save save(dc); dc.setSource(rgba); - dc.setLineWidth(5); + dc.setLineWidth(0.5); dc.setTolerance(0.5); dc.stroke(); } @@ -234,7 +234,6 @@ DrawingShape::_renderItem(DrawingContext &dc, Geom::IntRect const &area, unsigne // we assume the context has no path Inkscape::DrawingContext::Save save(dc); dc.transform(_ctm); - dc.path(_curve->get_pathvector()); // update fill and stroke paints. @@ -244,6 +243,7 @@ DrawingShape::_renderItem(DrawingContext &dc, Geom::IntRect const &area, unsigne bool has_stroke = _nrstyle.prepareStroke(dc, _item_bbox, _stroke_pattern); has_stroke &= (_nrstyle.stroke_width != 0); if (has_fill || has_stroke) { + dc.path(_curve->get_pathvector()); // TODO: remove segments outside of bbox when no dashes present if (has_fill) { _nrstyle.applyFill(dc); -- cgit v1.2.3 From 603fe60db5f56608c90a2bddb9bb94357a3fa5a9 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Fri, 4 Nov 2016 00:28:50 +0100 Subject: Fix crash in some commandline usage (bzr r15205) --- src/object-set.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/object-set.h b/src/object-set.h index 8fa20e454..a70730ef1 100644 --- a/src/object-set.h +++ b/src/object-set.h @@ -104,7 +104,8 @@ public: typedef decltype(MultiIndexContainer().get() | boost::adaptors::filtered(is_item()) | boost::adaptors::transformed(object_to_node())) XMLNodeRange; ObjectSet(SPDesktop* desktop): _desktop(desktop) { - _document = desktop->getDocument(); + if (desktop) + _document = desktop->getDocument(); }; ObjectSet(SPDocument* doc): _desktop(nullptr), _document(doc) {}; ObjectSet(): _desktop(nullptr), _document(nullptr) {}; -- cgit v1.2.3 From 007bd6018e781bd54c9a7b68563375ffab21b336 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Fri, 4 Nov 2016 19:47:51 +0100 Subject: Render meshes with old syntax using camelCase. (bzr r15207) --- src/sp-factory.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/sp-factory.cpp b/src/sp-factory.cpp index f98291378..9d46c9a84 100644 --- a/src/sp-factory.cpp +++ b/src/sp-factory.cpp @@ -183,8 +183,14 @@ SPObject *SPFactory::createObject(std::string const& id) } else if (id == "svg:meshgradient") // SVG 2 ret = new SPMeshGradient; + else if (id == "svg:meshPatch") { + ret = new SPMeshpatch; + std::cerr << "Warning: and have been renamed and " << std::endl; + } else if (id == "svg:meshpatch") ret = new SPMeshpatch; + else if (id == "svg:meshRow") + ret = new SPMeshrow; else if (id == "svg:meshrow") ret = new SPMeshrow; else if (id == "svg:metadata") -- cgit v1.2.3 From 05d344828f919fad7846d2d76534eb02b554dc00 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sat, 5 Nov 2016 03:32:30 +0100 Subject: Fix bug:1639083 crach closing segment with shortcut LPE Fixed bugs: - https://launchpad.net/bugs/1639083 (bzr r15210) --- src/display/curve.cpp | 12 +++++++++++ src/display/curve.h | 1 + src/ui/tools/pen-tool.cpp | 48 ++++++++++++++++++++++---------------------- src/ui/tools/pencil-tool.cpp | 4 ++-- 4 files changed, 39 insertions(+), 26 deletions(-) (limited to 'src') diff --git a/src/display/curve.cpp b/src/display/curve.cpp index b6c387034..1998e9bec 100644 --- a/src/display/curve.cpp +++ b/src/display/curve.cpp @@ -301,6 +301,18 @@ SPCurve::is_empty() const return _pathv.empty(); } +/** + * True if paths are in curve. If it only contains a path with only a moveto, the path is considered as unset FALSE + */ +bool +SPCurve::is_unset() const +{ + if (get_segment_count()) { + return false; + } + return true; +} + /** * True iff all subpaths are closed. * Returns false if the curve is empty. diff --git a/src/display/curve.h b/src/display/curve.h index 42b899210..72e6df95c 100644 --- a/src/display/curve.h +++ b/src/display/curve.h @@ -43,6 +43,7 @@ public: size_t nodes_in_path() const; bool is_empty() const; + bool is_unset() const; bool is_closed() const; Geom::Curve const * last_segment() const; Geom::Path const * last_path() const; diff --git a/src/ui/tools/pen-tool.cpp b/src/ui/tools/pen-tool.cpp index 312338882..caf6faec2 100644 --- a/src/ui/tools/pen-tool.cpp +++ b/src/ui/tools/pen-tool.cpp @@ -367,7 +367,7 @@ bool PenTool::_handleButtonPress(GdkEventButton const &bevent) { //with this we avoid creating a new point over the existing one if(bevent.button != 3 && (this->spiro || this->bspline) && this->npoints > 0 && this->p[0] == this->p[3]){ - if( anchor && anchor == this->sa && this->green_curve->is_empty()){ + if( anchor && anchor == this->sa && this->green_curve->is_unset()){ //remove the following line to avoid having one node on top of another _finishSegment(event_dt, bevent.state); _finish(true); @@ -919,7 +919,7 @@ void PenTool::_lastpointMove(gdouble x, gdouble y) { return; // green - if (!this->green_curve->is_empty()) { + if (!this->green_curve->is_unset()) { this->green_curve->last_point_additive_move( Geom::Point(x,y) ); } else { // start anchor too @@ -947,7 +947,7 @@ void PenTool::_lastpointToCurve() { this->p[1] = this->red_curve->last_segment()->initialPoint() + (1./3.)*(this->red_curve->last_segment()->finalPoint() - this->red_curve->last_segment()->initialPoint()); //modificate the last segment of the green curve so it creates the type of node we need if (this->spiro||this->bspline) { - if (!this->green_curve->is_empty()) { + if (!this->green_curve->is_unset()) { Geom::Point A(0,0); Geom::Point B(0,0); Geom::Point C(0,0); @@ -986,7 +986,7 @@ void PenTool::_lastpointToCurve() { } } //if the last node is an union with another curve - if (this->green_curve->is_empty() && this->sa && !this->sa->curve->is_empty()) { + if (this->green_curve->is_unset() && this->sa && !this->sa->curve->is_unset()) { this->_bsplineSpiroStartAnchor(false); } } @@ -1002,7 +1002,7 @@ void PenTool::_lastpointToLine() { // modify the last segment of the green curve so the type of node we want is created. if(this->spiro || this->bspline){ - if(!this->green_curve->is_empty()){ + if(!this->green_curve->is_unset()){ Geom::Point A(0,0); Geom::Point B(0,0); Geom::Point C(0,0); @@ -1033,7 +1033,7 @@ void PenTool::_lastpointToLine() { } } // if the last node is an union with another curve - if(this->green_curve->is_empty() && this->sa && !this->sa->curve->is_empty()){ + if(this->green_curve->is_unset() && this->sa && !this->sa->curve->is_unset()){ this->_bsplineSpiroStartAnchor(true); } } @@ -1212,7 +1212,7 @@ bool PenTool::_handleKeyPress(GdkEvent *event) { // All this is needed to stop the last control // point dispeating and stop making an n-1 shape. Geom::Point const p(0, 0); - if(this->red_curve->is_empty()) { + if(this->red_curve->is_unset()) { this->red_curve->moveto(p); } this->_finishSegment(p, 0); @@ -1364,7 +1364,7 @@ void PenTool::_bsplineSpiro(bool shift) void PenTool::_bsplineSpiroOn() { - if(!this->red_curve->is_empty()){ + if(!this->red_curve->is_unset()){ using Geom::X; using Geom::Y; this->npoints = 5; @@ -1377,7 +1377,7 @@ void PenTool::_bsplineSpiroOn() void PenTool::_bsplineSpiroOff() { - if(!this->red_curve->is_empty()){ + if(!this->red_curve->is_unset()){ this->npoints = 5; this->p[0] = this->red_curve->first_segment()->initialPoint(); this->p[3] = this->red_curve->first_segment()->finalPoint(); @@ -1387,7 +1387,7 @@ void PenTool::_bsplineSpiroOff() void PenTool::_bsplineSpiroStartAnchor(bool shift) { - if(this->sa->curve->is_empty()){ + if(this->sa->curve->is_unset()){ return; } @@ -1497,18 +1497,18 @@ void PenTool::_bsplineSpiroMotion(bool shift){ } using Geom::X; using Geom::Y; - if(this->red_curve->is_empty()) return; + if(this->red_curve->is_unset()) return; this->npoints = 5; SPCurve *tmp_curve = new SPCurve(); this->p[2] = this->p[3] + (1./3)*(this->p[0] - this->p[3]); this->p[2] = Geom::Point(this->p[2][X] + HANDLE_CUBIC_GAP,this->p[2][Y] + HANDLE_CUBIC_GAP); - if(this->green_curve->is_empty() && !this->sa){ + if(this->green_curve->is_unset() && !this->sa){ this->p[1] = this->p[0] + (1./3)*(this->p[3] - this->p[0]); this->p[1] = Geom::Point(this->p[1][X] + HANDLE_CUBIC_GAP,this->p[1][Y] + HANDLE_CUBIC_GAP); if(shift){ this->p[2] = this->p[3]; } - }else if(!this->green_curve->is_empty()){ + }else if(!this->green_curve->is_unset()){ tmp_curve = this->green_curve->copy(); }else{ tmp_curve = this->overwrite_curve->copy(); @@ -1516,7 +1516,7 @@ void PenTool::_bsplineSpiroMotion(bool shift){ tmp_curve = tmp_curve ->create_reverse(); } - if(!tmp_curve ->is_empty()){ + if(!tmp_curve ->is_unset()){ Geom::CubicBezier const * cubic = dynamic_cast(&*tmp_curve ->last_segment()); if(cubic){ if(this->bspline){ @@ -1548,7 +1548,7 @@ void PenTool::_bsplineSpiroMotion(bool shift){ } } - if(this->anchor_statusbar && !this->red_curve->is_empty()){ + if(this->anchor_statusbar && !this->red_curve->is_unset()){ if(shift){ this->_bsplineSpiroEndAnchorOff(); }else{ @@ -1681,19 +1681,19 @@ void PenTool::_bsplineSpiroBuild() //We create the base curve SPCurve *curve = new SPCurve(); //If we continuate the existing curve we add it at the start - if(this->sa && !this->sa->curve->is_empty()){ + if(this->sa && !this->sa->curve->is_unset()){ curve = this->overwrite_curve->copy(); if (this->sa->start) { curve = curve->create_reverse(); } } - if (!this->green_curve->is_empty()){ + if (!this->green_curve->is_unset()){ curve->append_continuous(this->green_curve, 0.0625); } //and the red one - if (!this->red_curve->is_empty()){ + if (!this->red_curve->is_unset()){ this->red_curve->reset(); this->red_curve->moveto(this->p[0]); if(this->anchor_statusbar && !this->sa && !(this->green_anchor && this->green_anchor->active)){ @@ -1705,7 +1705,7 @@ void PenTool::_bsplineSpiroBuild() curve->append_continuous(this->red_curve, 0.0625); } - if(!curve->is_empty()){ + if(!curve->is_unset()){ // close the curve if the final points of the curve are close enough if(Geom::are_near(curve->first_path()->initialPoint(), curve->last_path()->finalPoint())){ curve->closepath_current(); @@ -1844,7 +1844,7 @@ void PenTool::_finishSegment(Geom::Point const p, guint const state) { ++num_clicks; - if (!this->red_curve->is_empty()) { + if (!this->red_curve->is_unset()) { this->_bsplineSpiro(state & GDK_SHIFT_MASK); this->green_curve->append_continuous(this->red_curve, 0.0625); SPCurve *curve = this->red_curve->copy(); @@ -1869,8 +1869,8 @@ void PenTool::_finishSegment(Geom::Point const p, guint const state) { bool PenTool::_undoLastPoint() { bool ret = false; - if ( this->green_curve->is_empty() || (this->green_curve->last_segment() == NULL) ) { - if (!this->red_curve->is_empty()) { + if ( this->green_curve->is_unset() || (this->green_curve->last_segment() == NULL) ) { + if (!this->red_curve->is_unset()) { this->_cancel (); ret = true; } else { @@ -1887,7 +1887,7 @@ bool PenTool::_undoLastPoint() { this->green_bpaths = g_slist_remove(this->green_bpaths, this->green_bpaths->data); } // Get last segment - if ( this->green_curve->is_empty() ) { + if ( this->green_curve->is_unset() ) { g_warning("pen_handle_key_press, case GDK_KP_Delete: Green curve is empty"); return false; } @@ -2019,7 +2019,7 @@ int PenTool::nextParaxialDirection(Geom::Point const &pt, Geom::Point const &ori // (on first mouse release), in which case num_clicks immediately becomes 1. // if (this->num_clicks == 0) { - if (this->green_curve->is_empty()) { + if (this->green_curve->is_unset()) { // first mouse click double dist_h = fabs(pt[Geom::X] - origin[Geom::X]); double dist_v = fabs(pt[Geom::Y] - origin[Geom::Y]); diff --git a/src/ui/tools/pencil-tool.cpp b/src/ui/tools/pencil-tool.cpp index 54106437c..ec2874823 100644 --- a/src/ui/tools/pencil-tool.cpp +++ b/src/ui/tools/pencil-tool.cpp @@ -588,8 +588,8 @@ void PencilTool::_setEndpoint(Geom::Point const &p) { * Still not sure, how it will make most sense. */ void PencilTool::_finishEndpoint() { - if ( ( this->red_curve->is_empty() ) - || ( *(this->red_curve->first_point()) == *(this->red_curve->second_point()) ) ) + if (this->red_curve->is_unset() || + this->red_curve->first_point() == this->red_curve->second_point()) { this->red_curve->reset(); sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(this->red_bpath), NULL); -- cgit v1.2.3 From dd38575e29e544156915a4400ad9cb4a412c9fe6 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sat, 5 Nov 2016 03:38:01 +0100 Subject: Fix bug:1639098 Fixed bugs: - https://launchpad.net/bugs/1639098 (bzr r15211) --- src/ui/tools/freehand-base.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ui/tools/freehand-base.cpp b/src/ui/tools/freehand-base.cpp index 300324467..deb89b874 100644 --- a/src/ui/tools/freehand-base.cpp +++ b/src/ui/tools/freehand-base.cpp @@ -642,7 +642,10 @@ void spdc_concat_colors_and_flush(FreehandBase *dc, gboolean forceclosed) } // Step A - test, whether we ended on green anchor - if ( forceclosed || ( dc->green_anchor && dc->green_anchor->active ) ) { + if ( (forceclosed && + (!dc->sa || (dc->sa && dc->sa->curve->is_empty()))) || + ( dc->green_anchor && dc->green_anchor->active)) + { // We hit green anchor, closing Green-Blue-Red dc->desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Path is closed.")); c->closepath_current(); @@ -724,7 +727,11 @@ void spdc_concat_colors_and_flush(FreehandBase *dc, gboolean forceclosed) e->unref(); } - + if (forceclosed) + { + dc->desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Path is closed.")); + c->closepath_current(); + } spdc_flush_white(dc, c); c->unref(); -- cgit v1.2.3 From 361c74fe71cc69df8feba546204c93099e6b22b8 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sat, 5 Nov 2016 14:00:28 +0100 Subject: Fix change between multiples LPE in the same item (bzr r15212) --- src/ui/dialog/livepatheffect-editor.cpp | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp index 4d60d610e..9bd4c093e 100644 --- a/src/ui/dialog/livepatheffect-editor.cpp +++ b/src/ui/dialog/livepatheffect-editor.cpp @@ -546,18 +546,8 @@ void LivePathEffectEditor::on_effect_selection_changed() LivePathEffect::LPEObjectReference * lperef = (*it)[columns.lperef]; if (lperef && current_lpeitem && current_lperef != lperef) { - //The last condition ignore Gtk::TreeModel may occasionally be changed emitted when nothing has happened - Glib::RefPtr model = effectlist_view.get_model(); - Gtk::TreeNodeChildren childs = model->children(); - Gtk::TreeNodeChildren::iterator row; - bool removed = true; - for( row = childs.begin() ; row!=childs.end(); ++row) - { - if ( (*row)[columns.lperef] == current_lperef ) { - removed = false; - } - } - if (!removed && lperef->lpeobject->get_lpe()) { + //The last condition ignore Gtk::TreeModel may occasionally be changed emitted when nothing has happened + if (lperef->getObject()) { lpe_list_locked = true; // prevent reload of the list which would lose selection current_lpeitem->setCurrentPathEffect(lperef); current_lperef = lperef; -- cgit v1.2.3 From e7eeaf23639692c87f9cd772b8cdbfb7e54ceea6 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sat, 5 Nov 2016 14:49:05 +0100 Subject: Fix a bug on duplicate item with multiples LPE on it. previously the LPE become "clones" if more than 1 LPE on the item. Also wee need to discuss what happends on LPE copied what are inside a group, fork them or clone, currently are cloned This can be a feature or a bug in the same user with diferent works. My proposal is fork it and add a item in paste LPEs to allow cloned LPE on paste (bzr r15213) --- src/ui/clipboard.cpp | 40 +++++++++++++++++----------------------- 1 file changed, 17 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index 0a671cc8a..ef00e11b3 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -688,7 +688,23 @@ void ClipboardManagerImpl::_copySelection(ObjectSet *selection) else obj_copy = _copyNode(obj, _doc, _clipnode); - + // For lpe items, copy lpe stack if applicable + SPLPEItem *lpeitem = dynamic_cast(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); + lpeobjcopy->setAttribute("id",lpeobj->getRepr()->attribute("id")); + os << "#" << lpeobj->getRepr()->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"); @@ -720,14 +736,6 @@ 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(); @@ -784,20 +792,6 @@ void ClipboardManagerImpl::_copyUsedDefs(SPItem *item) } } - // For lpe items, copy lpe stack if applicable - SPLPEItem *lpeitem = dynamic_cast(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); - } - } - } - } - // For 3D boxes, copy perspectives { SPBox3D *box = dynamic_cast(item); -- cgit v1.2.3 From 046b9d9b4d20894231127a6d00d327302ffd0474 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sat, 5 Nov 2016 17:45:28 +0100 Subject: Fix last commit not working, LPE are cloned on copies (bzr r15214) --- src/sp-object.cpp | 5 +---- src/sp-object.h | 4 +++- src/ui/clipboard.cpp | 7 +++++-- 3 files changed, 9 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/sp-object.cpp b/src/sp-object.cpp index 8d4c4f0d1..e9c60fc7d 100644 --- a/src/sp-object.cpp +++ b/src/sp-object.cpp @@ -112,9 +112,6 @@ public: } }; -static gchar *sp_object_get_unique_id(SPObject *object, - gchar const *defid); - /** * Constructor, sets all attributes to default values. */ @@ -1382,7 +1379,7 @@ bool SPObject::storeAsDouble( gchar const *key, double *val ) const } /** Helper */ -static gchar* +gchar * sp_object_get_unique_id(SPObject *object, gchar const *id) { diff --git a/src/sp-object.h b/src/sp-object.h index 355f837b5..7f3c77ee3 100644 --- a/src/sp-object.h +++ b/src/sp-object.h @@ -1,6 +1,8 @@ #ifndef SP_OBJECT_H_SEEN #define SP_OBJECT_H_SEEN +#include + /* * Authors: * Lauris Kaplinski @@ -878,7 +880,7 @@ public: */ int sp_object_compare_position(SPObject const *first, SPObject const *second); bool sp_object_compare_position_bool(SPObject const *first, SPObject const *second); - +gchar * sp_object_get_unique_id(SPObject *object, gchar const *defid); #endif // SP_OBJECT_H_SEEN diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index ef00e11b3..a8e708597 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -60,6 +60,7 @@ #include "sp-mask.h" #include "sp-textpath.h" #include "sp-rect.h" +#include "sp-object.h" #include "live_effects/lpeobject.h" #include "live_effects/lpeobject-reference.h" #include "live_effects/parameter/path.h" @@ -698,8 +699,10 @@ void ClipboardManagerImpl::_copySelection(ObjectSet *selection) LivePathEffectObject *lpeobj = (*it)->lpeobject; if (lpeobj) { Inkscape::XML::Node * lpeobjcopy = _copyNode(lpeobj->getRepr(), _doc, _defs); - lpeobjcopy->setAttribute("id",lpeobj->getRepr()->attribute("id")); - os << "#" << lpeobj->getRepr()->attribute("id") << ";"; + 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") << ";"; } } } -- cgit v1.2.3 From e892b1fca285405d28a0e962f5dbcafdd81cc491 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sat, 5 Nov 2016 17:51:16 +0100 Subject: Move a header place (bzr r15215) --- src/sp-object.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/sp-object.h b/src/sp-object.h index 7f3c77ee3..9abbd324b 100644 --- a/src/sp-object.h +++ b/src/sp-object.h @@ -1,7 +1,6 @@ #ifndef SP_OBJECT_H_SEEN #define SP_OBJECT_H_SEEN -#include /* * Authors: @@ -16,6 +15,8 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#include + /* SPObject flags */ class SPObject; -- cgit v1.2.3