diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2016-11-05 17:10:22 +0000 |
|---|---|---|
| committer | jabiertxof <info@marker.es> | 2016-11-05 17:10:22 +0000 |
| commit | 218c1acafd09c2b2469db082cf6e389869f9c48e (patch) | |
| tree | c7324d131df0a85effbc548e1ee35446aff25fdd /src | |
| parent | Fix angle constrain, thanks to vlada, Mc and LiamW (diff) | |
| parent | Move a header place (diff) | |
| download | inkscape-218c1acafd09c2b2469db082cf6e389869f9c48e.tar.gz inkscape-218c1acafd09c2b2469db082cf6e389869f9c48e.zip | |
Update to trunk
(bzr r15142.1.30)
Diffstat (limited to 'src')
| -rw-r--r-- | src/display/curve.cpp | 12 | ||||
| -rw-r--r-- | src/display/curve.h | 1 | ||||
| -rw-r--r-- | src/display/drawing-shape.cpp | 4 | ||||
| -rw-r--r-- | src/live_effects/lpe-bounding-box.cpp | 1 | ||||
| -rw-r--r-- | src/live_effects/lpe-fill-between-many.cpp | 3 | ||||
| -rw-r--r-- | src/object-set.cpp | 4 | ||||
| -rw-r--r-- | src/object-set.h | 3 | ||||
| -rw-r--r-- | src/selection-chemistry.cpp | 6 | ||||
| -rw-r--r-- | src/sp-factory.cpp | 6 | ||||
| -rw-r--r-- | src/sp-item.cpp | 11 | ||||
| -rw-r--r-- | src/sp-item.h | 1 | ||||
| -rw-r--r-- | src/sp-object.cpp | 5 | ||||
| -rw-r--r-- | src/sp-object.h | 5 | ||||
| -rw-r--r-- | src/ui/clipboard.cpp | 43 | ||||
| -rw-r--r-- | src/ui/dialog/align-and-distribute.cpp | 2 | ||||
| -rw-r--r-- | src/ui/dialog/livepatheffect-editor.cpp | 4 | ||||
| -rw-r--r-- | src/ui/tools/freehand-base.cpp | 11 | ||||
| -rw-r--r-- | src/ui/tools/pen-tool.cpp | 48 | ||||
| -rw-r--r-- | src/ui/tools/pencil-tool.cpp | 4 | ||||
| -rw-r--r-- | src/verbs.cpp | 2 | ||||
| -rw-r--r-- | src/widgets/eek-preview.cpp | 36 |
21 files changed, 122 insertions, 90 deletions
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 @@ -302,6 +302,18 @@ SPCurve::is_empty() const } /** + * 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/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); 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::LineSegment>(Geom::Point(bbox->right(), bbox->bottom())); p.appendNew<Geom::LineSegment>(Geom::Point(bbox->left(), bbox->bottom())); p.appendNew<Geom::LineSegment>(Geom::Point(bbox->left(), bbox->top())); + p.close(); Geom::PathVector out; out.push_back(p); curve->set_pathvector(out); 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); } 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/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<random_access>() | 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) {}; 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<SPItem*> const &items) Geom::OptRect r; for (std::vector<SPItem*>::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<SPItem *>(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<SPItem *>(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-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: <meshPatch> and <meshRow> have been renamed <meshpatch> and <meshrow>" << 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") 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/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..9abbd324b 100644 --- a/src/sp-object.h +++ b/src/sp-object.h @@ -1,6 +1,7 @@ #ifndef SP_OBJECT_H_SEEN #define SP_OBJECT_H_SEEN + /* * Authors: * Lauris Kaplinski <lauris@kaplinski.com> @@ -14,6 +15,8 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#include <glibmm/ustring.h> + /* SPObject flags */ class SPObject; @@ -878,7 +881,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 0a671cc8a..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" @@ -688,7 +689,25 @@ 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"); @@ -720,14 +739,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 +795,6 @@ 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); - } - } - } - } - // For 3D boxes, copy perspectives { SPBox3D *box = dynamic_cast<SPBox3D *>(item); 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))) { diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp index b97b0e63a..9bd4c093e 100644 --- a/src/ui/dialog/livepatheffect-editor.cpp +++ b/src/ui/dialog/livepatheffect-editor.cpp @@ -546,8 +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 - if (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; 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(); 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<Geom::CubicBezier const*>(&*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); 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..."), 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; |
