diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2013-10-12 21:25:39 +0000 |
|---|---|---|
| committer | Jabiertxof <jtx@jtx.marker.es> | 2013-10-12 21:25:39 +0000 |
| commit | eab1eef70ec00e5048b522b6c7f4189615caac87 (patch) | |
| tree | 4d8d574ad9741174e0d99077f234fd41231b08e7 /src | |
| parent | fix bsplines (diff) | |
| parent | Fix crash with experimental lpe tool. (diff) | |
| download | inkscape-eab1eef70ec00e5048b522b6c7f4189615caac87.tar.gz inkscape-eab1eef70ec00e5048b522b6c7f4189615caac87.zip | |
Update to trunk
(bzr r11950.1.180)
Diffstat (limited to 'src')
42 files changed, 498 insertions, 535 deletions
diff --git a/src/2geom/convex-cover.h b/src/2geom/convex-cover.h index a0443e9dc..a5f95a5fb 100644 --- a/src/2geom/convex-cover.h +++ b/src/2geom/convex-cover.h @@ -163,7 +163,7 @@ unsigned find_bottom_right(ConvexHull const &a); /*** Arbitrary transform operator. * Take a convex hull and apply an arbitrary convexity preserving transform. - * we should be concerned about singular tranforms here. + * we should be concerned about singular transforms here. */ template <class T> ConvexHull operator*(ConvexHull const &p, T const &m) { ConvexHull pr; diff --git a/src/Makefile.am b/src/Makefile.am index a45a33932..411e3cf86 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -266,7 +266,7 @@ TESTS = $(check_PROGRAMS) ../share/extensions/test/run-all-extension-tests XFAIL_TESTS = $(check_PROGRAMS) -# including the the testsuites here ensures that they get distributed +# including the testsuites here ensures that they get distributed cxxtests_SOURCES = cxxtests.cpp $(CXXTEST_TESTSUITES) $(ink_common_sources) $(win32_sources) cxxtests_LDADD = $(all_libs) diff --git a/src/arc-context.cpp b/src/arc-context.cpp index 046541b9b..dc869ce60 100644 --- a/src/arc-context.cpp +++ b/src/arc-context.cpp @@ -363,7 +363,7 @@ void SPArcContext::drag(Geom::Point pt, guint state) { // Set style sp_desktop_apply_style_tool(desktop, repr, "/tools/shapes/arc", false); - this->arc = SP_ARC(desktop->currentLayer()->appendChildRepr(repr)); + this->arc = SP_GENERICELLIPSE(desktop->currentLayer()->appendChildRepr(repr)); Inkscape::GC::release(repr); this->arc->transform = SP_ITEM(desktop->currentLayer())->i2doc_affine().inverse(); this->arc->updateRepr(); @@ -409,9 +409,9 @@ void SPArcContext::drag(Geom::Point pt, guint state) { } } - this->arc->sp_arc_position_set( - r.midpoint()[Geom::X], r.midpoint()[Geom::Y], - r.dimensions()[Geom::X] / 2, r.dimensions()[Geom::Y] / 2); + this->arc->position_set( + r.midpoint()[Geom::X], r.midpoint()[Geom::Y], + r.dimensions()[Geom::X] / 2, r.dimensions()[Geom::Y] / 2); double rdimx = r.dimensions()[Geom::X]; double rdimy = r.dimensions()[Geom::Y]; diff --git a/src/arc-context.h b/src/arc-context.h index 56eb02943..6a0a6c071 100644 --- a/src/arc-context.h +++ b/src/arc-context.h @@ -41,7 +41,7 @@ public: virtual const std::string& getPrefsPath(); private: - SPArc *arc; + SPGenericEllipse *arc; Geom::Point center; diff --git a/src/connector-context.cpp b/src/connector-context.cpp index 3d6a4f28e..99239533d 100644 --- a/src/connector-context.cpp +++ b/src/connector-context.cpp @@ -50,7 +50,7 @@ * changed so that it no longer defines special attributes to record * the points. Instead it uses single node paths to define points * who are then seperate objects that can be fixed on the canvas, - * grouped into objects and take full advantage of all tranform, snap + * grouped into objects and take full advantage of all transform, snap * and align functionality of all other objects. * * I think that the style change between polyline and orthogonal diff --git a/src/display/drawing-item.cpp b/src/display/drawing-item.cpp index 69adcb441..a8257e6e5 100644 --- a/src/display/drawing-item.cpp +++ b/src/display/drawing-item.cpp @@ -459,7 +459,7 @@ struct MaskLuminanceToAlpha { /** * Rasterize items. * This method submits the drawing opeartions required to draw this item - * to the supplied DrawingContext, restricting drawing the the specified area. + * to the supplied DrawingContext, restricting drawing the specified area. * * This method does some common tasks and calls the item-specific rendering * function, _renderItem(), to render e.g. paths or bitmaps. diff --git a/src/extension/extension.h b/src/extension/extension.h index 079276936..1fb8bdfec 100644 --- a/src/extension/extension.h +++ b/src/extension/extension.h @@ -144,12 +144,12 @@ private: extension */ public: - /** \brief A function to get the the number of parameters that + /** \brief A function to get the number of parameters that the extension has. \return The number of parameters. */ unsigned int param_count ( ) { return parameters == NULL ? 0 : g_slist_length(parameters); }; - /** \brief A function to get the the number of parameters that + /** \brief A function to get the number of parameters that are visible to the user that the extension has. \return The number of visible parameters. diff --git a/src/extension/internal/emf-inout.cpp b/src/extension/internal/emf-inout.cpp index 4bca9dfd9..90ab763e0 100644 --- a/src/extension/internal/emf-inout.cpp +++ b/src/extension/internal/emf-inout.cpp @@ -321,7 +321,7 @@ Emf::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *filena } -/* given the transformation matrix from worldTranform return the scale in the matrix part. Assumes that the +/* given the transformation matrix from worldTransform return the scale in the matrix part. Assumes that the matrix is not used to skew, invert, or make another distorting transformation. */ double Emf::current_scale(PEMF_CALLBACK_DATA d){ double scale = @@ -332,7 +332,7 @@ double Emf::current_scale(PEMF_CALLBACK_DATA d){ return(scale); } -/* given the transformation matrix from worldTranform and the current x,y position in inkscape coordinates, +/* given the transformation matrix from worldTransform and the current x,y position in inkscape coordinates, generate an SVG transform that gives the same amount of rotation, no scaling, and maps x,y back onto x,y. This is used for rotating objects when the location of at least one point in that object is known. Returns: "matrix(a,b,c,d,e,f)" (WITH the double quotes) @@ -359,7 +359,7 @@ std::string Emf::current_matrix(PEMF_CALLBACK_DATA d, double x, double y, int us return(cxform.str()); } -/* given the transformation matrix from worldTranform return the rotation angle in radians. +/* given the transformation matrix from worldTransform return the rotation angle in radians. counter clocwise from the x axis. */ double Emf::current_rotation(PEMF_CALLBACK_DATA d){ return -std::atan2(d->dc[d->level].worldTransform.eM12, d->dc[d->level].worldTransform.eM11); diff --git a/src/extension/internal/text_reassemble.c b/src/extension/internal/text_reassemble.c index 9ed6c9c3a..cd84910fc 100644 --- a/src/extension/internal/text_reassemble.c +++ b/src/extension/internal/text_reassemble.c @@ -1015,7 +1015,7 @@ int cxinfo_make_insertable(CX_INFO *cxi){ \brief Insert a complex into the CX_INFO structure. (Insert may be either TR_TEXT or TR_LINE.) \returns 0 on success, !0 on error. \param cxi pointer to the CX_INFO structure (complexes). - \param src index of the the complex to insert. + \param src index of the complex to insert. \param src_rt_tidx index of the bounding rectangle \param type TR_TEXT (index is for tpi->chunks[]) or TR_LINE (index is for cxi->kids[]) */ diff --git a/src/extension/internal/wmf-inout.cpp b/src/extension/internal/wmf-inout.cpp index 78fcdb66d..aab98dc87 100644 --- a/src/extension/internal/wmf-inout.cpp +++ b/src/extension/internal/wmf-inout.cpp @@ -320,12 +320,12 @@ Wmf::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *filena } -/* WMF has no worldTranform, so this always returns 1.0. Retain it to keep WMF and WMF in sync as much as possible.*/ +/* WMF has no worldTransform, so this always returns 1.0. Retain it to keep WMF and WMF in sync as much as possible.*/ double Wmf::current_scale(PWMF_CALLBACK_DATA d){ return 1.0; } -/* WMF has no worldTranform, so this always returns an Identity rotation matrix, but the offsets may have values.*/ +/* WMF has no worldTransform, so this always returns an Identity rotation matrix, but the offsets may have values.*/ std::string Wmf::current_matrix(PWMF_CALLBACK_DATA d, double x, double y, int useoffset){ std::stringstream cxform; double scale = current_scale(d); @@ -340,7 +340,7 @@ std::string Wmf::current_matrix(PWMF_CALLBACK_DATA d, double x, double y, int us return(cxform.str()); } -/* WMF has no worldTranform, so this always returns 0. Retain it to keep WMF and WMF in sync as much as possible.*/ +/* WMF has no worldTransform, so this always returns 0. Retain it to keep WMF and WMF in sync as much as possible.*/ double Wmf::current_rotation(PWMF_CALLBACK_DATA d){ return 0.0; } diff --git a/src/knotholder.cpp b/src/knotholder.cpp index 9abba83d7..7129348c2 100644 --- a/src/knotholder.cpp +++ b/src/knotholder.cpp @@ -242,7 +242,7 @@ KnotHolder::knot_ungrabbed_handler(SPKnot */*knot*/) void KnotHolder::add(KnotHolderEntity *e) { - g_message("Adding a knot at %p", e); + // g_message("Adding a knot at %p", e); entity.push_back(e); updateControlSizes(); } diff --git a/src/libavoid/router.cpp b/src/libavoid/router.cpp index ab13a981b..35f921bb4 100644 --- a/src/libavoid/router.cpp +++ b/src/libavoid/router.cpp @@ -58,13 +58,17 @@ class ActionInfo { } ActionInfo(ActionType t, ShapeRef *s) : type(t), - objPtr(s) + objPtr(s), + newPoly(), + firstMove(0) { COLA_ASSERT(type != ConnChange); } ActionInfo(ActionType t, ConnRef *c) : type(t), - objPtr(c) + objPtr(c), + newPoly(), + firstMove(0) { COLA_ASSERT(type == ConnChange); } diff --git a/src/libcola/gradient_projection.h b/src/libcola/gradient_projection.h index 66fc37aba..8cf45586c 100644 --- a/src/libcola/gradient_projection.h +++ b/src/libcola/gradient_projection.h @@ -225,7 +225,7 @@ public: delete [] g; delete [] d; delete [] old_place; - for(Constraints::iterator i(gcs.begin()); i!=gcs.end(); i++) { + for(Constraints::iterator i(gcs.begin()); i!=gcs.end(); ++i) { delete *i; } gcs.clear(); diff --git a/src/libcroco/cr-num.c b/src/libcroco/cr-num.c index c714894d6..062784c84 100644 --- a/src/libcroco/cr-num.c +++ b/src/libcroco/cr-num.c @@ -91,15 +91,13 @@ cr_num_new_with_val (gdouble a_val, enum CRNumType a_type) guchar * cr_num_to_string (CRNum * a_this) { - gdouble test_val = 0.0; - guchar *tmp_char1 = NULL, *tmp_char2 = NULL, *result = NULL; g_return_val_if_fail (a_this, NULL); - test_val = a_this->val - (glong) a_this->val; + gdouble test_val = a_this->val - (glong) a_this->val; if (!test_val) { tmp_char1 = (guchar *)g_strdup_printf ("%ld", (glong) a_this->val); diff --git a/src/libcroco/cr-parser.c b/src/libcroco/cr-parser.c index 917c5cb60..410f8f80f 100644 --- a/src/libcroco/cr-parser.c +++ b/src/libcroco/cr-parser.c @@ -3235,7 +3235,7 @@ cr_parser_parse_statement_core (CRParser * a_this) *ruleset ::= selector [ ',' S* selector ]* *'{' S* declaration? [ ';' S* declaration? ]* '}' S*; * - *This methods calls the the SAC handler on the relevant SAC handler + *This methods calls the SAC handler on the relevant SAC handler *callbacks whenever it encounters some specific constructions. *See the documentation of #CRDocHandler (the SAC handler) to know *when which SAC handler is called. diff --git a/src/libcroco/cr-rgb.c b/src/libcroco/cr-rgb.c index 893c2080b..e0c28701a 100644 --- a/src/libcroco/cr-rgb.c +++ b/src/libcroco/cr-rgb.c @@ -365,7 +365,7 @@ cr_rgb_is_set_to_inherit (CRRgb *a_this) } /** - *Tests if the the rgb is set to the + *Tests if the rgb is set to the *value "transparent" or not. *@param a_this the current instance of *#CRRgb diff --git a/src/libcroco/cr-sel-eng.c b/src/libcroco/cr-sel-eng.c index f010efea0..266191e82 100644 --- a/src/libcroco/cr-sel-eng.c +++ b/src/libcroco/cr-sel-eng.c @@ -839,7 +839,7 @@ cr_sel_eng_get_matched_rulesets_real (CRSelEng * a_this, sel_list = NULL; /* - *get the the damn selector list in + *get the damn selector list in *which we have to look */ switch (cur_stmt->type) { diff --git a/src/libcroco/cr-statement.c b/src/libcroco/cr-statement.c index 2b2c1836c..147cc8347 100644 --- a/src/libcroco/cr-statement.c +++ b/src/libcroco/cr-statement.c @@ -1907,7 +1907,7 @@ cr_statement_ruleset_set_sel_list (CRStatement * a_this, *Gets a pointer to the list of declaration contained *in the ruleset statement. *@param a_this the current instance of #CRStatement. - *@a_decl_list out parameter. A pointer to the the returned + *@a_decl_list out parameter. A pointer to the returned *list of declaration. Must not be NULL. *@return CR_OK upon successfull completion, an error code if something *bad happened. diff --git a/src/libcroco/cr-style.c b/src/libcroco/cr-style.c index e0abba83a..a9c5a5cec 100644 --- a/src/libcroco/cr-style.c +++ b/src/libcroco/cr-style.c @@ -36,7 +36,7 @@ *Each supported css property has an ID which is *an entry into a property "population" jump table. *each entry of the property population jump table - *contains code to tranform the literal form of + *contains code to transform the literal form of *a property value into a strongly typed value. */ enum CRPropertyID { @@ -148,7 +148,7 @@ static CRPropertyDesc gv_prop_table[] = { /** *A the key/value pair of this hash table *are: - *key => name of the the css propertie found in gv_prop_table + *key => name of the css property found in gv_prop_table *value => matching property id found in gv_prop_table. *So this hash table is here just to retrieval of a property id *from a property name. diff --git a/src/libcroco/cr-term.c b/src/libcroco/cr-term.c index 635577334..ccdff2522 100644 --- a/src/libcroco/cr-term.c +++ b/src/libcroco/cr-term.c @@ -766,7 +766,7 @@ cr_term_unref (CRTerm * a_this) } /** - *The destructor of the the #CRTerm class. + *The destructor of the #CRTerm class. *@param a_this the "this pointer" of the current instance *of #CRTerm. */ diff --git a/src/libdepixelize/kopftracer2011.cpp b/src/libdepixelize/kopftracer2011.cpp index 95f91fdcb..ab31d05c3 100644 --- a/src/libdepixelize/kopftracer2011.cpp +++ b/src/libdepixelize/kopftracer2011.cpp @@ -336,8 +336,7 @@ inline int Heuristics::curves(const PixelGraph &graph, { // There are only two values that won't be zero'ed // and one of them has the same value of prev - guintptr aux = guintptr(to_ptr(it)); - aux = (it->adj.top + guintptr aux = (it->adj.top * guintptr(to_ptr(graph.nodeTop(it)))) + (it->adj.topright * guintptr(to_ptr(graph.nodeTopRight(it)))) diff --git a/src/lpe-tool-context.cpp b/src/lpe-tool-context.cpp index edc9a6930..0b71a892c 100644 --- a/src/lpe-tool-context.cpp +++ b/src/lpe-tool-context.cpp @@ -191,8 +191,7 @@ bool SPLPEToolContext::root_handler(GdkEvent* event) { if (sp_pen_context_has_waiting_LPE(this)) { // quit when we are waiting for a LPE to be applied //ret = ((SPEventContextClass *) sp_lpetool_context_parent_class)->root_handler(event_context, event); - ret = this->root_handler(event); - return ret; + return SPPenContext::root_handler(event); } switch (event->type) { @@ -224,7 +223,7 @@ bool SPLPEToolContext::root_handler(GdkEvent* event) { // we pass the mouse click on to pen tool as the first click which it should collect //ret = ((SPEventContextClass *) sp_lpetool_context_parent_class)->root_handler(event_context, event); - ret = this->root_handler(event); + ret = SPPenContext::root_handler(event); } break; diff --git a/src/marker.cpp b/src/marker.cpp index 45188b4a4..50e7c970f 100644 --- a/src/marker.cpp +++ b/src/marker.cpp @@ -319,7 +319,7 @@ void SPMarker::update(SPCtx *ctx, guint flags) { // Copy parent context rctx.flags = ctx->flags; - // Initialize tranformations + // Initialize transformations rctx.i2doc = Geom::identity(); rctx.i2vp = Geom::identity(); diff --git a/src/object-edit.cpp b/src/object-edit.cpp index 2021b91f5..e9b183eca 100644 --- a/src/object-edit.cpp +++ b/src/object-edit.cpp @@ -69,7 +69,7 @@ KnotHolder *createKnotHolder(SPItem *item, SPDesktop *desktop) knotholder = new RectKnotHolder(desktop, item, NULL); } else if (SP_IS_BOX3D(item)) { knotholder = new Box3DKnotHolder(desktop, item, NULL); - } else if (SP_IS_ARC(item)) { + } else if (SP_IS_GENERICELLIPSE(item)) { knotholder = new ArcKnotHolder(desktop, item, NULL); } else if (SP_IS_STAR(item)) { knotholder = new StarKnotHolder(desktop, item, NULL); @@ -787,7 +787,7 @@ ArcKnotHolderEntityStart::knot_set(Geom::Point const &p, Geom::Point const &/*or { int snaps = Inkscape::Preferences::get()->getInt("/options/rotationsnapsperpi/value", 12); - SPArc *arc = SP_ARC(item); + SPGenericEllipse *arc = SP_GENERICELLIPSE(item); arc->setClosed(sp_genericellipse_side(arc, p) == -1); @@ -808,9 +808,8 @@ Geom::Point ArcKnotHolderEntityStart::knot_get() const { SPGenericEllipse const *ge = SP_GENERICELLIPSE(item); - SPArc *arc = SP_ARC(item); - return arc->getPointAtAngle(ge->start); + return ge->getPointAtAngle(ge->start); } void @@ -829,7 +828,7 @@ ArcKnotHolderEntityEnd::knot_set(Geom::Point const &p, Geom::Point const &/*orig { int snaps = Inkscape::Preferences::get()->getInt("/options/rotationsnapsperpi/value", 12); - SPArc *arc = SP_ARC(item); + SPGenericEllipse *arc = SP_GENERICELLIPSE(item); arc->setClosed(sp_genericellipse_side(arc, p) == -1); @@ -850,9 +849,8 @@ Geom::Point ArcKnotHolderEntityEnd::knot_get() const { SPGenericEllipse const *ge = SP_GENERICELLIPSE(item); - SPArc *arc = SP_ARC(item); - return arc->getPointAtAngle(ge->end); + return ge->getPointAtAngle(ge->end); } diff --git a/src/object-snapper.cpp b/src/object-snapper.cpp index 3f3f0c1bf..de50f0dd8 100644 --- a/src/object-snapper.cpp +++ b/src/object-snapper.cpp @@ -538,7 +538,7 @@ void Inkscape::ObjectSnapper::_snapPaths(IntermSnapResults &isr, * - Linking the individual nodes of the SPPath we have here, to the nodes of the NodePath::SubPath class as being * used in sp_nodepath_selected_nodes_move. This class has a member variable called "selected". For this the nodes * should be in the exact same order for both classes, so we can index them - * - Replacing the SPPath being used here by the the NodePath::SubPath class; but how? + * - Replacing the SPPath being used here by the NodePath::SubPath class; but how? */ } diff --git a/src/pencil-context.cpp b/src/pencil-context.cpp index 9869b0756..74c718580 100644 --- a/src/pencil-context.cpp +++ b/src/pencil-context.cpp @@ -80,19 +80,19 @@ const std::string& SPPencilContext::getPrefsPath() { const std::string SPPencilContext::prefsPath = "/tools/freehand/pencil"; -SPPencilContext::SPPencilContext() : SPDrawContext() { - this->is_drawing = false; - +SPPencilContext::SPPencilContext() : + SPDrawContext(), + p(), + npoints(0), + state(SP_PENCIL_CONTEXT_IDLE), + req_tangent(0,0), + is_drawing(false), + ps(), + sketch_interpolation(Geom::Piecewise<Geom::D2<Geom::SBasis> >())// since SPPencilContext is not properly constructed... +{ this->cursor_shape = cursor_pencil_xpm; this->hot_x = 4; this->hot_y = 4; - - this->npoints = 0; - this->state = SP_PENCIL_CONTEXT_IDLE; - this->req_tangent = Geom::Point(0, 0); - - // since SPPencilContext is not properly constructed... - this->sketch_interpolation = Geom::Piecewise<Geom::D2<Geom::SBasis> >(); this->sketch_n = 0; } diff --git a/src/pixmaps/cursor-node-d.xpm b/src/pixmaps/cursor-node-d.xpm index 264da58c3..7e177bff4 100644 --- a/src/pixmaps/cursor-node-d.xpm +++ b/src/pixmaps/cursor-node-d.xpm @@ -1,9 +1,9 @@ /* XPM */ static char const *cursor_node_d_xpm[] = { "32 32 3 1", -" g None", -". g #ffffff", -"+ g #000000", +" c None", +". c #FFFFFF", +"+ c #000000", " . ", ".+. ", " .+. ", diff --git a/src/registrytool.cpp b/src/registrytool.cpp index 01a83a7e0..51c1063ef 100644 --- a/src/registrytool.cpp +++ b/src/registrytool.cpp @@ -142,7 +142,7 @@ bool RegistryTool::setPathInfo() // fullPath.c_str(), path.c_str(), exeName.c_str()); Glib::ustring keyName = - "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\"; + "HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\"; keyName.append(exeName); Glib::ustring valueName = ""; diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index 49a731b15..5463c3f94 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -1032,7 +1032,8 @@ void sp_selection_lower(Inkscape::Selection *selection, SPDesktop *desktop) } DocumentUndo::done(selection->layers()->getDocument(), SP_VERB_SELECTION_LOWER, - _("Lower")); + //TRANSLATORS: "Lower" means "to lower an object" in the undo history + C_("Undo action", "Lower")); } void sp_selection_lower_to_bottom(Inkscape::Selection *selection, SPDesktop *desktop) @@ -1915,8 +1916,8 @@ static bool item_type_match (SPItem *i, SPItem *j) if ( SP_IS_RECT(i)) { return ( SP_IS_RECT(j) ); - } else if (SP_IS_GENERICELLIPSE(i) || SP_IS_ELLIPSE(i) || SP_IS_ARC(i) || SP_IS_CIRCLE(i)) { - return (SP_IS_GENERICELLIPSE(j) || SP_IS_ELLIPSE(j) || SP_IS_ARC(j) || SP_IS_CIRCLE(j)); + } else if (SP_IS_GENERICELLIPSE(i)) { + return (SP_IS_GENERICELLIPSE(j)); } else if (SP_IS_STAR(i) || SP_IS_POLYGON(i)) { return (SP_IS_STAR(j) || SP_IS_POLYGON(j)) ; diff --git a/src/sp-ellipse.cpp b/src/sp-ellipse.cpp index 06201859f..8a0a8f233 100644 --- a/src/sp-ellipse.cpp +++ b/src/sp-ellipse.cpp @@ -9,6 +9,7 @@ * * Copyright (C) 1999-2002 Lauris Kaplinski * Copyright (C) 2000-2001 Ximian, Inc. + * Copyright (C) 2013 Tavmjong Bah * * Released under GNU GPL, read the file 'COPYING' for more information */ @@ -39,17 +40,23 @@ namespace { SPObject *create_ellipse() { - return new SPEllipse(); + SPGenericEllipse *ellipse = new SPGenericEllipse(); + ellipse->type = SP_GENERIC_ELLIPSE_ELLIPSE; + return (SPObject*)ellipse; } SPObject *create_circle() { - return new SPCircle(); + SPGenericEllipse *circle = new SPGenericEllipse(); + circle->type = SP_GENERIC_ELLIPSE_CIRCLE; + return (SPObject*)circle; } SPObject *create_arc() { - return new SPArc(); + SPGenericEllipse *arc = new SPGenericEllipse(); + arc->type = SP_GENERIC_ELLIPSE_ARC; + return (SPObject*)arc; } bool ellipse_registered = SPFactory::instance().registerObject("svg:ellipse", create_ellipse); @@ -68,6 +75,7 @@ SPGenericEllipse::SPGenericEllipse() : SPShape() , start(0) , end(SP_2PI) + , type(SP_GENERIC_ELLIPSE_UNDEFINED) , _closed(true) { } @@ -76,16 +84,120 @@ SPGenericEllipse::~SPGenericEllipse() { } +void SPGenericEllipse::setClosed(bool value) { + _closed = value; +} + bool SPGenericEllipse::closed() { return _closed; } -void SPGenericEllipse::setClosed(bool value) { - _closed = value; +void SPGenericEllipse::build(SPDocument *document, Inkscape::XML::Node *repr) +{ + // std::cout << "SPGenericEllipse::build: Entrance: " << this->type + // << " (" << g_quark_to_string(repr->code()) << ")" << std::endl; + + switch ( type ) { + case SP_GENERIC_ELLIPSE_ARC: + this->readAttr("sodipodi:cx"); + this->readAttr("sodipodi:cy"); + this->readAttr("sodipodi:rx"); + this->readAttr("sodipodi:ry"); + this->readAttr("sodipodi:start"); + this->readAttr("sodipodi:end"); + this->readAttr("sodipodi:open"); + break; + + case SP_GENERIC_ELLIPSE_CIRCLE: + this->readAttr("cx"); + this->readAttr("cy"); + this->readAttr("r"); + break; + + case SP_GENERIC_ELLIPSE_ELLIPSE: + this->readAttr("cx"); + this->readAttr("cy"); + this->readAttr("rx"); + this->readAttr("ry"); + break; + + default: + std::cerr << "SPGenericEllipse::build() unknown defined type." << std::endl; + } + + SPShape::build(document, repr); +} + +void SPGenericEllipse::set(unsigned int key, gchar const *value) +{ + // There are multiple ways to set internal cx, cy, rx, and ry (via SVG attributes or Sodipodi + // attributes) thus we don't want to unset them if a read fails (e.g., when we explicitly clear + // an attribute by setting it to NULL). + SVGLength t; + switch (key) { + case SP_ATTR_CX: + case SP_ATTR_SODIPODI_CX: + if( t.read(value) ) cx = t; + this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); + break; + + case SP_ATTR_CY: + case SP_ATTR_SODIPODI_CY: + if( t.read(value) ) cy = t; + this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); + break; + + case SP_ATTR_RX: + case SP_ATTR_SODIPODI_RX: + if( t.read(value) && t.value > 0.0 ) this->rx = t; + this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); + break; + + case SP_ATTR_RY: + case SP_ATTR_SODIPODI_RY: + if( t.read(value) && t.value > 0.0 ) this->ry = t; + this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); + break; + + case SP_ATTR_R: + if( t.read(value) && t.value > 0.0 ) { + this->ry = this->rx = t; + } + this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); + break; + + case SP_ATTR_SODIPODI_START: + if (value) { + sp_svg_number_read_d(value, &this->start); + } else { + this->start = 0; + } + this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); + break; + + case SP_ATTR_SODIPODI_END: + if (value) { + sp_svg_number_read_d(value, &this->end); + } else { + this->end = 2 * M_PI; + } + this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); + break; + + case SP_ATTR_SODIPODI_OPEN: + this->_closed = (!value); + this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); + break; + + default: + SPShape::set(key, value); + break; + } } void SPGenericEllipse::update(SPCtx *ctx, guint flags) { + // std::cout << "\nSPGenericEllipse::update: Entrance" << std::endl; if (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG | SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) { Geom::Rect const &viewbox = ((SPItemCtx const *) ctx)->viewport; @@ -104,36 +216,185 @@ void SPGenericEllipse::update(SPCtx *ctx, guint flags) } SPShape::update(ctx, flags); + // std::cout << "SPGenericEllipse::update: Exit\n" << std::endl; } -void SPGenericEllipse::update_patheffect(bool write) +Inkscape::XML::Node *SPGenericEllipse::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { - this->set_shape(); + // std::cout << "\nSPGenericEllipse::write: Entrance (" + // << (repr == NULL ? " NULL" : g_quark_to_string(repr->code())) + // << ")" << std::endl; - if (write) { - Inkscape::XML::Node *repr = this->getRepr(); + GenericEllipseType new_type = SP_GENERIC_ELLIPSE_UNDEFINED; + if (this->_isSlice() || hasPathEffect() ) { + new_type = SP_GENERIC_ELLIPSE_ARC; + } else if ( rx.computed == ry.computed ) { + new_type = SP_GENERIC_ELLIPSE_CIRCLE; + } else { + new_type = SP_GENERIC_ELLIPSE_ELLIPSE; + } + // std::cout << " new_type: " << new_type << std::endl; - if (this->_curve != NULL) { - gchar *str = sp_svg_write_path(this->_curve->get_pathvector()); - repr->setAttribute("d", str); - g_free(str); - } else { - repr->setAttribute("d", NULL); + if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { + + switch ( new_type ) { + + case SP_GENERIC_ELLIPSE_ARC: + repr = xml_doc->createElement("svg:path"); + break; + case SP_GENERIC_ELLIPSE_CIRCLE: + repr = xml_doc->createElement("svg:circle"); + break; + case SP_GENERIC_ELLIPSE_ELLIPSE: + repr = xml_doc->createElement("svg:ellipse"); + break; + case SP_GENERIC_ELLIPSE_UNDEFINED: + default: + std::cerr << "SPGenericEllipse::write(): unknown type." << std::endl; } } - this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); + if( type != new_type ) { + switch( new_type ) { + case SP_GENERIC_ELLIPSE_ARC: + repr->setCodeUnsafe(g_quark_from_string("svg:path")); + break; + case SP_GENERIC_ELLIPSE_CIRCLE: + repr->setCodeUnsafe(g_quark_from_string("svg:circle")); + break; + case SP_GENERIC_ELLIPSE_ELLIPSE: + repr->setCodeUnsafe(g_quark_from_string("svg:ellipse")); + break; + default: + std::cerr << "SPGenericEllipse::write(): unknown type." << std::endl; + } + type = new_type; + + // FIXME: The XML dialog won't update the element name. We need + // a notifyElementNameChanged callback added to the XML observers + // to trigger a refresh. + } + + // std::cout << " type: " << g_quark_to_string( repr->code() ) << std::endl; + // std::cout << " cx: " << cx.computed + // << " cy: " << cy.computed + // << " rx: " << rx.computed + // << " ry: " << ry.computed << std::endl; + + switch ( type ) { + case SP_GENERIC_ELLIPSE_UNDEFINED: + case SP_GENERIC_ELLIPSE_ARC: + + repr->setAttribute("cx", NULL ); + repr->setAttribute("cy", NULL ); + repr->setAttribute("rx", NULL ); + repr->setAttribute("ry", NULL ); + repr->setAttribute("r", NULL ); + + if (flags & SP_OBJECT_WRITE_EXT) { + + repr->setAttribute("sodipodi:type", "arc"); + sp_repr_set_svg_double(repr, "sodipodi:cx", this->cx.computed); + sp_repr_set_svg_double(repr, "sodipodi:cy", this->cy.computed); + sp_repr_set_svg_double(repr, "sodipodi:rx", this->rx.computed); + sp_repr_set_svg_double(repr, "sodipodi:ry", this->ry.computed); + + // write start and end only if they are non-trivial; otherwise remove + if (this->_isSlice()) { + sp_repr_set_svg_double(repr, "sodipodi:start", this->start); + sp_repr_set_svg_double(repr, "sodipodi:end", this->end); + + repr->setAttribute("sodipodi:open", (!this->_closed) ? "true" : NULL); + } else { + repr->setAttribute("sodipodi:end", NULL); + repr->setAttribute("sodipodi:start", NULL); + repr->setAttribute("sodipodi:open", NULL); + } + } + + // write d= + this->set_elliptical_path_attribute(repr); + break; + + case SP_GENERIC_ELLIPSE_CIRCLE: + sp_repr_set_svg_double(repr, "cx", this->cx.computed); + sp_repr_set_svg_double(repr, "cy", this->cy.computed); + sp_repr_set_svg_double(repr, "r", this->rx.computed); + repr->setAttribute("rx", NULL ); + repr->setAttribute("ry", NULL ); + repr->setAttribute("sodipodi:cx", NULL ); + repr->setAttribute("sodipodi:cy", NULL ); + repr->setAttribute("sodipodi:rx", NULL ); + repr->setAttribute("sodipodi:ry", NULL ); + repr->setAttribute("sodipodi:end", NULL ); + repr->setAttribute("sodipodi:start", NULL ); + repr->setAttribute("sodipodi:open", NULL ); + repr->setAttribute("sodipodi:type", NULL ); + repr->setAttribute("d", NULL ); + break; + + case SP_GENERIC_ELLIPSE_ELLIPSE: + sp_repr_set_svg_double(repr, "cx", this->cx.computed); + sp_repr_set_svg_double(repr, "cy", this->cy.computed); + sp_repr_set_svg_double(repr, "rx", this->rx.computed); + sp_repr_set_svg_double(repr, "ry", this->ry.computed); + repr->setAttribute("r", NULL ); + repr->setAttribute("sodipodi:cx", NULL ); + repr->setAttribute("sodipodi:cy", NULL ); + repr->setAttribute("sodipodi:rx", NULL ); + repr->setAttribute("sodipodi:ry", NULL ); + repr->setAttribute("sodipodi:end", NULL ); + repr->setAttribute("sodipodi:start", NULL ); + repr->setAttribute("sodipodi:open", NULL ); + repr->setAttribute("sodipodi:type", NULL ); + repr->setAttribute("d", NULL ); + break; + + default: + std::cerr << "SPGenericEllipse::write: unknown type." << std::endl; + } + + this->set_shape(); // evaluate SPCurve + + SPShape::write(xml_doc, repr, flags); + + // std::cout << "SPGenericEllipse::write: Exit: " << g_quark_to_string(repr->code()) << "\n" << std::endl; + return repr; } -bool SPGenericEllipse::_isSlice() const +const char *SPGenericEllipse::displayName() { - Geom::AngleInterval a(this->start, this->end, true); - return !(Geom::are_near(a.extent(), 0) || Geom::are_near(a.extent(), SP_2PI)); + switch ( type ) { + case SP_GENERIC_ELLIPSE_UNDEFINED: + case SP_GENERIC_ELLIPSE_ARC: + + if (this->_isSlice()) { + if (this->_closed) { + return _("Segment"); + } else { + return _("Arc"); + } + } else { + return _("Ellipse"); + } + + case SP_GENERIC_ELLIPSE_CIRCLE: + return _("Circle"); + + case SP_GENERIC_ELLIPSE_ELLIPSE: + return _("Ellipse"); + + default: + return "Unknown ellipse: ERROR"; + } + return ("Shouldn't be here"); } +// Create path for rendering shape on screen void SPGenericEllipse::set_shape() { + // std::cout << "SPGenericEllipse::set_shape: Entrance" << std::endl; if (hasBrokenPathEffect()) { g_warning("The ellipse shape has unknown LPE on it! Convert to path to make it editable preserving the appearance; editing it as ellipse will remove the bad LPE"); @@ -147,7 +408,6 @@ void SPGenericEllipse::set_shape() return; } - if (Geom::are_near(this->rx.computed, 0) || Geom::are_near(this->ry.computed, 0)) { return; } @@ -157,6 +417,7 @@ void SPGenericEllipse::set_shape() SPCurve *curve = NULL; // For simplicity, we use a circle with center (0, 0) and radius 1 for our calculations. + Geom::Circle circle(0, 0, 1); if (this->_isSlice()) { Geom::Point center(0, 0); @@ -164,8 +425,7 @@ void SPGenericEllipse::set_shape() Geom::Point end_point = Geom::Point::polar(end); Geom::Point middle_point = make_angle_bisector_ray(Geom::Ray(center, start), Geom::Ray(center, end)).versor(); - Geom::Ellipse ellipse(0, 0, 1, 1, 0); - Geom::EllipticalArc *arc = ellipse.arc(start_point, middle_point, end_point); + Geom::EllipticalArc *arc = circle.arc(start_point, middle_point, end_point); Geom::Path path(start_point); path.append(*arc); @@ -187,15 +447,39 @@ void SPGenericEllipse::set_shape() curve = new SPCurve(pb.peek()); } else { // Full ellipse - Geom::Circle circle(0, 0, 1); - Geom::PathVector path; + // This code converts the circle to four elliptical arcs explicitly. + // Circle::getPath currently creates cubic bezier curves, these are not suitable here + // as a circle should have four mid markers at 0, 90, 180, 270 degrees. + Geom::Path path; + Geom::EllipticalArc* arc; - circle.getPath(path); + arc = circle.arc(Geom::Point::polar(0), Geom::Point::polar(M_PI / 4.0), Geom::Point::polar(M_PI / 2.0)); + path.append(*arc); + delete arc; + + arc = circle.arc(Geom::Point::polar(M_PI / 2.0), Geom::Point::polar(3.0 * M_PI / 4.0), Geom::Point::polar(M_PI)); + path.append(*arc); + delete arc; + + arc = circle.arc(Geom::Point::polar(M_PI), Geom::Point::polar(5.0 * M_PI / 4.0), Geom::Point::polar(3.0 * M_PI / 2.0)); + path.append(*arc); + delete arc; + + arc = circle.arc(Geom::Point::polar(3.0 * M_PI / 2.0), Geom::Point::polar(7.0 * M_PI / 4.0), Geom::Point::polar(2.0 * M_PI)); + path.append(*arc); + delete arc; + + Geom::PathBuilder pb; + pb.append(path); + pb.closePath(); - curve = new SPCurve(path); - curve->closepath(); + curve = new SPCurve(pb.peek()); } + // gchar *str = sp_svg_write_path(curve->get_pathvector()); + // std::cout << " path: " << str << std::endl; + // g_free(str); + // Stretching / moving the calculated shape to fit the actual dimensions. Geom::Affine aff = Geom::Scale(rx.computed, ry.computed) * Geom::Translate(cx.computed, cy.computed); curve->transform(aff); @@ -217,54 +501,7 @@ void SPGenericEllipse::set_shape() } curve->unref(); -} - -void SPGenericEllipse::snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) -{ - this->normalize(); - Geom::Affine const i2dt = this->i2dt_affine(); - - // Snap to the 4 quadrant points of the ellipse, but only if the arc - // spans far enough to include them - if (snapprefs->isTargetSnappable(Inkscape::SNAPTARGET_ELLIPSE_QUADRANT_POINT)) { - for (double angle = 0; angle < SP_2PI; angle += M_PI_2) { - if (Geom::AngleInterval(this->start, this->end, true).contains(angle)) { - Geom::Point pt = this->getPointAtAngle(angle) * i2dt; - p.push_back(Inkscape::SnapCandidatePoint(pt, Inkscape::SNAPSOURCE_ELLIPSE_QUADRANT_POINT, Inkscape::SNAPTARGET_ELLIPSE_QUADRANT_POINT)); - } - } - } - - double cx = this->cx.computed; - double cy = this->cy.computed; - - bool slice = this->_isSlice(); - - // Add the centre, if we have a closed slice or when explicitly asked for - if (snapprefs->isTargetSnappable(Inkscape::SNAPTARGET_NODE_CUSP) && slice && this->_closed) { - Geom::Point pt = Geom::Point(cx, cy) * i2dt; - p.push_back(Inkscape::SnapCandidatePoint(pt, Inkscape::SNAPSOURCE_NODE_CUSP, Inkscape::SNAPTARGET_NODE_CUSP)); - } - - if (snapprefs->isTargetSnappable(Inkscape::SNAPTARGET_OBJECT_MIDPOINT)) { - Geom::Point pt = Geom::Point(cx, cy) * i2dt; - p.push_back(Inkscape::SnapCandidatePoint(pt, Inkscape::SNAPSOURCE_OBJECT_MIDPOINT, Inkscape::SNAPTARGET_OBJECT_MIDPOINT)); - } - - // And if we have a slice, also snap to the endpoints - if (snapprefs->isTargetSnappable(Inkscape::SNAPTARGET_NODE_CUSP) && slice) { - // Add the start point, if it's not coincident with a quadrant point - if (!Geom::are_near(std::fmod(this->start, M_PI_2), 0)) { - Geom::Point pt = this->getPointAtAngle(this->start) * i2dt; - p.push_back(Inkscape::SnapCandidatePoint(pt, Inkscape::SNAPSOURCE_NODE_CUSP, Inkscape::SNAPTARGET_NODE_CUSP)); - } - - // Add the end point, if it's not coincident with a quadrant point - if (!Geom::are_near(std::fmod(this->end, M_PI_2), 0)) { - Geom::Point pt = this->getPointAtAngle(this->end) * i2dt; - p.push_back(Inkscape::SnapCandidatePoint(pt, Inkscape::SNAPSOURCE_NODE_CUSP, Inkscape::SNAPTARGET_NODE_CUSP)); - } - } + // std::cout << "SPGenericEllipse::set_shape: Exit" << std::endl; } Geom::Affine SPGenericEllipse::set_transform(Geom::Affine const &xform) @@ -323,367 +560,123 @@ Geom::Affine SPGenericEllipse::set_transform(Geom::Affine const &xform) return ret; } -void SPGenericEllipse::normalize() -{ - Geom::AngleInterval a(this->start, this->end, true); - - this->start = a.initialAngle().radians0(); - this->end = a.finalAngle().radians0(); -} - -Inkscape::XML::Node *SPGenericEllipse::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) +void SPGenericEllipse::snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) { - if (flags & SP_OBJECT_WRITE_EXT) { - if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { - repr = xml_doc->createElement("svg:path"); - } - - sp_repr_set_svg_double(repr, "sodipodi:cx", this->cx.computed); - sp_repr_set_svg_double(repr, "sodipodi:cy", this->cy.computed); - sp_repr_set_svg_double(repr, "sodipodi:rx", this->rx.computed); - sp_repr_set_svg_double(repr, "sodipodi:ry", this->ry.computed); + this->normalize(); + Geom::Affine const i2dt = this->i2dt_affine(); - if (SP_IS_ARC(this)) { - SP_ARC(this)->sp_arc_set_elliptical_path_attribute(this->getRepr()); + // Snap to the 4 quadrant points of the ellipse, but only if the arc + // spans far enough to include them + if (snapprefs->isTargetSnappable(Inkscape::SNAPTARGET_ELLIPSE_QUADRANT_POINT)) { + for (double angle = 0; angle < SP_2PI; angle += M_PI_2) { + if (Geom::AngleInterval(this->start, this->end, true).contains(angle)) { + Geom::Point pt = this->getPointAtAngle(angle) * i2dt; + p.push_back(Inkscape::SnapCandidatePoint(pt, Inkscape::SNAPSOURCE_ELLIPSE_QUADRANT_POINT, Inkscape::SNAPTARGET_ELLIPSE_QUADRANT_POINT)); + } } } - this->set_shape(); // evaluate SPCurve - - SPShape::write(xml_doc, repr, flags); - - return repr; -} - -/* SVG <ellipse> element */ -SPEllipse::SPEllipse() : SPGenericEllipse() -{ -} - -SPEllipse::~SPEllipse() -{ -} - -void SPEllipse::build(SPDocument *document, Inkscape::XML::Node *repr) -{ - SPGenericEllipse::build(document, repr); - - this->readAttr("cx"); - this->readAttr("cy"); - this->readAttr("rx"); - this->readAttr("ry"); -} + double cx = this->cx.computed; + double cy = this->cy.computed; + + bool slice = this->_isSlice(); -Inkscape::XML::Node *SPEllipse::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) -{ - if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { - repr = xml_doc->createElement("svg:ellipse"); + // Add the centre, if we have a closed slice or when explicitly asked for + if (snapprefs->isTargetSnappable(Inkscape::SNAPTARGET_NODE_CUSP) && slice && this->_closed) { + Geom::Point pt = Geom::Point(cx, cy) * i2dt; + p.push_back(Inkscape::SnapCandidatePoint(pt, Inkscape::SNAPSOURCE_NODE_CUSP, Inkscape::SNAPTARGET_NODE_CUSP)); } - sp_repr_set_svg_double(repr, "cx", this->cx.computed); - sp_repr_set_svg_double(repr, "cy", this->cy.computed); - sp_repr_set_svg_double(repr, "rx", this->rx.computed); - sp_repr_set_svg_double(repr, "ry", this->ry.computed); - - SPGenericEllipse::write(xml_doc, repr, flags); - - return repr; -} - - -void SPEllipse::set(unsigned int key, gchar const *value) -{ - switch (key) { - case SP_ATTR_CX: - this->cx.readOrUnset(value); - this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); - break; - - case SP_ATTR_CY: - this->cy.readOrUnset(value); - this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); - break; + if (snapprefs->isTargetSnappable(Inkscape::SNAPTARGET_OBJECT_MIDPOINT)) { + Geom::Point pt = Geom::Point(cx, cy) * i2dt; + p.push_back(Inkscape::SnapCandidatePoint(pt, Inkscape::SNAPSOURCE_OBJECT_MIDPOINT, Inkscape::SNAPTARGET_OBJECT_MIDPOINT)); + } - case SP_ATTR_RX: - if (!this->rx.read(value) || (this->rx.value <= 0.0)) { - this->rx.unset(); + // And if we have a slice, also snap to the endpoints + if (snapprefs->isTargetSnappable(Inkscape::SNAPTARGET_NODE_CUSP) && slice) { + // Add the start point, if it's not coincident with a quadrant point + if (!Geom::are_near(std::fmod(this->start, M_PI_2), 0)) { + Geom::Point pt = this->getPointAtAngle(this->start) * i2dt; + p.push_back(Inkscape::SnapCandidatePoint(pt, Inkscape::SNAPSOURCE_NODE_CUSP, Inkscape::SNAPTARGET_NODE_CUSP)); } - this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); - break; - - case SP_ATTR_RY: - if (!this->ry.read(value) || (this->ry.value <= 0.0)) { - this->ry.unset(); + // Add the end point, if it's not coincident with a quadrant point + if (!Geom::are_near(std::fmod(this->end, M_PI_2), 0)) { + Geom::Point pt = this->getPointAtAngle(this->end) * i2dt; + p.push_back(Inkscape::SnapCandidatePoint(pt, Inkscape::SNAPSOURCE_NODE_CUSP, Inkscape::SNAPTARGET_NODE_CUSP)); } - - this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); - break; - - default: - SPGenericEllipse::set(key, value); - break; } } -const char *SPEllipse::displayName() -{ - return _("Ellipse"); -} - - -/* SVG <circle> element */ -SPCircle::SPCircle() : SPGenericEllipse() -{ -} - -SPCircle::~SPCircle() -{ -} - -void SPCircle::build(SPDocument *document, Inkscape::XML::Node *repr) -{ - SPGenericEllipse::build(document, repr); - - this->readAttr("cx"); - this->readAttr("cy"); - this->readAttr("r"); -} - - -Inkscape::XML::Node *SPCircle::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) +void SPGenericEllipse::modified(guint flags) { - if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { - repr = xml_doc->createElement("svg:circle"); + if (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG | SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) { + this->set_shape(); } - sp_repr_set_svg_double(repr, "cx", this->cx.computed); - sp_repr_set_svg_double(repr, "cy", this->cy.computed); - sp_repr_set_svg_double(repr, "r", this->rx.computed); - - SPGenericEllipse::write(xml_doc, repr, flags); - - return repr; + SPShape::modified(flags); } -void SPCircle::set(unsigned int key, gchar const *value) +void SPGenericEllipse::update_patheffect(bool write) { - switch (key) { - case SP_ATTR_CX: - this->cx.readOrUnset(value); - this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); - break; + this->set_shape(); - case SP_ATTR_CY: - this->cy.readOrUnset(value); - this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); - break; + if (write) { + Inkscape::XML::Node *repr = this->getRepr(); - case SP_ATTR_R: - if (!this->rx.read(value) || this->rx.value <= 0.0) { - this->rx.unset(); + if (this->_curve != NULL) { + gchar *str = sp_svg_write_path(this->_curve->get_pathvector()); + repr->setAttribute("d", str); + g_free(str); + } else { + repr->setAttribute("d", NULL); } - - this->ry = this->rx; - this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); - break; - - default: - SPGenericEllipse::set(key, value); - break; } -} -const char *SPCircle::displayName() -{ - return _("Circle"); + this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); } -/* <path sodipodi:type="arc"> element */ -SPArc::SPArc() : SPGenericEllipse() +void SPGenericEllipse::normalize() { -} + Geom::AngleInterval a(this->start, this->end, true); -SPArc::~SPArc() -{ + this->start = a.initialAngle().radians0(); + this->end = a.finalAngle().radians0(); } -void SPArc::build(SPDocument *document, Inkscape::XML::Node *repr) +Geom::Point SPGenericEllipse::getPointAtAngle(double arg) const { - SPGenericEllipse::build(document, repr); - - this->readAttr("sodipodi:cx"); - this->readAttr("sodipodi:cy"); - this->readAttr("sodipodi:rx"); - this->readAttr("sodipodi:ry"); - - this->readAttr("sodipodi:start"); - this->readAttr("sodipodi:end"); - this->readAttr("sodipodi:open"); + return Geom::Point::polar(arg) * Geom::Scale(rx.computed, ry.computed) * Geom::Translate(cx.computed, cy.computed); } /* - * sp_arc_set_elliptical_path_attribute: + * set_elliptical_path_attribute: * * Convert center to endpoint parameterization and set it to repr. * * See SVG 1.0 Specification W3C Recommendation * ``F.6 Ellptical arc implementation notes'' for more detail. */ -bool SPArc::sp_arc_set_elliptical_path_attribute(Inkscape::XML::Node *repr) +bool SPGenericEllipse::set_elliptical_path_attribute(Inkscape::XML::Node *repr) { - Inkscape::SVG::PathString str; - - Geom::Point p1 = this->getPointAtAngle(this->start); - Geom::Point p2 = this->getPointAtAngle(this->end); - double rx = this->rx.computed; - double ry = this->ry.computed; - - str.moveTo(p1); + // Make sure our pathvector is up to date. + this->set_shape(); - double dt = fmod(this->end - this->start, SP_2PI); + if (this->getCurve() != NULL) { + gchar* d = sp_svg_write_path(this->getCurve()->get_pathvector()); - if (fabs(dt) < 1e-6) { - Geom::Point ph = getPointAtAngle((this->start + this->end) / 2.0); + repr->setAttribute("d", d); - str.arcTo(rx, ry, 0, true, true, ph) - .arcTo(rx, ry, 0, true, true, p2) - .closePath(); + g_free(d); } else { - bool fa = (fabs(dt) > M_PI); - bool fs = (dt > 0); - - str.arcTo(rx, ry, 0, fa, fs, p2); - - if (this->_closed) { - Geom::Point center = Geom::Point(this->cx.computed, this->cy.computed); - str.lineTo(center).closePath(); - } + repr->setAttribute("d", NULL); } - repr->setAttribute("d", str.c_str()); return true; } -Inkscape::XML::Node *SPArc::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) -{ - if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { - repr = xml_doc->createElement("svg:path"); - } - - if (flags & SP_OBJECT_WRITE_EXT) { - repr->setAttribute("sodipodi:type", "arc"); - - sp_repr_set_svg_double(repr, "sodipodi:cx", this->cx.computed); - sp_repr_set_svg_double(repr, "sodipodi:cy", this->cy.computed); - sp_repr_set_svg_double(repr, "sodipodi:rx", this->rx.computed); - sp_repr_set_svg_double(repr, "sodipodi:ry", this->ry.computed); - - // write start and end only if they are non-trivial; otherwise remove - if (this->_isSlice()) { - sp_repr_set_svg_double(repr, "sodipodi:start", this->start); - sp_repr_set_svg_double(repr, "sodipodi:end", this->end); - - repr->setAttribute("sodipodi:open", (!this->_closed) ? "true" : NULL); - } else { - repr->setAttribute("sodipodi:end", NULL); - repr->setAttribute("sodipodi:start", NULL); - repr->setAttribute("sodipodi:open", NULL); - } - } - - // write d= - this->sp_arc_set_elliptical_path_attribute(repr); - - SPGenericEllipse::write(xml_doc, repr, flags); - - return repr; -} - -void SPArc::set(unsigned int key, gchar const *value) -{ - switch (key) { - case SP_ATTR_SODIPODI_CX: - this->cx.readOrUnset(value); - this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); - break; - - case SP_ATTR_SODIPODI_CY: - this->cy.readOrUnset(value); - this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); - break; - - case SP_ATTR_SODIPODI_RX: - if (!this->rx.read(value) || this->rx.computed <= 0.0) { - this->rx.unset(); - } - - this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); - break; - - case SP_ATTR_SODIPODI_RY: - if (!this->ry.read(value) || this->ry.computed <= 0.0) { - this->ry.unset(); - } - - this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); - break; - - case SP_ATTR_SODIPODI_START: - if (value) { - sp_svg_number_read_d(value, &this->start); - } else { - this->start = 0; - } - - this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); - break; - - case SP_ATTR_SODIPODI_END: - if (value) { - sp_svg_number_read_d(value, &this->end); - } else { - this->end = 2 * M_PI; - } - - this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); - break; - - case SP_ATTR_SODIPODI_OPEN: - this->_closed = (!value); - this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); - break; - - default: - SPGenericEllipse::set(key, value); - break; - } -} - -void SPArc::modified(guint flags) -{ - if (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG | SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) { - this->set_shape(); - } - - SPGenericEllipse::modified(flags); -} - -const char *SPArc::displayName() -{ - if (this->_isSlice()) { - if (this->_closed) { - return _("Segment"); - } else { - return _("Arc"); - } - } else { - return _("Ellipse"); - } -} - -void SPArc::sp_arc_position_set(gdouble x, gdouble y, gdouble rx, gdouble ry) +void SPGenericEllipse::position_set(gdouble x, gdouble y, gdouble rx, gdouble ry) { this->cx.computed = x; this->cy.computed = y; @@ -706,9 +699,11 @@ void SPArc::sp_arc_position_set(gdouble x, gdouble y, gdouble rx, gdouble ry) this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); } -Geom::Point SPGenericEllipse::getPointAtAngle(double arg) const +bool SPGenericEllipse::_isSlice() const { - return Geom::Point::polar(arg) * Geom::Scale(rx.computed, ry.computed) * Geom::Translate(cx.computed, cy.computed); + Geom::AngleInterval a(this->start, this->end, true); + + return !(Geom::are_near(a.extent(), 0) || Geom::are_near(a.extent(), SP_2PI)); } /* diff --git a/src/sp-ellipse.h b/src/sp-ellipse.h index eab0b4907..94bddde98 100644 --- a/src/sp-ellipse.h +++ b/src/sp-ellipse.h @@ -7,9 +7,11 @@ * Authors: * Lauris Kaplinski <lauris@kaplinski.com> * Mitsuru Oka + * Tavmjong Bah * * Copyright (C) 1999-2002 Lauris Kaplinski * Copyright (C) 2000-2001 Ximian, Inc. + * Copyright (C) 2013 Tavmjong Bah * * Released under GNU GPL, read the file 'COPYING' for more information */ @@ -21,11 +23,20 @@ #define SP_GENERICELLIPSE(obj) (dynamic_cast<SPGenericEllipse*>((SPObject*)obj)) #define SP_IS_GENERICELLIPSE(obj) (dynamic_cast<const SPGenericEllipse*>((SPObject*)obj) != NULL) +enum GenericEllipseType { + SP_GENERIC_ELLIPSE_UNDEFINED, + SP_GENERIC_ELLIPSE_ARC, + SP_GENERIC_ELLIPSE_CIRCLE, + SP_GENERIC_ELLIPSE_ELLIPSE +}; + class SPGenericEllipse : public SPShape { public: SPGenericEllipse(); virtual ~SPGenericEllipse(); + // Regardless of type, the ellipse/circle/arc is stored + // internally with these variables. (Circle radius is rx). SVGLength cx; SVGLength cy; SVGLength rx; @@ -38,14 +49,23 @@ public: void setClosed(bool value); double start, end; + GenericEllipseType type; + + virtual void build(SPDocument *document, Inkscape::XML::Node *repr); + virtual void set(unsigned int key, gchar const *value); virtual void update(SPCtx *ctx, unsigned int flags); + virtual Inkscape::XML::Node *write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags); + virtual const char *displayName(); - virtual void snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs); virtual void set_shape(); virtual Geom::Affine set_transform(Geom::Affine const &xform); + virtual void snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs); + + virtual void modified(unsigned int flags); + virtual void update_patheffect(bool write); /** @@ -55,6 +75,9 @@ public: Geom::Point getPointAtAngle(double arg) const; + bool set_elliptical_path_attribute(Inkscape::XML::Node *repr); + void position_set(gdouble x, gdouble y, gdouble rx, gdouble ry); + protected: /** * @brief Determines whether the shape is a part of an ellipse. @@ -64,62 +87,6 @@ protected: bool _closed; }; - -/* SVG <ellipse> element */ -#define SP_ELLIPSE(obj) (dynamic_cast<SPEllipse*>((SPObject*)obj)) -#define SP_IS_ELLIPSE(obj) (dynamic_cast<const SPEllipse*>((SPObject*)obj) != NULL) - -class SPEllipse : public SPGenericEllipse { -public: - SPEllipse(); - virtual ~SPEllipse(); - - virtual void build(SPDocument *document, Inkscape::XML::Node *repr); - virtual Inkscape::XML::Node *write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags); - virtual void set(unsigned int key, gchar const *value); - virtual const char *displayName(); -}; - - -/* SVG <circle> element */ -#define SP_CIRCLE(obj) (dynamic_cast<SPCircle*>((SPObject*)obj)) -#define SP_IS_CIRCLE(obj) (dynamic_cast<const SPCircle*>((SPObject*)obj) != NULL) - -class SPCircle : public SPGenericEllipse { -public: - SPCircle(); - virtual ~SPCircle(); - - virtual void build(SPDocument *document, Inkscape::XML::Node *repr); - virtual Inkscape::XML::Node *write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags); - virtual void set(unsigned int key, gchar const *value); - virtual const char *displayName(); -}; - - -/* <path sodipodi:type="arc"> element */ -#define SP_ARC(obj) (dynamic_cast<SPArc*>((SPObject*)obj)) -#define SP_IS_ARC(obj) (dynamic_cast<const SPArc*>((SPObject*)obj) != NULL) - -class SPArc : public SPGenericEllipse { -public: - SPArc(); - virtual ~SPArc(); - - virtual void build(SPDocument *document, Inkscape::XML::Node *repr); - virtual Inkscape::XML::Node *write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags); - virtual void set(unsigned int key, gchar const *value); - virtual const char *displayName(); - virtual void modified(unsigned int flags); - - void sp_arc_position_set(gdouble x, gdouble y, gdouble rx, gdouble ry); - -private: - bool sp_arc_set_elliptical_path_attribute(Inkscape::XML::Node *repr); - - friend class SPGenericEllipse; -}; - #endif /* diff --git a/src/sp-filter.cpp b/src/sp-filter.cpp index 1a5c65be9..9d45c92fc 100644 --- a/src/sp-filter.cpp +++ b/src/sp-filter.cpp @@ -114,7 +114,7 @@ void SPFilter::release() { this->href = NULL; } - for (map<gchar *, int, ltstr>::const_iterator i = this->_image_name->begin() ; i != this->_image_name->end() ; i++) { + for (map<gchar *, int, ltstr>::const_iterator i = this->_image_name->begin() ; i != this->_image_name->end() ; ++i) { g_free(i->first); } diff --git a/src/sp-lpe-item.cpp b/src/sp-lpe-item.cpp index b7e4ee4a9..61ba2ae0d 100644 --- a/src/sp-lpe-item.cpp +++ b/src/sp-lpe-item.cpp @@ -35,6 +35,7 @@ #include "inkscape.h" #include "desktop.h" #include "shape-editor.h" +#include "sp-ellipse.h" #include <algorithm> @@ -387,6 +388,10 @@ void SPLPEItem::addPathEffect(gchar *value, bool reset) this->getRepr()->setAttribute("inkscape:path-effect", hrefs.c_str()); + // Make sure that ellipse is stored as <svg:path> + if( SP_IS_GENERICELLIPSE(this)) { + SP_GENERICELLIPSE(this)->write( this->getRepr()->document(), this->getRepr(), SP_OBJECT_WRITE_EXT ); + } // make sure there is an original-d for paths!!! sp_lpe_item_create_original_path_recursive(this); @@ -436,6 +441,10 @@ void SPLPEItem::removeCurrentPathEffect(bool keep_paths) this->getRepr()->setAttribute("inkscape:path-effect", r.c_str()); } else { this->getRepr()->setAttribute("inkscape:path-effect", NULL); + // Make sure that ellipse is stored as <svg:circle> or <svg:ellipse> if possible. + if( SP_IS_GENERICELLIPSE(this)) { + SP_GENERICELLIPSE(this)->write( this->getRepr()->document(), this->getRepr(), SP_OBJECT_WRITE_EXT ); + } } if (!keep_paths) { @@ -447,6 +456,11 @@ void SPLPEItem::removeAllPathEffects(bool keep_paths) { this->getRepr()->setAttribute("inkscape:path-effect", NULL); + // Make sure that ellipse is stored as <svg:circle> or <svg:ellipse> if possible. + if( SP_IS_GENERICELLIPSE(this)) { + SP_GENERICELLIPSE(this)->write( this->getRepr()->document(), this->getRepr(), SP_OBJECT_WRITE_EXT ); + } + if (!keep_paths) { sp_lpe_item_cleanup_original_path_recursive(this); } diff --git a/src/sp-mesh-array.cpp b/src/sp-mesh-array.cpp index 2c3c7fa65..5a204e8b0 100644 --- a/src/sp-mesh-array.cpp +++ b/src/sp-mesh-array.cpp @@ -1058,9 +1058,9 @@ void SPMeshNodeArray::create( SPMeshGradient *mg, SPItem *item, Geom::OptRect bb end = start + 2.0 * M_PI; } - if ( SP_IS_ARC( item ) ) { + if ( SP_IS_GENERICELLIPSE( item ) ) { // For arcs use set start/stop - SPArc* arc = SP_ARC( item ); + SPGenericEllipse* arc = SP_GENERICELLIPSE( item ); center[Geom::X] = arc->cx.computed; center[Geom::Y] = arc->cy.computed; rx = arc->rx.computed; @@ -1130,11 +1130,11 @@ void SPMeshNodeArray::create( SPMeshGradient *mg, SPItem *item, Geom::OptRect bb // Normal grid meshes - if( SP_IS_ARC( item ) ) { + if( SP_IS_GENERICELLIPSE( item ) ) { // std::cout << "We've got ourselves an arc!" << std::endl; - SPArc* arc = SP_ARC( item ); + SPGenericEllipse* arc = SP_GENERICELLIPSE( item ); center[Geom::X] = arc->cx.computed; center[Geom::Y] = arc->cy.computed; gdouble rx = arc->rx.computed; diff --git a/src/sp-object.h b/src/sp-object.h index bcaa1dac7..3faadb404 100644 --- a/src/sp-object.h +++ b/src/sp-object.h @@ -514,7 +514,7 @@ public: /** * Updates the object's repr based on the object's state. * - * This method updates the the repr attached to the object to reflect the object's current + * This method updates the repr attached to the object to reflect the object's current * state; see the three-argument version for details. * * @param flags object write flags that apply to this update diff --git a/src/tools-switch.cpp b/src/tools-switch.cpp index 1c07f07cc..5f54ad15a 100644 --- a/src/tools-switch.cpp +++ b/src/tools-switch.cpp @@ -88,7 +88,7 @@ static char const *const tool_names[] = { }; static char const *const tool_msg[] = { NULL, - N_("<b>Click</b> to Select and Tranform objects, <b>Drag</b> to select many objects."), + N_("<b>Click</b> to Select and Transform objects, <b>Drag</b> to select many objects."), N_("Modify selected path points (nodes) directly."), N_("To tweak a path by pushing, select it and drag over it."), N_("<b>Drag</b>, <b>click</b> or <b>click and scroll</b> to spray the selected objects."), diff --git a/src/ui/dialog/filedialogimpl-win32.h b/src/ui/dialog/filedialogimpl-win32.h index 2e6bb4bb8..29bcb9a45 100644 --- a/src/ui/dialog/filedialogimpl-win32.h +++ b/src/ui/dialog/filedialogimpl-win32.h @@ -140,7 +140,7 @@ public: /// Shows the file dialog, and blocks until a file /// has been selected. - /// @return Returns true if the the user selected a + /// @return Returns true if the user selected a /// file, or false if the user pressed cancel. bool show(); @@ -341,7 +341,7 @@ public: /// Shows the file dialog, and blocks until a file /// has been selected. - /// @return Returns true if the the user selected a + /// @return Returns true if the user selected a /// file, or false if the user pressed cancel. bool show(); diff --git a/src/ui/dialog/find.cpp b/src/ui/dialog/find.cpp index def7b5bdb..37f2761df 100644 --- a/src/ui/dialog/find.cpp +++ b/src/ui/dialog/find.cpp @@ -664,7 +664,7 @@ bool Find::item_type_match (SPItem *item) if ( SP_IS_RECT(item)) { return ( all ||check_rects.get_active()); - } else if (SP_IS_GENERICELLIPSE(item) || SP_IS_ELLIPSE(item) || SP_IS_ARC(item) || SP_IS_CIRCLE(item)) { + } else if (SP_IS_GENERICELLIPSE(item)) { return ( all || check_ellipses.get_active()); } else if (SP_IS_STAR(item) || SP_IS_POLYGON(item)) { diff --git a/src/ui/tool/node-tool.cpp b/src/ui/tool/node-tool.cpp index 4b236e94c..76e33e506 100644 --- a/src/ui/tool/node-tool.cpp +++ b/src/ui/tool/node-tool.cpp @@ -534,11 +534,7 @@ bool InkNodeTool::root_handler(GdkEvent* event) { break; } -// if (SP_EVENT_CONTEXT_CLASS(ink_node_tool_parent_class)->root_handler) -// return SP_EVENT_CONTEXT_CLASS(ink_node_tool_parent_class)->root_handler(event_context, event); - SPEventContext::root_handler(event); - - return FALSE; + return SPEventContext::root_handler(event); } void InkNodeTool::update_tip(GdkEvent *event) { @@ -607,12 +603,6 @@ void InkNodeTool::update_tip(GdkEvent *event) { } } -bool InkNodeTool::item_handler(SPItem* item, GdkEvent* event) { - SPEventContext::item_handler(item, event); - - return FALSE; -} - void InkNodeTool::select_area(Geom::Rect const &sel, GdkEventButton *event) { using namespace Inkscape::UI; diff --git a/src/ui/tool/node-tool.h b/src/ui/tool/node-tool.h index 4500c5de0..6e37254e0 100644 --- a/src/ui/tool/node-tool.h +++ b/src/ui/tool/node-tool.h @@ -50,7 +50,6 @@ public: virtual void setup(); virtual void set(const Inkscape::Preferences::Entry& val); virtual bool root_handler(GdkEvent* event); - virtual bool item_handler(SPItem* item, GdkEvent* event); virtual const std::string& getPrefsPath(); diff --git a/src/widgets/arc-toolbar.cpp b/src/widgets/arc-toolbar.cpp index c31c61e32..5569780e7 100644 --- a/src/widgets/arc-toolbar.cpp +++ b/src/widgets/arc-toolbar.cpp @@ -112,10 +112,9 @@ sp_arctb_startend_value_changed(GtkAdjustment *adj, GObject *tbl, gchar const *v { SPItem *item = SP_ITEM(items->data); - if (SP_IS_ARC(item) && SP_IS_GENERICELLIPSE(item)) { + if (SP_IS_GENERICELLIPSE(item)) { SPGenericEllipse *ge = SP_GENERICELLIPSE(item); - SPArc *arc = SP_ARC(item); if (!strcmp(value_name, "start")) { ge->start = (gtk_adjustment_get_value(adj) * M_PI)/ 180; @@ -124,8 +123,8 @@ sp_arctb_startend_value_changed(GtkAdjustment *adj, GObject *tbl, gchar const *v } ge->normalize(); - (SP_OBJECT(arc))->updateRepr(); - (SP_OBJECT(arc))->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); + (SP_OBJECT(ge))->updateRepr(); + (SP_OBJECT(ge))->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); modmade = true; } @@ -181,7 +180,7 @@ static void sp_arctb_open_state_changed( EgeSelectOneAction *act, GObject *tbl ) items = items->next) { SPItem *item = reinterpret_cast<SPItem*>(items->data); - if (SP_IS_ARC(item)) { + if (SP_IS_GENERICELLIPSE(item)) { Inkscape::XML::Node *repr = item->getRepr(); repr->setAttribute("sodipodi:open", "true"); item->updateRepr(); @@ -194,7 +193,7 @@ static void sp_arctb_open_state_changed( EgeSelectOneAction *act, GObject *tbl ) items = items->next) { SPItem *item = reinterpret_cast<SPItem *>(items->data); - if (SP_IS_ARC(item)) { + if (SP_IS_GENERICELLIPSE(item)) { Inkscape::XML::Node *repr = item->getRepr(); repr->setAttribute("sodipodi:open", NULL); item->updateRepr(); @@ -286,7 +285,7 @@ static void sp_arc_toolbox_selection_changed(Inkscape::Selection *selection, GOb items = items->next) { SPItem *item = reinterpret_cast<SPItem *>(items->data); - if (SP_IS_ARC(item)) { + if (SP_IS_GENERICELLIPSE(item)) { n_selected++; repr = item->getRepr(); } diff --git a/src/widgets/sp-widget.cpp b/src/widgets/sp-widget.cpp index 7876f0454..0e2295e36 100644 --- a/src/widgets/sp-widget.cpp +++ b/src/widgets/sp-widget.cpp @@ -183,7 +183,7 @@ void SPWidgetImpl::dispose(GObject *object) if (spw->inkscape) { // Disconnect signals - // the checks are necessary because when destroy is caused by the the program shutting down, + // the checks are necessary because when destroy is caused by the program shutting down, // the inkscape object may already be (partly?) invalid --bb if (G_IS_OBJECT(spw->inkscape) && G_OBJECT_GET_CLASS(spw->inkscape)) { sp_signal_disconnect_by_data(spw->inkscape, spw); |
