From fbf31ab90352151b28784c45a9d3a7a061832c75 Mon Sep 17 00:00:00 2001 From: Diederik van Lierop Date: Sun, 12 Jul 2009 13:26:17 +0000 Subject: Don't allow the "proportion" parameter of a star to become NaN, because this will lead to a crash (i.e. give a continuity error in 2geom). This occured when snapping both handles of a star to the same grid intersection and subsequently drawing a new star (bzr r8264) --- src/widgets/toolbox.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index 9ac009a84..21b0e97ac 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -2384,8 +2384,10 @@ static void sp_stb_proportion_value_changed( GtkAdjustment *adj, GObject *dataKl SPDesktop *desktop = (SPDesktop *) g_object_get_data( dataKludge, "desktop" ); if (sp_document_get_undo_sensitive(sp_desktop_document(desktop))) { - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setDouble("/tools/shapes/star/proportion", adj->value); + if (!IS_NAN(adj->value)) { + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + prefs->setDouble("/tools/shapes/star/proportion", adj->value); + } } // quit if run by the attr_changed listener -- cgit v1.2.3 From c43545a9ecf143cc0e6f8e3e3d81a7787710ed6b Mon Sep 17 00:00:00 2001 From: bulia byak Date: Sun, 12 Jul 2009 16:39:27 +0000 Subject: fix a small memleak (bzr r8265) --- src/extension/internal/bitmap/imagemagick.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/extension/internal/bitmap/imagemagick.cpp b/src/extension/internal/bitmap/imagemagick.cpp index ab2834141..e907612fd 100644 --- a/src/extension/internal/bitmap/imagemagick.cpp +++ b/src/extension/internal/bitmap/imagemagick.cpp @@ -129,6 +129,7 @@ ImageMagickDocCache::readImage(const char *xlink, Magick::Image *image) image->read(path); } catch (...) {} } + g_free(search); } bool -- cgit v1.2.3 From 5a330554651d1db806fb4b2b92372ba0d6cf80d4 Mon Sep 17 00:00:00 2001 From: Peter Moulder Date: Mon, 13 Jul 2009 03:14:38 +0000 Subject: doc: add TODO comment for handling hrefs better. (bzr r8271) --- src/display/nr-filter-image.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/display/nr-filter-image.cpp b/src/display/nr-filter-image.cpp index 9679e56e7..2b799f8d2 100644 --- a/src/display/nr-filter-image.cpp +++ b/src/display/nr-filter-image.cpp @@ -107,6 +107,13 @@ int FilterImage::render(FilterSlot &slot, FilterUnits const &units) { if (!image_pixbuf){ try { + /* TODO: If feImageHref is absolute, then use that (preferably handling the + * case that it's not a file URI). Otherwise, go up the tree looking + * for an xml:base attribute, and use that as the base URI for resolving + * the relative feImageHref URI. Otherwise, if document && document->base, + * then use that as the base URI. Otherwise, use feImageHref directly + * (i.e. interpreting it as relative to our current working directory). + * (See http://www.w3.org/TR/xmlbase/#resolution .) */ gchar *fullname = feImageHref; if ( !g_file_test( fullname, G_FILE_TEST_EXISTS ) ) { // Try to load from relative postion combined with document base -- cgit v1.2.3 From 235995e26f9c431091c1a1a7f1fc47d0835fd8c5 Mon Sep 17 00:00:00 2001 From: Peter Moulder Date: Mon, 13 Jul 2009 03:18:56 +0000 Subject: libnr/nr-macros.h: Change our CLAMP macro definition to provide both CLAMP and NR_CLAMP, and make it take precedence over any existing CLAMP macro (such as the one from Glib, which doesn't behave the way we want for NaN). (bzr r8272) --- src/libnr/nr-macros.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/libnr/nr-macros.h b/src/libnr/nr-macros.h index 0e0307916..37a3675e6 100644 --- a/src/libnr/nr-macros.h +++ b/src/libnr/nr-macros.h @@ -30,19 +30,20 @@ #define MIN(a,b) (((a) > (b)) ? (b) : (a)) #endif -#ifndef CLAMP /** Returns v bounded to within [a, b]. If v is NaN then returns a. * * \pre \a a \<= \a b. */ -# define CLAMP(v,a,b) \ +#define NR_CLAMP(v,a,b) \ (assert (a <= b), \ ((v) >= (a)) \ ? (((v) > (b)) \ ? (b) \ : (v)) \ : (a)) -#endif + +#undef CLAMP /* get rid of glib's version, which doesn't handle NaN correctly */ +#define CLAMP(v,a,b) NR_CLAMP(v,a,b) #define NR_DF_TEST_CLOSE(a,b,e) (fabs ((a) - (b)) <= (e)) -- cgit v1.2.3 From bb5018e116c7323c2ae54618135174891ffbe7fc Mon Sep 17 00:00:00 2001 From: Peter Moulder Date: Mon, 13 Jul 2009 03:24:24 +0000 Subject: sp-star.cpp, star-context.cpp: s/CLAMP/NR_CLAMP/, to make clear (and ensure) that we're using the libnr version rather than the glib version. (This change is probably desirable in most of Inkscape, but star-related code in particular is known to be sensitive to the difference.) (bzr r8273) --- src/sp-star.cpp | 8 ++++---- src/star-context.cpp | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/sp-star.cpp b/src/sp-star.cpp index 3c8754a11..71c9ad1c7 100644 --- a/src/sp-star.cpp +++ b/src/sp-star.cpp @@ -174,7 +174,7 @@ sp_star_set (SPObject *object, unsigned int key, const gchar *value) case SP_ATTR_SODIPODI_SIDES: if (value) { star->sides = atoi (value); - star->sides = CLAMP (star->sides, 3, 1024); + star->sides = NR_CLAMP(star->sides, 3, 1024); } else { star->sides = 5; } @@ -512,13 +512,13 @@ sp_star_position_set (SPStar *star, gint sides, Geom::Point center, gdouble r1, g_return_if_fail (star != NULL); g_return_if_fail (SP_IS_STAR (star)); - star->sides = CLAMP (sides, 3, 1024); + star->sides = NR_CLAMP(sides, 3, 1024); star->center = center; star->r[0] = MAX (r1, 0.001); if (isflat == false) { - star->r[1] = CLAMP (r2, 0.0, star->r[0]); + star->r[1] = NR_CLAMP(r2, 0.0, star->r[0]); } else { - star->r[1] = CLAMP ( r1*cos(M_PI/sides) ,0.0, star->r[0] ); + star->r[1] = NR_CLAMP( r1*cos(M_PI/sides) ,0.0, star->r[0] ); } star->arg[0] = arg1; star->arg[1] = arg2; diff --git a/src/star-context.cpp b/src/star-context.cpp index c5eff3c6a..f0c64e875 100644 --- a/src/star-context.cpp +++ b/src/star-context.cpp @@ -34,6 +34,7 @@ #include "desktop.h" #include "desktop-style.h" #include "message-context.h" +#include "libnr/nr-macros.h" #include "pixmaps/cursor-star.xpm" #include "sp-metrics.h" #include @@ -204,9 +205,9 @@ sp_star_context_set (SPEventContext *ec, Inkscape::Preferences::Entry *val) Glib::ustring path = val->getEntryName(); if (path == "magnitude") { - sc->magnitude = CLAMP (val->getInt(5), 3, 1024); + sc->magnitude = NR_CLAMP(val->getInt(5), 3, 1024); } else if (path == "proportion") { - sc->proportion = CLAMP (val->getDouble(0.5), 0.01, 2.0); + sc->proportion = NR_CLAMP(val->getDouble(0.5), 0.01, 2.0); } else if (path == "isflatsided") { sc->isflatsided = val->getBool(); } else if (path == "rounded") { -- cgit v1.2.3 From 2cc79b3a4a40db1d15fe2927c893b70d13b18efe Mon Sep 17 00:00:00 2001 From: Luca Bruno Date: Mon, 13 Jul 2009 08:14:59 +0000 Subject: Fixed a icon name string which shouldn't have been translatable. Closes: #398410 (bzr r8274) --- src/widgets/toolbox.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index 21b0e97ac..440a6283b 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -5573,7 +5573,7 @@ static void sp_lpetool_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActi gtk_list_store_set( model, &iter, 0, _("All inactive"), 1, _("No geometric tool is active"), - 2, _("draw-geometry-inactive"), + 2, "draw-geometry-inactive", -1 ); Inkscape::LivePathEffect::EffectType type; -- cgit v1.2.3 From 36c9ea7b6474385530129ff5a5d52acfd1d032ff Mon Sep 17 00:00:00 2001 From: Josh Andler Date: Mon, 13 Jul 2009 23:23:29 +0000 Subject: Fix width slider for Eraser Tool (bzr r8277) --- src/widgets/toolbox.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index 440a6283b..8bb15ae6f 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -5697,7 +5697,7 @@ static void sp_lpetool_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActi static void sp_erc_width_value_changed( GtkAdjustment *adj, GObject *tbl ) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setDouble( "/tools/eraser/width", adj->value * 0.01 ); + prefs->setDouble( "/tools/eraser/width", adj->value ); update_presets_list(tbl); } @@ -5737,7 +5737,7 @@ static void sp_eraser_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActio GTK_WIDGET(desktop->canvas), NULL, holder, TRUE, "altx-eraser", 1, 100, 1.0, 10.0, labels, values, G_N_ELEMENTS(labels), - sp_erc_width_value_changed, 0.01, 0, 100 ); + sp_erc_width_value_changed, 1, 0); ege_adjustment_action_set_appearance( eact, TOOLBAR_SLIDER_HINT ); gtk_action_group_add_action( mainActions, GTK_ACTION(eact) ); gtk_action_set_sensitive( GTK_ACTION(eact), TRUE ); -- cgit v1.2.3 From bd4a4d2ec057a15c7222ea13f8104937501f875f Mon Sep 17 00:00:00 2001 From: Josh Andler Date: Mon, 13 Jul 2009 23:32:16 +0000 Subject: Newer GTK is more restrictive with includes, only can be directly included now. (bzr r8278) --- src/dialogs/item-properties.cpp | 2 +- src/ege-adjustment-action.cpp | 2 +- src/ege-select-one-action.cpp | 2 +- src/ui/dialog/filter-effects-dialog.cpp | 2 +- src/widgets/sp-color-icc-selector.cpp | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/dialogs/item-properties.cpp b/src/dialogs/item-properties.cpp index 44a479b6c..211b800dc 100644 --- a/src/dialogs/item-properties.cpp +++ b/src/dialogs/item-properties.cpp @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/ege-adjustment-action.cpp b/src/ege-adjustment-action.cpp index 942328100..e6ec392ad 100644 --- a/src/ege-adjustment-action.cpp +++ b/src/ege-adjustment-action.cpp @@ -47,7 +47,7 @@ #include #include #include -#include +#include #include #if GTK_CHECK_VERSION(2,12,0) #include diff --git a/src/ege-select-one-action.cpp b/src/ege-select-one-action.cpp index 5c552a6e7..6de22495d 100644 --- a/src/ege-select-one-action.cpp +++ b/src/ege-select-one-action.cpp @@ -44,7 +44,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp index 1a73dd9a1..baf46970a 100644 --- a/src/ui/dialog/filter-effects-dialog.cpp +++ b/src/ui/dialog/filter-effects-dialog.cpp @@ -15,7 +15,7 @@ # include #endif -#include +#include #include #include #include diff --git a/src/widgets/sp-color-icc-selector.cpp b/src/widgets/sp-color-icc-selector.cpp index b18290923..392a52c6d 100644 --- a/src/widgets/sp-color-icc-selector.cpp +++ b/src/widgets/sp-color-icc-selector.cpp @@ -3,7 +3,7 @@ #endif #include #include -#include +#include #include #include #include -- cgit v1.2.3 From 419f6feaaed27b89c0bd4fe29c209f082afb8557 Mon Sep 17 00:00:00 2001 From: mjwybrow Date: Wed, 15 Jul 2009 05:12:33 +0000 Subject: - Fix bug #171150: Connectors should always touch the shape boundary This fix is backported from some of Arcadie Cracan's Summer of Code work on the gsoc2009_connectors branch. (bzr r8284) --- src/sp-conn-end-pair.cpp | 3 + src/sp-conn-end.cpp | 233 ++++++++++++++++++++++------------------------- 2 files changed, 111 insertions(+), 125 deletions(-) (limited to 'src') diff --git a/src/sp-conn-end-pair.cpp b/src/sp-conn-end-pair.cpp index 49d6fbcdb..4dc0230ff 100644 --- a/src/sp-conn-end-pair.cpp +++ b/src/sp-conn-end-pair.cpp @@ -309,6 +309,9 @@ SPConnEndPair::reroutePath(void) Geom::Point p(route.ps[i].x, route.ps[i].y); curve->lineto(p); } + + Geom::Matrix doc2item = sp_item_i2doc_affine(SP_ITEM(_path)).inverse(); + curve->transform(doc2item); } /* diff --git a/src/sp-conn-end.cpp b/src/sp-conn-end.cpp index 91ff4bc2b..0b420a98e 100644 --- a/src/sp-conn-end.cpp +++ b/src/sp-conn-end.cpp @@ -1,6 +1,7 @@ #include #include +#include #include "display/curve.h" #include "libnr/nr-matrix-fns.h" @@ -9,11 +10,13 @@ #include "sp-path.h" #include "uri.h" #include "document.h" +#include "sp-item-group.h" +#include "2geom/path.h" +#include "2geom/pathvector.h" +#include "2geom/path-intersection.h" static void change_endpts(SPCurve *const curve, Geom::Point const h2endPt[2]); -static Geom::Point calc_bbox_conn_pt(Geom::Rect const &bbox, Geom::Point const &p); -static double signed_one(double const x); SPConnEnd::SPConnEnd(SPObject *const owner) : ref(owner), @@ -35,6 +38,95 @@ get_nearest_common_ancestor(SPObject const *const obj, SPItem const *const objs[ return anc_sofar; } + +static bool try_get_intersect_point_with_item_recursive(SPCurve *conn_curve, SPItem& item, + const Geom::Matrix& item_transform, const bool at_start, double* intersect_pos, + unsigned *intersect_index) { + + double initial_pos = (at_start) ? 0.0 : std::numeric_limits::max(); + + // if this is a group... + if (SP_IS_GROUP(&item)) { + SPGroup* group = SP_GROUP(&item); + + // consider all first-order children + double child_pos = initial_pos; + unsigned child_index; + for (GSList const* i = sp_item_group_item_list(group); i != NULL; i = i->next) { + SPItem* child_item = SP_ITEM(i->data); + try_get_intersect_point_with_item_recursive(conn_curve, *child_item, + item_transform * child_item->transform, at_start, &child_pos, &child_index); + if (fabs(initial_pos - child_pos) > fabs(initial_pos - *intersect_pos)) { + // It is further away from the initial point than the current intersection + // point (i.e. the "outermost" intersection), so use this one. + *intersect_pos = child_pos; + *intersect_index = child_index; + } + } + return *intersect_pos != initial_pos; + } + + // if this is a shape... + if (!SP_IS_SHAPE(&item)) return false; + + // make sure it has an associated curve + SPCurve* item_curve = sp_shape_get_curve(SP_SHAPE(&item)); + if (!item_curve) return false; + + // apply transformations (up to common ancestor) + item_curve->transform(item_transform); + + const Geom::PathVector& curve_pv = item_curve->get_pathvector(); + const Geom::PathVector& conn_pv = conn_curve->get_pathvector(); + Geom::CrossingSet cross = crossings(conn_pv, curve_pv); + // iterate over all Crossings + for (Geom::CrossingSet::const_iterator i = cross.begin(); i != cross.end(); i++) { + const Geom::Crossings& cr = *i; + + for (Geom::Crossings::const_iterator i = cr.begin(); i != cr.end(); i++) { + const Geom::Crossing& cr_pt = *i; + if (fabs(initial_pos - cr_pt.ta) > fabs(initial_pos - *intersect_pos)) { + // It is further away from the initial point than the current intersection + // point (i.e. the "outermost" intersection), so use this one. + *intersect_pos = cr_pt.ta; + *intersect_index = cr_pt.a; + } + } + } + + item_curve->unref(); + + return *intersect_pos != initial_pos; +} + + +// This function returns the outermost intersection point between the path (a connector) +// and the item given. If the item is a group, then the component items are considered. +// The transforms given should be to a common ancestor of both the path and item. +// +static bool try_get_intersect_point_with_item(SPPath& conn, SPItem& item, + const Geom::Matrix& item_transform, const Geom::Matrix& conn_transform, + const bool at_start, double* intersect_pos, unsigned *intersect_index) { + + // We start with the intersection point either at the beginning or end of the + // path, depending on whether we are considering the source or target endpoint. + *intersect_pos = (at_start) ? 0.0 : std::numeric_limits::max(); + + // Copy the curve and apply transformations up to common ancestor. + SPCurve* conn_curve = conn.curve->copy(); + conn_curve->transform(conn_transform); + + // Find the intersection. + bool result = try_get_intersect_point_with_item_recursive(conn_curve, item, item_transform, + at_start, intersect_pos, intersect_index); + + // Free the curve copy. + conn_curve->unref(); + + return result; +} + + static void sp_conn_end_move_compensate(Geom::Matrix const */*mp*/, SPItem */*moved_item*/, SPPath *const path, @@ -50,98 +142,28 @@ sp_conn_end_move_compensate(Geom::Matrix const */*mp*/, SPItem */*moved_item*/, SPItem *h2attItem[2]; path->connEndPair.getAttachedItems(h2attItem); - if ( !h2attItem[0] && !h2attItem[1] ) { - if (updatePathRepr) { - path->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); - path->updateRepr(); - } - return; - } SPItem const *const path_item = SP_ITEM(path); SPObject const *const ancestor = get_nearest_common_ancestor(path_item, h2attItem); Geom::Matrix const path2anc(i2anc_affine(path_item, ancestor)); - if (h2attItem[0] != NULL && h2attItem[1] != NULL) { - /* Initial end-points: centre of attached object. */ - Geom::Point h2endPt_icoordsys[2]; - Geom::Matrix h2i2anc[2]; - Geom::Rect h2bbox_icoordsys[2]; - Geom::Point last_seg_endPt[2] = { - *(path->curve->second_point()), - *(path->curve->penultimate_point()) - }; - for (unsigned h = 0; h < 2; ++h) { - Geom::OptRect bbox = h2attItem[h]->getBounds(Geom::identity()); - if (!bbox) { - if (updatePathRepr) { - path->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); - path->updateRepr(); - } - return; - } - h2bbox_icoordsys[h] = *bbox; - h2i2anc[h] = i2anc_affine(h2attItem[h], ancestor); - h2endPt_icoordsys[h] = h2bbox_icoordsys[h].midpoint(); - } - - // For each attached object, change the corresponding point to be - // on the edge of the bbox. - Geom::Point h2endPt_pcoordsys[2]; - for (unsigned h = 0; h < 2; ++h) { - h2endPt_icoordsys[h] = calc_bbox_conn_pt(h2bbox_icoordsys[h], - ( last_seg_endPt[h] * h2i2anc[h].inverse() )); - h2endPt_pcoordsys[h] = h2endPt_icoordsys[h] * h2i2anc[h] * path2anc.inverse(); - } - change_endpts(path->curve, h2endPt_pcoordsys); - } else { - // We leave the unattached endpoint where it is, and adjust the - // position of the attached endpoint to be on the edge of the bbox. - unsigned ind; - Geom::Point other_endpt; - Geom::Point last_seg_pt; - if (h2attItem[0] != NULL) { - other_endpt = *(path->curve->last_point()); - last_seg_pt = *(path->curve->second_point()); - ind = 0; - } - else { - other_endpt = *(path->curve->first_point()); - last_seg_pt = *(path->curve->penultimate_point()); - ind = 1; - } - Geom::Point h2endPt_icoordsys[2]; - Geom::Matrix h2i2anc; - - Geom::Rect otherpt_rect = Geom::Rect(other_endpt, other_endpt); - Geom::Rect h2bbox_icoordsys[2] = { otherpt_rect, otherpt_rect }; - Geom::OptRect bbox = h2attItem[ind]->getBounds(Geom::identity()); - if (!bbox) { - if (updatePathRepr) { - path->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); - path->updateRepr(); + Geom::Point endPts[2] = { *(path->curve->first_point()), *(path->curve->last_point()) }; + + for (unsigned h = 0; h < 2; ++h) { + if (h2attItem[h]) { + // For each attached object, change the corresponding point to be + // at the outermost intersection with the object's path. + double intersect_pos; + unsigned intersect_index; + Geom::Matrix h2i2anc = i2anc_affine(h2attItem[h], ancestor); + if ( try_get_intersect_point_with_item(*path, *h2attItem[h], h2i2anc, path2anc, + (h == 0), &intersect_pos, &intersect_index) ) { + const Geom::PathVector& curve = path->curve->get_pathvector(); + endPts[h] = curve[intersect_index].pointAt(intersect_pos); } - return; } - - h2bbox_icoordsys[ind] = *bbox; - h2i2anc = i2anc_affine(h2attItem[ind], ancestor); - h2endPt_icoordsys[ind] = h2bbox_icoordsys[ind].midpoint(); - - h2endPt_icoordsys[!ind] = other_endpt; - - // For the attached object, change the corresponding point to be - // on the edge of the bbox. - Geom::Point h2endPt_pcoordsys[2]; - h2endPt_icoordsys[ind] = calc_bbox_conn_pt(h2bbox_icoordsys[ind], - ( last_seg_pt * h2i2anc.inverse() )); - h2endPt_pcoordsys[ind] = h2endPt_icoordsys[ind] * h2i2anc * path2anc.inverse(); - - // Leave the other where it is. - h2endPt_pcoordsys[!ind] = other_endpt; - - change_endpts(path->curve, h2endPt_pcoordsys); } + change_endpts(path->curve, endPts); if (updatePathRepr) { path->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); path->updateRepr(); @@ -180,45 +202,6 @@ sp_conn_adjust_path(SPPath *const path) sp_conn_end_move_compensate(NULL, NULL, path, updatePathRepr); } -static Geom::Point -calc_bbox_conn_pt(Geom::Rect const &bbox, Geom::Point const &p) -{ - using Geom::X; - using Geom::Y; - Geom::Point const ctr(bbox.midpoint()); - Geom::Point const lengths(bbox.dimensions()); - if ( ctr == p ) { - /* Arbitrarily choose centre of right edge. */ - return Geom::Point(ctr[X] + .5 * lengths[X], - ctr[Y]); - } - Geom::Point const cp( p - ctr ); - Geom::Dim2 const edgeDim = ( ( fabs(lengths[Y] * cp[X]) < - fabs(lengths[X] * cp[Y]) ) - ? Y - : X ); - Geom::Dim2 const otherDim = (Geom::Dim2) !edgeDim; - Geom::Point offset; - offset[edgeDim] = (signed_one(cp[edgeDim]) - * lengths[edgeDim]); - offset[otherDim] = (lengths[edgeDim] - * cp[otherDim] - / fabs(cp[edgeDim])); - g_assert((offset[otherDim] >= 0) == (cp[otherDim] >= 0)); -#ifndef NDEBUG - for (unsigned d = 0; d < 2; ++d) { - g_assert(fabs(offset[d]) <= lengths[d] + .125); - } -#endif - return ctr + .5 * offset; -} - -static double signed_one(double const x) -{ - return (x < 0 - ? -1. - : 1.); -} static void change_endpts(SPCurve *const curve, Geom::Point const h2endPt[2]) -- cgit v1.2.3 From 4fe8e48a2b4917495831464be7ca1280a315e83d Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Wed, 15 Jul 2009 17:37:41 +0000 Subject: shapeeditor: save separate listerner's repr_keys for KnotHolder and NodePaths, to fix bug #387298 (bzr r8289) --- src/shape-editor.cpp | 30 +++++++++++++++--------------- src/shape-editor.h | 3 ++- 2 files changed, 17 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/shape-editor.cpp b/src/shape-editor.cpp index dc1ec1c7e..b44d889e0 100644 --- a/src/shape-editor.cpp +++ b/src/shape-editor.cpp @@ -54,7 +54,8 @@ ShapeEditor::ShapeEditor(SPDesktop *dt) { this->nodepath = NULL; this->knotholder = NULL; this->hit = false; - this->listener_attached_for = NULL; + this->knotholder_listener_attached_for = NULL; + this->nodepath_listener_attached_for = NULL; } ShapeEditor::~ShapeEditor() { @@ -69,10 +70,10 @@ void ShapeEditor::unset_item(SubType type, bool keep_knotholder) { case SH_NODEPATH: if (this->nodepath) { old_repr = this->nodepath->repr; - if (old_repr && old_repr == listener_attached_for) { + if (old_repr && old_repr == nodepath_listener_attached_for) { sp_repr_remove_listener_by_data(old_repr, this); Inkscape::GC::release(old_repr); - listener_attached_for = NULL; + nodepath_listener_attached_for = NULL; } this->grab_node = -1; @@ -83,10 +84,10 @@ void ShapeEditor::unset_item(SubType type, bool keep_knotholder) { case SH_KNOTHOLDER: if (this->knotholder) { old_repr = this->knotholder->repr; - if (old_repr && old_repr == listener_attached_for) { + if (old_repr && old_repr == knotholder_listener_attached_for) { sp_repr_remove_listener_by_data(old_repr, this); Inkscape::GC::release(old_repr); - listener_attached_for = NULL; + knotholder_listener_attached_for = NULL; } if (!keep_knotholder) { @@ -256,10 +257,10 @@ void ShapeEditor::set_item(SPItem *item, SubType type, bool keep_knotholder) { // setting new listener repr = SP_OBJECT_REPR(item); - if (repr != listener_attached_for) { + if (repr != nodepath_listener_attached_for) { Inkscape::GC::anchor(repr); sp_repr_add_listener(repr, &shapeeditor_repr_events, this); - listener_attached_for = repr; + nodepath_listener_attached_for = repr; } } break; @@ -273,10 +274,10 @@ void ShapeEditor::set_item(SPItem *item, SubType type, bool keep_knotholder) { this->knotholder->update_knots(); // setting new listener repr = this->knotholder->repr; - if (repr != listener_attached_for) { + if (repr != knotholder_listener_attached_for) { Inkscape::GC::anchor(repr); sp_repr_add_listener(repr, &shapeeditor_repr_events, this); - listener_attached_for = repr; + knotholder_listener_attached_for = repr; } } break; @@ -303,10 +304,10 @@ void ShapeEditor::set_item_lpe_path_parameter(SPItem *item, LivePathEffectObject // setting new listener Inkscape::XML::Node *repr = SP_OBJECT_REPR(lpeobject); - if (repr && repr != listener_attached_for) { + if (repr && repr != nodepath_listener_attached_for) { Inkscape::GC::anchor(repr); sp_repr_add_listener(repr, &shapeeditor_repr_events, this); - listener_attached_for = repr; + nodepath_listener_attached_for = repr; } } } @@ -317,9 +318,6 @@ void ShapeEditor::set_item_lpe_path_parameter(SPItem *item, LivePathEffectObject Why not make a reload function in NodePath and in KnotHolder? */ void ShapeEditor::reset_item (SubType type, bool keep_knotholder) { - /// note that it is not certain that this is an SPItem; it could be a LivePathEffectObject. - SPObject *obj = sp_desktop_document(desktop)->getObjectByRepr(listener_attached_for); - switch (type) { case SH_NODEPATH: if ( (nodepath) && (IS_LIVEPATHEFFECT(nodepath->object)) ) { @@ -327,11 +325,13 @@ void ShapeEditor::reset_item (SubType type, bool keep_knotholder) set_item_lpe_path_parameter(nodepath->item, LIVEPATHEFFECT(nodepath->object), key); // the above checks for nodepath, so it is indeed a path that we are editing g_free(key); } else { + SPObject *obj = sp_desktop_document(desktop)->getObjectByRepr(nodepath_listener_attached_for); /// note that it is not certain that this is an SPItem; it could be a LivePathEffectObject. set_item(SP_ITEM(obj), SH_NODEPATH); } break; case SH_KNOTHOLDER: - if (this->knotholder) { + if ( knotholder ) { + SPObject *obj = sp_desktop_document(desktop)->getObjectByRepr(knotholder_listener_attached_for); /// note that it is not certain that this is an SPItem; it could be a LivePathEffectObject. set_item(SP_ITEM(obj), SH_KNOTHOLDER, keep_knotholder); } break; diff --git a/src/shape-editor.h b/src/shape-editor.h index ef81540ae..98dbb35d7 100644 --- a/src/shape-editor.h +++ b/src/shape-editor.h @@ -143,7 +143,8 @@ private: Geom::Point curvepoint_event; // int coords from event Geom::Point curvepoint_doc; // same, in doc coords - Inkscape::XML::Node *listener_attached_for; + Inkscape::XML::Node *knotholder_listener_attached_for; + Inkscape::XML::Node *nodepath_listener_attached_for; }; -- cgit v1.2.3 From 49a274f32919fa63e96bb66e76b691afafda66ff Mon Sep 17 00:00:00 2001 From: Maximilian Albert Date: Thu, 16 Jul 2009 14:55:16 +0000 Subject: Implement guide behaviour as discussed on the mailing list (bzr r8293) --- src/desktop-events.cpp | 169 +++++++++++++++++++++++++-------------- src/select-context.cpp | 3 +- src/sp-guide.cpp | 26 ++++-- src/sp-guide.h | 2 +- src/svg-view.cpp | 2 +- src/ui/dialog/guides.cpp | 2 +- src/ui/widget/selected-style.cpp | 1 + 7 files changed, 132 insertions(+), 73 deletions(-) (limited to 'src') diff --git a/src/desktop-events.cpp b/src/desktop-events.cpp index cc2d49330..d8fb9d8d5 100644 --- a/src/desktop-events.cpp +++ b/src/desktop-events.cpp @@ -66,7 +66,6 @@ int sp_desktop_root_handler(SPCanvasItem */*item*/, GdkEvent *event, SPDesktop * return sp_event_context_root_handler(desktop->event_context, event); } - static gint sp_dt_ruler_event(GtkWidget *widget, GdkEvent *event, SPDesktopWidget *dtw, bool horiz) { static bool dragging = false; @@ -89,17 +88,20 @@ static gint sp_dt_ruler_event(GtkWidget *widget, GdkEvent *event, SPDesktopWidge if (event->button.button == 1) { dragging = true; - // FIXME: The snap delay mechanism won't work here, because it has been implemented for the event context. Dragging - // guides off the ruler will send event to the ruler and not to the context, which bypasses sp_event_context_snap_delay_handler - // The snap manager will not notice the difference, so it'll check if the snap delay has been activated (This check - // is only needed for catching coding errors, i.e. to warn if the snap window has not been implemented properly - // in some context) + // FIXME: The snap delay mechanism won't work here, because it has been implemented + // for the event context. Dragging guides off the ruler will send event to the ruler + // and not to the context, which bypasses sp_event_context_snap_delay_handler + // The snap manager will not notice the difference, so it'll check if the snap delay + // has been activated (This check is only needed for catching coding errors, i.e. + // to warn if the snap window has not been implemented properly in some context) if (desktop->event_context->_snap_window_open == false) { - // A dt_ruler_event might be emitted when dragging a guide off the rulers while drawing a Bezier curve - // In such a situation, we're already in that specific context and the snap delay is already active. We should - // not set the snap delay to active again, because that will trigger a similar warning to the one above - sp_event_context_snap_window_open(desktop->event_context); - snap_window_temporarily_open = true; + // A dt_ruler_event might be emitted when dragging a guide off the rulers + // while drawing a Bezier curve. In such a situation, we're already in that + // specific context and the snap delay is already active. We should not set + // the snap delay to active again, because that will trigger a similar warning + // to the one above + sp_event_context_snap_window_open(desktop->event_context); + snap_window_temporarily_open = true; } Geom::Point const event_w(sp_canvas_window_to_world(dtw->canvas, event_win)); @@ -159,8 +161,9 @@ static gint sp_dt_ruler_event(GtkWidget *widget, GdkEvent *event, SPDesktopWidge SnapManager &m = desktop->namedview->snap_manager; m.setup(desktop); - // We only have a temporary guide which is not stored in our document yet. Because the guide snapper only looks - // in the document for guides to snap to, we don't have to worry about a guide snapping to itself here + // We only have a temporary guide which is not stored in our document yet. + // Because the guide snapper only looks in the document for guides to snap to, + // we don't have to worry about a guide snapping to itself here m.guideFreeSnap(event_dt, normal); sp_guideline_set_position(SP_GUIDELINE(guide), from_2geom(event_dt)); @@ -176,8 +179,9 @@ static gint sp_dt_ruler_event(GtkWidget *widget, GdkEvent *event, SPDesktopWidge SnapManager &m = desktop->namedview->snap_manager; m.setup(desktop); - // We only have a temporary guide which is not stored in our document yet. Because the guide snapper only looks - // in the document for guides to snap to, we don't have to worry about a guide snapping to itself here + // We only have a temporary guide which is not stored in our document yet. + // Because the guide snapper only looks in the document for guides to snap to, + // we don't have to worry about a guide snapping to itself here m.guideFreeSnap(event_dt, normal); dragging = false; @@ -202,11 +206,13 @@ static gint sp_dt_ruler_event(GtkWidget *widget, GdkEvent *event, SPDesktopWidge } desktop->set_coordinate_status(from_2geom(event_dt)); - // A dt_ruler_event might be emitted when dragging a guide of the rulers while drawing a Bezier curve - // In such a situation, we're already in that specific context and the snap delay is already active. We should - // interfere with that context and we should therefore leave the snap delay status as it is. So although it might - // have been set to active above on GDK_BUTTON_PRESS, we should not set it back to inactive here. That must be - // done by the context + // A dt_ruler_event might be emitted when dragging a guide of the rulers + // while drawing a Bezier curve. In such a situation, we're already in that + // specific context and the snap delay is already active. We should interfere + // with that context and we should therefore leave the snap delay status + // as it is. So although it might have been set to active above on + // GDK_BUTTON_PRESS, we should not set it back to inactive here. That must be + // done by the context. } default: break; @@ -236,6 +242,8 @@ enum SPGuideDragType { static Geom::Point drag_origin; static SPGuideDragType drag_type = SP_DRAG_NONE; +//static bool reset_drag_origin = false; // when Ctrl is pressed while dragging, this is used to trigger resetting of the +// // drag origin to that location so that constrained movement is more intuitive // Min distance from anchor to initiate rotation, measured in screenpixels #define tol 40.0 @@ -260,14 +268,6 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data) break; case GDK_BUTTON_PRESS: if (event->button.button == 1) { - if (event->button.state & GDK_CONTROL_MASK && !(event->button.state & GDK_SHIFT_MASK)) { - SPDocument *doc = SP_OBJECT_DOCUMENT(guide); - sp_guide_remove(guide); - sp_document_done(doc, SP_VERB_NONE, _("Delete guide")); - ret = TRUE; - break; - } - sp_event_context_snap_window_open(desktop->event_context); Geom::Point const event_w(event->button.x, event->button.y); Geom::Point const event_dt(desktop->w2d(event_w)); @@ -279,11 +279,18 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data) // https://bugs.launchpad.net/inkscape/+bug/333762 drag_origin = Geom::projection(event_dt, Geom::Line(guide->point_on_line, guide->angle())); - if (Geom::L2(guide->point_on_line - event_dt) < tol/desktop->current_zoom()) { - // the click was on the guide 'anchor' - drag_type = (event->button.state & GDK_SHIFT_MASK) ? SP_DRAG_MOVE_ORIGIN : SP_DRAG_TRANSLATE; + if (event->button.state & GDK_SHIFT_MASK) { + // with shift we rotate the guide + drag_type = SP_DRAG_ROTATE; } else { - drag_type = (event->button.state & GDK_SHIFT_MASK) ? SP_DRAG_ROTATE : SP_DRAG_TRANSLATE; + if (event->button.state & GDK_CONTROL_MASK) { + drag_type = SP_DRAG_MOVE_ORIGIN; + } else { + drag_type = SP_DRAG_TRANSLATE; + } + } + + if (drag_type == SP_DRAG_ROTATE || drag_type == SP_DRAG_TRANSLATE) { sp_canvas_item_grab(item, ( GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_PRESS_MASK | @@ -305,21 +312,23 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data) SnapManager &m = desktop->namedview->snap_manager; m.setup(desktop, true, NULL, NULL, guide); if (drag_type == SP_DRAG_MOVE_ORIGIN) { - // If we snap in guideConstrainedSnap() below, then motion_dt will be forced to be on the guide - // If we don't snap however, then it the origin should still be constrained to the guide - // So let's do that explicitly first: - Geom::Line line(guide->point_on_line, guide->angle()); - Geom::Coord t = line.nearestPoint(motion_dt); - motion_dt = line.pointAt(t); - m.guideConstrainedSnap(motion_dt, *guide); + // If we snap in guideConstrainedSnap() below, then motion_dt will + // be forced to be on the guide. If we don't snap however, then + // the origin should still be constrained to the guide. So let's do + // that explicitly first: + + Geom::Line line(guide->point_on_line, guide->angle()); + Geom::Coord t = line.nearestPoint(motion_dt); + motion_dt = line.pointAt(t); + m.guideConstrainedSnap(motion_dt, *guide); } else { - m.guideFreeSnap(motion_dt, guide->normal_to_line); + m.guideFreeSnap(motion_dt, guide->normal_to_line); } switch (drag_type) { case SP_DRAG_TRANSLATE: { - sp_guide_moveto(*guide, guide->point_on_line + motion_dt - drag_origin, false); + sp_guide_moveto(*guide, motion_dt, false); break; } case SP_DRAG_TRANSLATE_CONSTRAINED: // Is not being used currently! @@ -330,7 +339,8 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data) } case SP_DRAG_ROTATE: { - double angle = angle_between(drag_origin - guide->point_on_line, motion_dt - guide->point_on_line); + Geom::Point pt = motion_dt - guide->point_on_line; + double angle = std::atan2(pt[Geom::Y], pt[Geom::X]); if (event->motion.state & GDK_CONTROL_MASK) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); unsigned const snaps = abs(prefs->getInt("/options/rotationsnapsperpi/value", 12)); @@ -339,7 +349,7 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data) angle = (M_PI / snaps) * sections; } } - sp_guide_set_normal(*guide, guide->normal_to_line * Geom::Rotate(angle), false); + sp_guide_set_normal(*guide, Geom::Point(1,0) * Geom::Rotate(angle + M_PI_2), false); break; } case SP_DRAG_MOVE_ORIGIN: @@ -368,22 +378,23 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data) SnapManager &m = desktop->namedview->snap_manager; m.setup(desktop, true, NULL, NULL, guide); if (drag_type == SP_DRAG_MOVE_ORIGIN) { - // If we snap in guideConstrainedSnap() below, then motion_dt will be forced to be on the guide - // If we don't snap however, then it the origin should still be constrained to the guide - // So let's do that explicitly first: + // If we snap in guideConstrainedSnap() below, then motion_dt will + // be forced to be on the guide. If we don't snap however, then + // the origin should still be constrained to the guide. So let's + // do that explicitly first: Geom::Line line(guide->point_on_line, guide->angle()); - Geom::Coord t = line.nearestPoint(event_dt); - event_dt = line.pointAt(t); + Geom::Coord t = line.nearestPoint(event_dt); + event_dt = line.pointAt(t); m.guideConstrainedSnap(event_dt, *guide); - } else { - m.guideFreeSnap(event_dt, guide->normal_to_line); - } + } else { + m.guideFreeSnap(event_dt, guide->normal_to_line); + } if (sp_canvas_world_pt_inside_window(item->canvas, event_w)) { switch (drag_type) { case SP_DRAG_TRANSLATE: { - sp_guide_moveto(*guide, guide->point_on_line + event_dt - drag_origin, true); + sp_guide_moveto(*guide, event_dt, true); break; } case SP_DRAG_TRANSLATE_CONSTRAINED: // Is not being used currently! @@ -394,7 +405,8 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data) } case SP_DRAG_ROTATE: { - double angle = angle_between(drag_origin - guide->point_on_line, event_dt - guide->point_on_line); + Geom::Point pt = event_dt - guide->point_on_line; + double angle = std::atan2(pt[Geom::Y], pt[Geom::X]); if (event->motion.state & GDK_CONTROL_MASK) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); unsigned const snaps = abs(prefs->getInt("/options/rotationsnapsperpi/value", 12)); @@ -403,7 +415,7 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data) angle = (M_PI / snaps) * sections; } } - sp_guide_set_normal(*guide, guide->normal_to_line * Geom::Rotate(angle), true); + sp_guide_set_normal(*guide, Geom::Point(1,0) * Geom::Rotate(angle + M_PI_2), true); break; } case SP_DRAG_MOVE_ORIGIN: @@ -442,14 +454,12 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data) Geom::Point const event_w(event->crossing.x, event->crossing.y); Geom::Point const event_dt(desktop->w2d(event_w)); - GdkCursor *guide_cursor; - if (Geom::L2(guide->point_on_line - event_dt) < tol/desktop->current_zoom() || !(event->crossing.state & GDK_SHIFT_MASK)) { - // the click was on the guide 'anchor' - guide_cursor = gdk_cursor_new (GDK_FLEUR); - } else { + if (event->crossing.state & GDK_SHIFT_MASK) { + GdkCursor *guide_cursor; guide_cursor = gdk_cursor_new (GDK_EXCHANGE); + gdk_window_set_cursor(GTK_WIDGET(sp_desktop_canvas(desktop))->window, guide_cursor); + gdk_cursor_unref(guide_cursor); } - gdk_window_set_cursor(GTK_WIDGET(sp_desktop_canvas(desktop))->window, guide_cursor); char *guide_description = sp_guide_description(guide); desktop->guidesMessageContext()->setF(Inkscape::NORMAL_MESSAGE, _("Guideline: %s"), guide_description); @@ -464,8 +474,45 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data) desktop->guidesMessageContext()->clear(); break; - default: + case GDK_KEY_PRESS: + switch (get_group0_keyval (&event->key)) { + case GDK_Delete: + case GDK_KP_Delete: + case GDK_BackSpace: + { + SPDocument *doc = SP_OBJECT_DOCUMENT(guide); + sp_guide_remove(guide); + sp_document_done(doc, SP_VERB_NONE, _("Delete guide")); + ret = TRUE; + break; + } + case GDK_Shift_L: + case GDK_Shift_R: + GdkCursor *guide_cursor; + guide_cursor = gdk_cursor_new (GDK_EXCHANGE); + gdk_window_set_cursor(GTK_WIDGET(sp_desktop_canvas(desktop))->window, guide_cursor); + gdk_cursor_unref(guide_cursor); + ret = TRUE; + default: + // do nothing; + break; + } break; + case GDK_KEY_RELEASE: + switch (get_group0_keyval (&event->key)) { + case GDK_Shift_L: + case GDK_Shift_R: + GdkCursor *guide_cursor; + guide_cursor = gdk_cursor_new (GDK_EXCHANGE); + gdk_window_set_cursor(GTK_WIDGET(sp_desktop_canvas(desktop))->window, guide_cursor); + gdk_cursor_unref(guide_cursor); + break; + default: + // do nothing; + break; + } + default: + break; } return ret; diff --git a/src/select-context.cpp b/src/select-context.cpp index f58c034bd..aed594fee 100644 --- a/src/select-context.cpp +++ b/src/select-context.cpp @@ -952,8 +952,9 @@ sp_select_context_root_handler(SPEventContext *event_context, GdkEvent *event) } } // set cursor to default. - if (!desktop->isWaitingCursor()) + if (!desktop->isWaitingCursor()) { gdk_window_set_cursor(GTK_WIDGET(sp_desktop_canvas(desktop))->window, event_context->cursor); + } break; default: break; diff --git a/src/sp-guide.cpp b/src/sp-guide.cpp index e6983a681..f5edf7d97 100644 --- a/src/sp-guide.cpp +++ b/src/sp-guide.cpp @@ -404,35 +404,45 @@ void sp_guide_set_normal(SPGuide const &guide, Geom::Point const normal_to_line, /** * Returns a human-readable description of the guideline for use in dialog boxes and status bar. + * If verbose is false, only positioning information is included (useful for dialogs). * * The caller is responsible for freeing the string. */ -char *sp_guide_description(SPGuide const *guide) +char *sp_guide_description(SPGuide const *guide, const bool verbose) { using Geom::X; using Geom::Y; - GString *position_string_x = SP_PX_TO_METRIC_STRING(guide->point_on_line[X], SP_ACTIVE_DESKTOP->namedview->getDefaultMetric()); - GString *position_string_y = SP_PX_TO_METRIC_STRING(guide->point_on_line[Y], SP_ACTIVE_DESKTOP->namedview->getDefaultMetric()); + GString *position_string_x = SP_PX_TO_METRIC_STRING(guide->point_on_line[X], + SP_ACTIVE_DESKTOP->namedview->getDefaultMetric()); + GString *position_string_y = SP_PX_TO_METRIC_STRING(guide->point_on_line[Y], + SP_ACTIVE_DESKTOP->namedview->getDefaultMetric()); - const gchar *shortcuts = _("drag to move, Shift+drag to rotate, Ctrl+click to delete"); + gchar *shortcuts = g_strdup_printf("; %s", _("Shift+drag to rotate, Ctrl+drag to move origin, Del to delete")); + gchar *descr; if ( are_near(guide->normal_to_line, component_vectors[X]) || are_near(guide->normal_to_line, -component_vectors[X]) ) { - return g_strdup_printf(_("vertical, at %s; %s"), position_string_x->str, shortcuts); + descr = g_strdup_printf(_("vertical, at %s"), position_string_x->str); } else if ( are_near(guide->normal_to_line, component_vectors[Y]) || are_near(guide->normal_to_line, -component_vectors[Y]) ) { - return g_strdup_printf(_("horizontal, at %s; %s"), position_string_y->str, shortcuts); + descr = g_strdup_printf(_("horizontal, at %s"), position_string_y->str); } else { double const radians = guide->angle(); double const degrees = Geom::rad_to_deg(radians); int const degrees_int = (int) round(degrees); - return g_strdup_printf(_("at %d degrees, through (%s,%s); %s"), - degrees_int, position_string_x->str, position_string_y->str, shortcuts); + descr = g_strdup_printf(_("at %d degrees, through (%s,%s)"), + degrees_int, position_string_x->str, position_string_y->str); } g_string_free(position_string_x, TRUE); g_string_free(position_string_y, TRUE); + + if (verbose) { + descr = g_strconcat(descr, shortcuts, NULL); + } + g_free(shortcuts); + return descr; } void sp_guide_remove(SPGuide *guide) diff --git a/src/sp-guide.h b/src/sp-guide.h index 593e4583f..6bf541cd1 100644 --- a/src/sp-guide.h +++ b/src/sp-guide.h @@ -59,7 +59,7 @@ void sp_guide_moveto(SPGuide const &guide, Geom::Point const point_on_line, bool void sp_guide_set_normal(SPGuide const &guide, Geom::Point const normal_to_line, bool const commit); void sp_guide_remove(SPGuide *guide); -char *sp_guide_description(SPGuide const *guide); +char *sp_guide_description(SPGuide const *guide, const bool verbose = true); #endif /* !SP_GUIDE_H */ diff --git a/src/svg-view.cpp b/src/svg-view.cpp index bd86d5477..bd46dd17a 100644 --- a/src/svg-view.cpp +++ b/src/svg-view.cpp @@ -114,7 +114,7 @@ SPSVGView::mouseover() { GdkCursor *cursor = gdk_cursor_new(GDK_HAND2); gdk_window_set_cursor(GTK_WIDGET(SP_CANVAS_ITEM(_drawing)->canvas)->window, cursor); - gdk_cursor_destroy(cursor); + gdk_cursor_unref(cursor); } void diff --git a/src/ui/dialog/guides.cpp b/src/ui/dialog/guides.cpp index c5d2ae488..3a7964ba2 100644 --- a/src/ui/dialog/guides.cpp +++ b/src/ui/dialog/guides.cpp @@ -241,7 +241,7 @@ void GuidelinePropertiesDialog::_setup() { g_free(label); } { - gchar *guide_description = sp_guide_description(_guide); + gchar *guide_description = sp_guide_description(_guide, false); gchar *label = g_strdup_printf(_("Current: %s"), guide_description); g_free(guide_description); _label_descr.set_markup(label); diff --git a/src/ui/widget/selected-style.cpp b/src/ui/widget/selected-style.cpp index 9a5364874..e7b0188d8 100644 --- a/src/ui/widget/selected-style.cpp +++ b/src/ui/widget/selected-style.cpp @@ -1252,6 +1252,7 @@ RotateableSwatch::do_motion(double by, guint modifier) { g_object_unref (bitmap); g_object_unref (mask); gdk_window_set_cursor(w->window, cr); + gdk_cursor_unref(cr); cr_set = true; } } -- cgit v1.2.3 From a6414ff56323924e7fc0034e48431cb522a03e91 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Sat, 18 Jul 2009 06:02:56 +0000 Subject: Use cursor-tweak-move.xpm for all object modes and cursor-color.xpm for color paint mode until someone creates new cursors. This at least gives consistency as to which cursor is used in each mode. (bzr r8298) --- src/tweak-context.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/tweak-context.cpp b/src/tweak-context.cpp index 68e62b975..3f55d040b 100644 --- a/src/tweak-context.cpp +++ b/src/tweak-context.cpp @@ -208,23 +208,27 @@ sp_tweak_update_cursor (SPTweakContext *tc, bool with_shift) switch (tc->mode) { case TWEAK_MODE_MOVE: tc->_message_context->setF(Inkscape::NORMAL_MESSAGE, _("%s. Drag to move."), sel_message); - break; event_context->cursor_shape = cursor_tweak_move_xpm; break; case TWEAK_MODE_MOVE_IN_OUT: tc->_message_context->setF(Inkscape::NORMAL_MESSAGE, _("%s. Drag or click to move in; with Shift to move out."), sel_message); + event_context->cursor_shape = cursor_tweak_move_xpm; break; case TWEAK_MODE_MOVE_JITTER: tc->_message_context->setF(Inkscape::NORMAL_MESSAGE, _("%s. Drag or click to move randomly."), sel_message); + event_context->cursor_shape = cursor_tweak_move_xpm; break; case TWEAK_MODE_SCALE: tc->_message_context->setF(Inkscape::NORMAL_MESSAGE, _("%s. Drag or click to scale down; with Shift to scale up."), sel_message); + event_context->cursor_shape = cursor_tweak_move_xpm; break; case TWEAK_MODE_ROTATE: tc->_message_context->setF(Inkscape::NORMAL_MESSAGE, _("%s. Drag or click to rotate clockwise; with Shift, counterclockwise."), sel_message); + event_context->cursor_shape = cursor_tweak_move_xpm; break; case TWEAK_MODE_MORELESS: tc->_message_context->setF(Inkscape::NORMAL_MESSAGE, _("%s. Drag or click to duplicate; with Shift, delete."), sel_message); + event_context->cursor_shape = cursor_tweak_move_xpm; break; case TWEAK_MODE_PUSH: tc->_message_context->setF(Inkscape::NORMAL_MESSAGE, _("%s. Drag to push paths."), sel_message); @@ -252,6 +256,7 @@ sp_tweak_update_cursor (SPTweakContext *tc, bool with_shift) break; case TWEAK_MODE_COLORPAINT: tc->_message_context->setF(Inkscape::NORMAL_MESSAGE, _("%s. Drag or click to paint objects with color."), sel_message); + event_context->cursor_shape = cursor_color_xpm; break; case TWEAK_MODE_COLORJITTER: tc->_message_context->setF(Inkscape::NORMAL_MESSAGE, _("%s. Drag or click to randomize colors."), sel_message); -- cgit v1.2.3 From 97398077b69bea0e21e940338638bd9de8917dd4 Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Sat, 18 Jul 2009 10:01:28 +0000 Subject: Fix for bug LP #400985 (3 strings in UI are not translatable) (bzr r8300) --- src/ui/view/edit-widget.cpp | 6 +++--- src/widgets/desktop-widget.cpp | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/ui/view/edit-widget.cpp b/src/ui/view/edit-widget.cpp index b12d5adf7..756f4df73 100644 --- a/src/ui/view/edit-widget.cpp +++ b/src/ui/view/edit-widget.cpp @@ -1071,15 +1071,15 @@ EditWidget::initStatusbar() _coord_eventbox.add (_coord_status); _tooltips.set_tip (_coord_eventbox, _("Cursor coordinates")); _coord_status.attach (*new Gtk::VSeparator(), 0,1, 0,2, Gtk::FILL,Gtk::FILL, 0,0); - _coord_status.attach (*new Gtk::Label("X:", 0.0, 0.5), 1,2, 0,1, Gtk::FILL,Gtk::FILL, 0,0); - _coord_status.attach (*new Gtk::Label("Y:", 0.0, 0.5), 1,2, 1,2, Gtk::FILL,Gtk::FILL, 0,0); + _coord_status.attach (*new Gtk::Label(_("X:"), 0.0, 0.5), 1,2, 0,1, Gtk::FILL,Gtk::FILL, 0,0); + _coord_status.attach (*new Gtk::Label(_("Y:"), 0.0, 0.5), 1,2, 1,2, Gtk::FILL,Gtk::FILL, 0,0); _coord_status_x.set_text ("0.0"); _coord_status_x.set_alignment (0.0, 0.5); _coord_status_y.set_text ("0.0"); _coord_status_y.set_alignment (0.0, 0.5); _coord_status.attach (_coord_status_x, 2,3, 0,1, Gtk::FILL,Gtk::FILL, 0,0); _coord_status.attach (_coord_status_y, 2,3, 1,2, Gtk::FILL,Gtk::FILL, 0,0); - _coord_status.attach (*new Gtk::Label("Z:", 0.0, 0.5), 3,4, 0,2, Gtk::FILL,Gtk::FILL, 0,0); + _coord_status.attach (*new Gtk::Label(_("Z:"), 0.0, 0.5), 3,4, 0,2, Gtk::FILL,Gtk::FILL, 0,0); _coord_status.attach (_zoom_status, 4,5, 0,2, Gtk::FILL,Gtk::FILL, 0,0); sp_set_font_size_smaller (static_cast((void*)_coord_status.gobj())); _statusbar.pack_end (_coord_eventbox, false, false, 1); diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index f5e153a8e..9ccc8e80d 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -499,10 +499,10 @@ sp_desktop_widget_init (SPDesktopWidget *dtw) eventbox = gtk_event_box_new (); gtk_container_add (GTK_CONTAINER (eventbox), dtw->coord_status); gtk_tooltips_set_tip (dtw->tt, eventbox, _("Cursor coordinates"), NULL); - GtkWidget *label_x = gtk_label_new("X:"); + GtkWidget *label_x = gtk_label_new(_("X:")); gtk_misc_set_alignment (GTK_MISC(label_x), 0.0, 0.5); gtk_table_attach(GTK_TABLE(dtw->coord_status), label_x, 1,2, 0,1, GTK_FILL, GTK_FILL, 0, 0); - GtkWidget *label_y = gtk_label_new("Y:"); + GtkWidget *label_y = gtk_label_new(_("Y:")); gtk_misc_set_alignment (GTK_MISC(label_y), 0.0, 0.5); gtk_table_attach(GTK_TABLE(dtw->coord_status), label_y, 1,2, 1,2, GTK_FILL, GTK_FILL, 0, 0); dtw->coord_status_x = gtk_label_new(NULL); @@ -513,7 +513,7 @@ sp_desktop_widget_init (SPDesktopWidget *dtw) gtk_misc_set_alignment (GTK_MISC(dtw->coord_status_y), 1.0, 0.5); gtk_table_attach(GTK_TABLE(dtw->coord_status), dtw->coord_status_x, 2,3, 0,1, GTK_FILL, GTK_FILL, 0, 0); gtk_table_attach(GTK_TABLE(dtw->coord_status), dtw->coord_status_y, 2,3, 1,2, GTK_FILL, GTK_FILL, 0, 0); - gtk_table_attach(GTK_TABLE(dtw->coord_status), gtk_label_new("Z:"), 3,4, 0,2, GTK_FILL, GTK_FILL, 0, 0); + gtk_table_attach(GTK_TABLE(dtw->coord_status), gtk_label_new(_("Z:")), 3,4, 0,2, GTK_FILL, GTK_FILL, 0, 0); gtk_table_attach(GTK_TABLE(dtw->coord_status), dtw->zoom_status, 4,5, 0,2, GTK_FILL, GTK_FILL, 0, 0); sp_set_font_size_smaller (dtw->coord_status); gtk_box_pack_end (GTK_BOX (statusbar_tail), eventbox, FALSE, FALSE, 1); -- cgit v1.2.3 From eae8322c8b968bbf076323eb68707124bfc810d9 Mon Sep 17 00:00:00 2001 From: Diederik van Lierop Date: Sat, 18 Jul 2009 12:56:25 +0000 Subject: Make the snap delay mechanism easier to implement for the devs, and get rid of the related warning messages (bzr r8302) --- src/arc-context.cpp | 7 ++-- src/box3d-context.cpp | 5 ++- src/connector-context.cpp | 21 +++++------- src/desktop-events.cpp | 33 ++++-------------- src/event-context.cpp | 85 +++++++++++------------------------------------ src/event-context.h | 4 +-- src/gradient-context.cpp | 1 - src/knot.cpp | 21 ++---------- src/knotholder.cpp | 2 -- src/node-context.cpp | 2 -- src/nodepath.cpp | 2 -- src/pen-context.cpp | 4 +-- src/pencil-context.cpp | 12 +++---- src/rect-context.cpp | 7 ++-- src/select-context.cpp | 12 +++---- src/seltrans.cpp | 4 --- src/snap.cpp | 26 ++------------- src/spiral-context.cpp | 7 ++-- src/star-context.cpp | 7 ++-- src/text-context.cpp | 5 +-- 20 files changed, 66 insertions(+), 201 deletions(-) (limited to 'src') diff --git a/src/arc-context.cpp b/src/arc-context.cpp index d47e22b1a..dcb326bcd 100644 --- a/src/arc-context.cpp +++ b/src/arc-context.cpp @@ -223,7 +223,6 @@ static gint sp_arc_context_root_handler(SPEventContext *event_context, GdkEvent if (event->button.button == 1 && !event_context->space_panning) { dragging = true; - sp_event_context_snap_window_open(event_context); ac->center = Inkscape::setup_for_drag_start(desktop, event_context, event); /* Snap center */ @@ -267,7 +266,7 @@ static gint sp_arc_context_root_handler(SPEventContext *event_context, GdkEvent event_context->xp = event_context->yp = 0; if (event->button.button == 1 && !event_context->space_panning) { dragging = false; - sp_event_context_snap_window_closed(event_context, false); //button release will also occur on a double-click; in that case suppress warnings + sp_event_context_discard_delayed_snap_event(event_context); if (!event_context->within_tolerance) { // we've been dragging, finish the arc sp_arc_finish(ac); @@ -324,7 +323,7 @@ static gint sp_arc_context_root_handler(SPEventContext *event_context, GdkEvent case GDK_Escape: if (dragging) { dragging = false; - sp_event_context_snap_window_closed(event_context); + sp_event_context_discard_delayed_snap_event(event_context); // if drawing, cancel, otherwise pass it up for deselecting sp_arc_cancel(ac); ret = TRUE; @@ -335,7 +334,7 @@ static gint sp_arc_context_root_handler(SPEventContext *event_context, GdkEvent sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), event->button.time); dragging = false; - sp_event_context_snap_window_closed(event_context); + sp_event_context_discard_delayed_snap_event(event_context); if (!event_context->within_tolerance) { // we've been dragging, finish the arc sp_arc_finish(ac); diff --git a/src/box3d-context.cpp b/src/box3d-context.cpp index d1b6d62fc..fd72e406b 100644 --- a/src/box3d-context.cpp +++ b/src/box3d-context.cpp @@ -276,7 +276,6 @@ static gint sp_box3d_context_root_handler(SPEventContext *event_context, GdkEven event_context->item_to_select = sp_event_context_find_item (desktop, button_w, event->button.state & GDK_MOD1_MASK, event->button.state & GDK_CONTROL_MASK); dragging = true; - sp_event_context_snap_window_open(event_context); /* */ Geom::Point button_dt(desktop->w2d(button_w)); @@ -373,7 +372,7 @@ static gint sp_box3d_context_root_handler(SPEventContext *event_context, GdkEven event_context->xp = event_context->yp = 0; if ( event->button.button == 1 && !event_context->space_panning) { dragging = false; - sp_event_context_snap_window_closed(event_context, false); //button release will also occur on a double-click; in that case suppress warnings + sp_event_context_discard_delayed_snap_event(event_context); if (!event_context->within_tolerance) { // we've been dragging, finish the box @@ -508,7 +507,7 @@ static gint sp_box3d_context_root_handler(SPEventContext *event_context, GdkEven sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), event->button.time); dragging = false; - sp_event_context_snap_window_closed(event_context); + sp_event_context_discard_delayed_snap_event(event_context); if (!event_context->within_tolerance) { // we've been dragging, finish the box sp_box3d_finish(bc); diff --git a/src/connector-context.cpp b/src/connector-context.cpp index c8754972a..2131bdced 100644 --- a/src/connector-context.cpp +++ b/src/connector-context.cpp @@ -409,7 +409,7 @@ sp_connector_context_item_handler(SPEventContext *event_context, SPItem *item, G { spcc_reset_colors(cc); cc->state = SP_CONNECTOR_CONTEXT_IDLE; - sp_event_context_snap_window_closed(event_context); + sp_event_context_discard_delayed_snap_event(event_context); } if (cc->state != SP_CONNECTOR_CONTEXT_IDLE) { // Doing simething else like rerouting. @@ -532,8 +532,6 @@ connector_handle_button_press(SPConnectorContext *const cc, GdkEventButton const // Test whether we clicked on a connection point cc->sid = conn_pt_handle_test(cc, p); - sp_event_context_snap_window_open(event_context); - if (!cc->sid) { // This is the first point, so just snap it to the grid // as there's no other points to go off. @@ -560,7 +558,7 @@ connector_handle_button_press(SPConnectorContext *const cc, GdkEventButton const } cc_set_active_conn(cc, cc->newconn); cc->state = SP_CONNECTOR_CONTEXT_IDLE; - sp_event_context_snap_window_closed(event_context); + sp_event_context_discard_delayed_snap_event(event_context); ret = TRUE; break; } @@ -579,7 +577,7 @@ connector_handle_button_press(SPConnectorContext *const cc, GdkEventButton const cc_connector_rerouting_finish(cc, &p); cc->state = SP_CONNECTOR_CONTEXT_IDLE; - sp_event_context_snap_window_closed(event_context); + sp_event_context_discard_delayed_snap_event(event_context); // Don't set ret to TRUE, so we drop through to the // parent handler which will open the context menu. @@ -587,7 +585,7 @@ connector_handle_button_press(SPConnectorContext *const cc, GdkEventButton const else if (cc->npoints != 0) { spcc_connector_finish(cc); cc->state = SP_CONNECTOR_CONTEXT_IDLE; - sp_event_context_snap_window_closed(event_context); + sp_event_context_discard_delayed_snap_event(event_context); ret = TRUE; } } @@ -719,7 +717,7 @@ connector_handle_button_release(SPConnectorContext *const cc, GdkEventButton con } cc_set_active_conn(cc, cc->newconn); cc->state = SP_CONNECTOR_CONTEXT_IDLE; - sp_event_context_snap_window_closed(event_context); + sp_event_context_discard_delayed_snap_event(event_context); break; } case SP_CONNECTOR_CONTEXT_REROUTING: @@ -729,7 +727,7 @@ connector_handle_button_release(SPConnectorContext *const cc, GdkEventButton con sp_document_ensure_up_to_date(doc); cc->state = SP_CONNECTOR_CONTEXT_IDLE; - sp_event_context_snap_window_closed(event_context); + sp_event_context_discard_delayed_snap_event(event_context); return TRUE; break; } @@ -757,7 +755,7 @@ connector_handle_key_press(SPConnectorContext *const cc, guint const keyval) if (cc->npoints != 0) { spcc_connector_finish(cc); cc->state = SP_CONNECTOR_CONTEXT_IDLE; - sp_event_context_snap_window_closed(SP_EVENT_CONTEXT(cc)); + sp_event_context_discard_delayed_snap_event(SP_EVENT_CONTEXT(cc)); ret = TRUE; } break; @@ -772,7 +770,7 @@ connector_handle_key_press(SPConnectorContext *const cc, guint const keyval) sp_document_undo(doc); cc->state = SP_CONNECTOR_CONTEXT_IDLE; - sp_event_context_snap_window_closed(SP_EVENT_CONTEXT(cc)); + sp_event_context_discard_delayed_snap_event(SP_EVENT_CONTEXT(cc)); desktop->messageStack()->flash( Inkscape::NORMAL_MESSAGE, _("Connector endpoint drag cancelled.")); ret = TRUE; @@ -780,7 +778,7 @@ connector_handle_key_press(SPConnectorContext *const cc, guint const keyval) else if (cc->npoints != 0) { // if drawing, cancel, otherwise pass it up for deselecting cc->state = SP_CONNECTOR_CONTEXT_STOP; - sp_event_context_snap_window_closed(SP_EVENT_CONTEXT(cc)); + sp_event_context_discard_delayed_snap_event(SP_EVENT_CONTEXT(cc)); spcc_reset_colors(cc); ret = TRUE; } @@ -1089,7 +1087,6 @@ endpt_handler(SPKnot */*knot*/, GdkEvent *event, SPConnectorContext *cc) cc->clickedhandle = cc->active_handle; cc_clear_active_conn(cc); cc->state = SP_CONNECTOR_CONTEXT_REROUTING; - sp_event_context_snap_window_open(SP_EVENT_CONTEXT(cc)); // Disconnect from attached shape unsigned ind = (cc->active_handle == cc->endpt_handle[0]) ? 0 : 1; diff --git a/src/desktop-events.cpp b/src/desktop-events.cpp index d8fb9d8d5..1fae9367c 100644 --- a/src/desktop-events.cpp +++ b/src/desktop-events.cpp @@ -71,7 +71,6 @@ static gint sp_dt_ruler_event(GtkWidget *widget, GdkEvent *event, SPDesktopWidge static bool dragging = false; static SPCanvasItem *guide = NULL; static Geom::Point normal; - static bool snap_window_temporarily_open = false; int wx, wy; SPDesktop *desktop = dtw->desktop; @@ -88,21 +87,8 @@ static gint sp_dt_ruler_event(GtkWidget *widget, GdkEvent *event, SPDesktopWidge if (event->button.button == 1) { dragging = true; - // FIXME: The snap delay mechanism won't work here, because it has been implemented - // for the event context. Dragging guides off the ruler will send event to the ruler - // and not to the context, which bypasses sp_event_context_snap_delay_handler - // The snap manager will not notice the difference, so it'll check if the snap delay - // has been activated (This check is only needed for catching coding errors, i.e. - // to warn if the snap window has not been implemented properly in some context) - if (desktop->event_context->_snap_window_open == false) { - // A dt_ruler_event might be emitted when dragging a guide off the rulers - // while drawing a Bezier curve. In such a situation, we're already in that - // specific context and the snap delay is already active. We should not set - // the snap delay to active again, because that will trigger a similar warning - // to the one above - sp_event_context_snap_window_open(desktop->event_context); - snap_window_temporarily_open = true; - } + // FIXME: The snap delay mechanism won't work here, because it has been implemented for the event context. Dragging + // guides off the ruler will send event to the ruler and not to the context, which bypasses sp_event_context_snap_delay_handler Geom::Point const event_w(sp_canvas_window_to_world(dtw->canvas, event_win)); Geom::Point const event_dt(desktop->w2d(event_w)); @@ -186,11 +172,7 @@ static gint sp_dt_ruler_event(GtkWidget *widget, GdkEvent *event, SPDesktopWidge dragging = false; - // See the comments in GDK_BUTTON_PRESS - if (snap_window_temporarily_open) { - sp_event_context_snap_window_closed(desktop->event_context); - snap_window_temporarily_open = false; - } + sp_event_context_discard_delayed_snap_event(desktop->event_context); gtk_object_destroy(GTK_OBJECT(guide)); guide = NULL; @@ -209,7 +191,7 @@ static gint sp_dt_ruler_event(GtkWidget *widget, GdkEvent *event, SPDesktopWidge // A dt_ruler_event might be emitted when dragging a guide of the rulers // while drawing a Bezier curve. In such a situation, we're already in that // specific context and the snap delay is already active. We should interfere - // with that context and we should therefore leave the snap delay status + // with that context and we should therefore leave the snap delay status // as it is. So although it might have been set to active above on // GDK_BUTTON_PRESS, we should not set it back to inactive here. That must be // done by the context. @@ -246,7 +228,7 @@ static SPGuideDragType drag_type = SP_DRAG_NONE; // // drag origin to that location so that constrained movement is more intuitive // Min distance from anchor to initiate rotation, measured in screenpixels -#define tol 40.0 +#define tol 40.0 gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data) { @@ -260,7 +242,7 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data) case GDK_2BUTTON_PRESS: if (event->button.button == 1) { drag_type = SP_DRAG_NONE; - sp_event_context_snap_window_closed(desktop->event_context); + sp_event_context_discard_delayed_snap_event(desktop->event_context); sp_canvas_item_ungrab(item, event->button.time); Inkscape::UI::Dialogs::GuidelinePropertiesDialog::showDialog(guide, desktop); ret = TRUE; @@ -268,7 +250,6 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data) break; case GDK_BUTTON_PRESS: if (event->button.button == 1) { - sp_event_context_snap_window_open(desktop->event_context); Geom::Point const event_w(event->button.x, event->button.y); Geom::Point const event_dt(desktop->w2d(event_w)); @@ -442,7 +423,7 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data) desktop->setPosition (from_2geom(event_dt)); } drag_type = SP_DRAG_NONE; - sp_event_context_snap_window_closed(desktop->event_context); + sp_event_context_discard_delayed_snap_event(desktop->event_context); sp_canvas_item_ungrab(item, event->button.time); ret=TRUE; } diff --git a/src/event-context.cpp b/src/event-context.cpp index b1cfac518..753d0679a 100644 --- a/src/event-context.cpp +++ b/src/event-context.cpp @@ -374,7 +374,9 @@ static gint sp_event_context_private_root_handler(SPEventContext *event_context, switch (event->button.button) { case 1: if (event_context->space_panning) { - panning = 1; + // When starting panning, make sure there are no snap events pending because these might disable the panning again + sp_event_context_discard_delayed_snap_event(event_context); + panning = 1; sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate), GDK_KEY_RELEASE_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK, NULL, event->button.time-1); @@ -385,7 +387,9 @@ static gint sp_event_context_private_root_handler(SPEventContext *event_context, if (event->button.state == GDK_SHIFT_MASK) { zoom_rb = 2; } else { - panning = 2; + // When starting panning, make sure there are no snap events pending because these might disable the panning again + sp_event_context_discard_delayed_snap_event(event_context); + panning = 2; sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate), GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK, NULL, event->button.time-1); @@ -395,7 +399,9 @@ static gint sp_event_context_private_root_handler(SPEventContext *event_context, case 3: if (event->button.state & GDK_SHIFT_MASK || event->button.state & GDK_CONTROL_MASK) { - panning = 3; + // When starting panning, make sure there are no snap events pending because these might disable the panning again + sp_event_context_discard_delayed_snap_event(event_context); + panning = 3; sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate), GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK, NULL, event->button.time); @@ -415,7 +421,7 @@ static gint sp_event_context_private_root_handler(SPEventContext *event_context, || (panning == 3 && !(event->motion.state & GDK_BUTTON3_MASK)) ) { /* Gdk seems to lose button release for us sometimes :-( */ - panning = 0; + panning = 0; sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), event->button.time); ret = TRUE; @@ -874,9 +880,8 @@ sp_event_context_activate(SPEventContext *ec) // Make sure no delayed snapping events are carried over after switching contexts // (this is only an additional safety measure against sloppy coding, because each - // context should take care of this by itself. It might be hard to get each and every - // context perfect though) - sp_event_context_snap_window_closed(ec, false); + // context should take care of this by itself. + sp_event_context_discard_delayed_snap_event(ec); if (((SPEventContextClass *) G_OBJECT_GET_CLASS(ec))->activate) ((SPEventContextClass *) G_OBJECT_GET_CLASS(ec))->activate(ec); @@ -901,8 +906,7 @@ sp_event_context_deactivate(SPEventContext *ec) gint sp_event_context_root_handler(SPEventContext * event_context, GdkEvent * event) { - //std::cout << "sp_event_context_root_handler" << std::endl; - switch (event->type) { + switch (event->type) { case GDK_MOTION_NOTIFY: sp_event_context_snap_delay_handler(event_context, NULL, NULL, (GdkEventMotion *)event, DelayedSnapEvent::EVENTCONTEXT_ROOT_HANDLER); break; @@ -929,8 +933,6 @@ sp_event_context_root_handler(SPEventContext * event_context, GdkEvent * event) gint sp_event_context_virtual_root_handler(SPEventContext * event_context, GdkEvent * event) { - //std::cout << "sp_event_context_virtual_root_handler -> postponed: " << event_context->desktop->namedview->snap_manager.snapprefs.getSnapPostponedGlobally() << std::endl; - gint ret = ((SPEventContextClass *) G_OBJECT_GET_CLASS(event_context))->root_handler(event_context, event); set_event_location(event_context->desktop, event); return ret; @@ -942,7 +944,6 @@ sp_event_context_virtual_root_handler(SPEventContext * event_context, GdkEvent * gint sp_event_context_item_handler(SPEventContext * event_context, SPItem * item, GdkEvent * event) { - //std::cout << "sp_event_context_item_handler" << std::endl; switch (event->type) { case GDK_MOTION_NOTIFY: sp_event_context_snap_delay_handler(event_context, item, NULL, (GdkEventMotion *)event, DelayedSnapEvent::EVENTCONTEXT_ITEM_HANDLER); @@ -1185,17 +1186,14 @@ void sp_event_context_snap_delay_handler(SPEventContext *ec, SPItem* const item, // Make sure that we don't send any pending snap events to a context if we know in advance // that we're not going to snap any way (e.g. while scrolling with middle mouse button) // Any motion event might affect the state of the context, leading to unexpected behavior - delete ec->_delayed_snap_event; - ec->_delayed_snap_event = NULL; - } - - if (ec->_snap_window_open && !c1 && !c2 && ec->desktop && ec->desktop->namedview->snap_manager.snapprefs.getSnapEnabledGlobally()) { - // Snap when speed drops below e.g. 0.02 px/msec, or when no motion events have occurred for some period. + sp_event_context_discard_delayed_snap_event(ec); + } else if (ec->desktop && ec->desktop->namedview->snap_manager.snapprefs.getSnapEnabledGlobally()) { + // Snap when speed drops below e.g. 0.02 px/msec, or when no motion events have occurred for some period. // i.e. snap when we're at stand still. A speed threshold enforces snapping for tablets, which might never // be fully at stand still and might keep spitting out motion events. - ec->desktop->namedview->snap_manager.snapprefs.setSnapPostponedGlobally(true); // put snapping on hold + ec->desktop->namedview->snap_manager.snapprefs.setSnapPostponedGlobally(true); // put snapping on hold - Geom::Point event_pos(event->x, event->y); + Geom::Point event_pos(event->x, event->y); guint32 event_t = gdk_event_get_time ( (GdkEvent *) event ); if (prev_pos) { @@ -1232,7 +1230,7 @@ void sp_event_context_snap_delay_handler(SPEventContext *ec, SPItem* const item, prev_pos = event_pos; prev_time = event_t; - } + } } gboolean sp_event_context_snap_watchdog_callback(gpointer data) @@ -1286,51 +1284,8 @@ gboolean sp_event_context_snap_watchdog_callback(gpointer data) return FALSE; //Kills the timer and stops it from executing this callback over and over again. } -void sp_event_context_snap_window_open(SPEventContext *ec, bool show_debug_warnings) +void sp_event_context_discard_delayed_snap_event(SPEventContext *ec) { - // Only when ec->_snap_window_open has been set, Inkscape will know that snapping is active - // and will delay any snapping events (but only when asked to through the preferences) - - // When snapping is being delayed, then that will also mean that at some point the last event - // might be re-triggered. This should only occur when Inkscape is still in the same tool or context, - // and even more specifically, the tool should even be in the same state. If for example snapping is being delayed while - // creating a rectangle, then the rect-context will be active and it will be in the "dragging" state - // (see the static boolean variable "dragging" in the sp_rect_context_root_handler). The procedure is - // as follows: call sp_event_context_snap_window_open(*, TRUE) when entering the "dragging" state, which will delay - // snapping from that moment on, and call sp_event_context_snap_window_open(*, FALSE) when leaving the "dragging" - // state. This last call will also make sure that any pending snap events will be canceled. - - //std::cout << "sp_event_context_snap_window_open" << std::endl; - if (!ec) { - if (show_debug_warnings) { - g_warning("sp_event_context_snap_window_open() has been called without providing an event context!"); - } - return; - } - - if (ec->_snap_window_open == true && show_debug_warnings) { - g_warning("Snap window was already open! This is a bug, please report it."); - } - - ec->_snap_window_open = true; -} - -void sp_event_context_snap_window_closed(SPEventContext *ec, bool show_debug_warnings) -{ - //std::cout << "sp_event_context_snap_window_closed" << std::endl; - if (!ec) { - if (show_debug_warnings) { - g_warning("sp_event_context_snap_window_closed() has been called without providing an event context!"); - } - return; - } - - if (ec->_snap_window_open == false && show_debug_warnings) { - g_warning("Snap window was already closed! This is a bug, please report it."); - } - - ec->_snap_window_open = false; - delete ec->_delayed_snap_event; ec->_delayed_snap_event = NULL; } diff --git a/src/event-context.h b/src/event-context.h index 638ac56f7..5285bdb87 100644 --- a/src/event-context.h +++ b/src/event-context.h @@ -40,8 +40,7 @@ namespace Inkscape { } gboolean sp_event_context_snap_watchdog_callback(gpointer data); -void sp_event_context_snap_window_open(SPEventContext *ec, bool show_debug_warnings = true); -void sp_event_context_snap_window_closed(SPEventContext *ec, bool show_debug_warnings = true); +void sp_event_context_discard_delayed_snap_event(SPEventContext *ec); class DelayedSnapEvent { @@ -123,7 +122,6 @@ struct SPEventContext : public GObject { bool space_panning; - bool _snap_window_open; DelayedSnapEvent *_delayed_snap_event; }; diff --git a/src/gradient-context.cpp b/src/gradient-context.cpp index b4eeda290..fc5c1af44 100644 --- a/src/gradient-context.cpp +++ b/src/gradient-context.cpp @@ -556,7 +556,6 @@ sp_gradient_context_root_handler(SPEventContext *event_context, GdkEvent *event) if (!(event->button.state & GDK_CONTROL_MASK)) event_context->item_to_select = sp_event_context_find_item (desktop, button_w, event->button.state & GDK_MOD1_MASK, TRUE); - sp_event_context_snap_window_open(event_context, false); SnapManager &m = desktop->namedview->snap_manager; m.setup(desktop); m.freeSnapReturnByRef(Inkscape::SnapPreferences::SNAPPOINT_NODE, button_dt, Inkscape::SNAPSOURCE_HANDLE); diff --git a/src/knot.cpp b/src/knot.cpp index 1ac5d887b..b17e41b24 100644 --- a/src/knot.cpp +++ b/src/knot.cpp @@ -284,8 +284,6 @@ void sp_knot_start_dragging(SPKnot *knot, Geom::Point const &p, gint x, gint y, */ static int sp_knot_handler(SPCanvasItem */*item*/, GdkEvent *event, SPKnot *knot) { - static bool snap_delay_temporarily_active = false; - g_assert(knot != NULL); g_assert(SP_IS_KNOT(knot)); @@ -317,11 +315,7 @@ static int sp_knot_handler(SPCanvasItem */*item*/, GdkEvent *event, SPKnot *knot if (event->button.button == 1 && !knot->desktop->event_context->space_panning) { Geom::Point const p = knot->desktop->w2d(Geom::Point(event->button.x, event->button.y)); sp_knot_start_dragging(knot, p, (gint) event->button.x, (gint) event->button.y, event->button.time); - if (knot->desktop->event_context->_snap_window_open == false) { - sp_event_context_snap_window_open(knot->desktop->event_context); - snap_delay_temporarily_active = true; - } - consumed = TRUE; + consumed = TRUE; } break; case GDK_BUTTON_RELEASE: @@ -331,13 +325,7 @@ static int sp_knot_handler(SPCanvasItem */*item*/, GdkEvent *event, SPKnot *knot sp_event_context_snap_watchdog_callback(knot->desktop->event_context->_delayed_snap_event); } - // now we can safely close the snapping window - if (snap_delay_temporarily_active) { - if (knot->desktop->event_context->_snap_window_open == true) { - sp_event_context_snap_window_closed(knot->desktop->event_context); - } - snap_delay_temporarily_active = false; - } + sp_event_context_discard_delayed_snap_event(knot->desktop->event_context); knot->pressure = 0; if (transform_escaped) { @@ -446,10 +434,7 @@ static int sp_knot_handler(SPCanvasItem */*item*/, GdkEvent *event, SPKnot *knot } grabbed = FALSE; moved = FALSE; - if (snap_delay_temporarily_active) { - sp_event_context_snap_window_closed(knot->desktop->event_context); - snap_delay_temporarily_active = false; - } + sp_event_context_discard_delayed_snap_event(knot->desktop->event_context); break; default: consumed = FALSE; diff --git a/src/knotholder.cpp b/src/knotholder.cpp index 773b9249c..55a171414 100644 --- a/src/knotholder.cpp +++ b/src/knotholder.cpp @@ -139,7 +139,6 @@ KnotHolder::knot_moved_handler(SPKnot *knot, Geom::Point const &p, guint state) { if (this->dragging == false) { this->dragging = true; - //sp_event_context_snap_window_open(desktop->canvas); } // this was a local change and the knotholder does not need to be recreated: @@ -165,7 +164,6 @@ void KnotHolder::knot_ungrabbed_handler(SPKnot */*knot*/) { this->dragging = false; - //sp_event_context_snap_window_closed(desktop->canvas); if (this->released) { this->released(this->item); diff --git a/src/node-context.cpp b/src/node-context.cpp index 6ad7b85d4..a0fb78ba1 100644 --- a/src/node-context.cpp +++ b/src/node-context.cpp @@ -300,8 +300,6 @@ sp_node_context_root_handler(SPEventContext *event_context, GdkEvent *event) nc->remove_flash_counter--; } - sp_event_context_snap_window_open(event_context, false); // Just put the snap window open, bluntly. Will be closed when we have left the context - gint ret = FALSE; switch (event->type) { case GDK_BUTTON_PRESS: diff --git a/src/nodepath.cpp b/src/nodepath.cpp index 8a47b658b..f9a615583 100644 --- a/src/nodepath.cpp +++ b/src/nodepath.cpp @@ -3590,7 +3590,6 @@ static void node_grabbed(SPKnot *knot, guint state, gpointer data) } n->is_dragging = true; - //sp_event_context_snap_window_open(n->subpath->nodepath->desktop->canvas); // Reconstruct and store the location of the mouse pointer at the time when we started dragging (needed for snapping) n->subpath->nodepath->drag_origin_mouse = knot->grabbed_rel_pos + knot->drag_origin; @@ -3608,7 +3607,6 @@ static void node_ungrabbed(SPKnot */*knot*/, guint /*state*/, gpointer data) n->dragging_out = NULL; n->is_dragging = false; - //sp_event_context_snap_window_closed(n->subpath->nodepath->desktop->canvas); n->subpath->nodepath->drag_origin_mouse = Geom::Point(NR_HUGE, NR_HUGE); sp_canvas_end_forced_full_redraws(n->subpath->nodepath->desktop->canvas); diff --git a/src/pen-context.cpp b/src/pen-context.cpp index 261c7d4cf..4c9627071 100644 --- a/src/pen-context.cpp +++ b/src/pen-context.cpp @@ -263,7 +263,7 @@ sp_pen_context_finish(SPEventContext *ec) { SPPenContext *pc = SP_PEN_CONTEXT(ec); - sp_event_context_snap_window_closed(ec, false); //TODO: Detailed implementation of the snap window; now it's simply always open + sp_event_context_discard_delayed_snap_event(ec); if (pc->npoints != 0) { pen_cancel (pc); @@ -367,8 +367,6 @@ sp_pen_context_root_handler(SPEventContext *ec, GdkEvent *event) { SPPenContext *const pc = SP_PEN_CONTEXT(ec); - sp_event_context_snap_window_open(ec, false); //TODO: Detailed implementation of the snap window; now it's simply always open - gint ret = FALSE; switch (event->type) { diff --git a/src/pencil-context.cpp b/src/pencil-context.cpp index 4b87e86b5..31b7441d4 100644 --- a/src/pencil-context.cpp +++ b/src/pencil-context.cpp @@ -255,7 +255,6 @@ pencil_handle_button_press(SPPencilContext *const pc, GdkEventButton const &beve /* Set first point of sequence */ SnapManager &m = desktop->namedview->snap_manager; m.setup(desktop); - sp_event_context_snap_window_open(event_context); if (anchor) { p = anchor->dp; @@ -349,7 +348,7 @@ pencil_handle_motion_notify(SPPencilContext *const pc, GdkEventMotion const &mev /* We may be idle or already freehand */ if ( mevent.state & GDK_BUTTON1_MASK && pc->is_drawing ) { if (pc->state == SP_PENCIL_CONTEXT_IDLE) { - sp_event_context_snap_window_closed(event_context); + sp_event_context_discard_delayed_snap_event(event_context); } pc->state = SP_PENCIL_CONTEXT_FREEHAND; @@ -417,7 +416,6 @@ pencil_handle_button_release(SPPencilContext *const pc, GdkEventButton const &re /* Releasing button in idle mode means single click */ /* We have already set up start point/anchor in button_press */ pc->state = SP_PENCIL_CONTEXT_ADDLINE; - //sp_event_context_snap_window_open(dt->canvas); ret = TRUE; break; case SP_PENCIL_CONTEXT_ADDLINE: @@ -431,7 +429,7 @@ pencil_handle_button_release(SPPencilContext *const pc, GdkEventButton const &re spdc_set_endpoint(pc, p); spdc_finish_endpoint(pc); pc->state = SP_PENCIL_CONTEXT_IDLE; - sp_event_context_snap_window_closed(event_context); + sp_event_context_discard_delayed_snap_event(event_context); ret = TRUE; break; case SP_PENCIL_CONTEXT_FREEHAND: @@ -445,7 +443,6 @@ pencil_handle_button_release(SPPencilContext *const pc, GdkEventButton const &re } pc->state = SP_PENCIL_CONTEXT_SKETCH; - //sp_event_context_snap_window_open(dt->canvas); } else { /* Finish segment now */ /// \todo fixme: Clean up what follows (Lauris) @@ -465,7 +462,6 @@ pencil_handle_button_release(SPPencilContext *const pc, GdkEventButton const &re pc->green_anchor = sp_draw_anchor_destroy(pc->green_anchor); } pc->state = SP_PENCIL_CONTEXT_IDLE; - // sp_event_context_snap_window_closed(dt->canvas); // reset sketch mode too pc->sketch_n = 0; } @@ -498,7 +494,7 @@ pencil_cancel (SPPencilContext *const pc) pc->is_drawing = false; pc->state = SP_PENCIL_CONTEXT_IDLE; - sp_event_context_snap_window_closed(SP_EVENT_CONTEXT(pc)); + sp_event_context_discard_delayed_snap_event(SP_EVENT_CONTEXT(pc)); pc->red_curve->reset(); sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(pc->red_bpath), NULL); @@ -589,7 +585,7 @@ pencil_handle_key_release(SPPencilContext *const pc, guint const keyval, guint c pc->green_anchor = sp_draw_anchor_destroy(pc->green_anchor); } pc->state = SP_PENCIL_CONTEXT_IDLE; - sp_event_context_snap_window_closed(SP_EVENT_CONTEXT(pc)); + sp_event_context_discard_delayed_snap_event(SP_EVENT_CONTEXT(pc)); pc->desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Finishing freehand sketch")); ret = TRUE; } diff --git a/src/rect-context.cpp b/src/rect-context.cpp index 51b5f2e85..ef5881378 100644 --- a/src/rect-context.cpp +++ b/src/rect-context.cpp @@ -258,7 +258,6 @@ static gint sp_rect_context_root_handler(SPEventContext *event_context, GdkEvent event_context->item_to_select = sp_event_context_find_item (desktop, button_w, event->button.state & GDK_MOD1_MASK, TRUE); dragging = true; - sp_event_context_snap_window_open(event_context); /* Position center */ Geom::Point button_dt(desktop->w2d(button_w)); @@ -307,7 +306,7 @@ static gint sp_rect_context_root_handler(SPEventContext *event_context, GdkEvent event_context->xp = event_context->yp = 0; if (event->button.button == 1 && !event_context->space_panning) { dragging = false; - sp_event_context_snap_window_closed(event_context, false); //button release will also occur on a double-click; in that case suppress warnings + sp_event_context_discard_delayed_snap_event(event_context); if (!event_context->within_tolerance) { // we've been dragging, finish the rect @@ -375,7 +374,7 @@ static gint sp_rect_context_root_handler(SPEventContext *event_context, GdkEvent case GDK_Escape: if (dragging) { dragging = false; - sp_event_context_snap_window_closed(event_context); + sp_event_context_discard_delayed_snap_event(event_context); // if drawing, cancel, otherwise pass it up for deselecting sp_rect_cancel(rc); ret = TRUE; @@ -387,7 +386,7 @@ static gint sp_rect_context_root_handler(SPEventContext *event_context, GdkEvent sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), event->button.time); dragging = false; - sp_event_context_snap_window_closed(event_context); + sp_event_context_discard_delayed_snap_event(event_context); if (!event_context->within_tolerance) { // we've been dragging, finish the rect sp_rect_finish(rc); diff --git a/src/select-context.cpp b/src/select-context.cpp index aed594fee..a5f5202ae 100644 --- a/src/select-context.cpp +++ b/src/select-context.cpp @@ -212,7 +212,7 @@ sp_select_context_abort(SPEventContext *event_context) seltrans->ungrab(); sc->moved = FALSE; sc->dragging = FALSE; - sp_event_context_snap_window_closed(event_context); + sp_event_context_discard_delayed_snap_event(event_context); drag_escaped = 1; if (sc->item) { @@ -324,7 +324,6 @@ sp_select_context_item_handler(SPEventContext *event_context, SPItem *item, GdkE // pass the event to root handler which will perform rubberband, shift-click, ctrl-click, ctrl-drag } else { sc->dragging = TRUE; - sp_event_context_snap_window_open(event_context); sc->moved = FALSE; sp_canvas_force_full_redraw_after_interruptions(desktop->canvas, 5); @@ -424,7 +423,7 @@ sp_select_context_root_handler(SPEventContext *event_context, GdkEvent *event) desktop->setCurrentLayer(reinterpret_cast(clicked_item)); sp_desktop_selection(desktop)->clear(); sc->dragging = false; - sp_event_context_snap_window_closed(event_context); + sp_event_context_discard_delayed_snap_event(event_context); sp_canvas_end_forced_full_redraws(desktop->canvas); } else { // switch tool @@ -495,9 +494,6 @@ sp_select_context_root_handler(SPEventContext *event_context, GdkEvent *event) if (sc->button_press_ctrl || (sc->button_press_alt && !sc->button_press_shift && !selection->isEmpty())) { // if it's not click and ctrl or alt was pressed (the latter with some selection // but not with shift) we want to drag rather than rubberband - if (sc->dragging == FALSE) { - sp_event_context_snap_window_open(event_context); - } sc->dragging = TRUE; sp_canvas_force_full_redraw_after_interruptions(desktop->canvas, 5); @@ -549,7 +545,7 @@ sp_select_context_root_handler(SPEventContext *event_context, GdkEvent *event) ret = TRUE; } else { sc->dragging = FALSE; - sp_event_context_snap_window_closed(event_context); + sp_event_context_discard_delayed_snap_event(event_context); sp_canvas_end_forced_full_redraws(desktop->canvas); } } else { @@ -598,7 +594,7 @@ sp_select_context_root_handler(SPEventContext *event_context, GdkEvent *event) } } sc->dragging = FALSE; - sp_event_context_snap_window_closed(event_context); + sp_event_context_discard_delayed_snap_event(event_context); sp_canvas_end_forced_full_redraws(desktop->canvas); if (sc->item) { diff --git a/src/seltrans.cpp b/src/seltrans.cpp index 3bd5f611a..c3c841149 100644 --- a/src/seltrans.cpp +++ b/src/seltrans.cpp @@ -376,8 +376,6 @@ void Inkscape::SelTrans::grab(Geom::Point const &p, gdouble x, gdouble y, bool s } } - //sp_event_context_snap_window_open(_desktop->event_context); - if ((x != -1) && (y != -1)) { sp_canvas_item_show(_norm); sp_canvas_item_show(_grip); @@ -430,8 +428,6 @@ void Inkscape::SelTrans::ungrab() _grabbed = false; _show_handles = true; - //sp_event_context_snap_window_closed(_desktop->event_context); - _desktop->snapindicator->remove_snapsource(); Inkscape::Selection *selection = sp_desktop_selection(_desktop); diff --git a/src/snap.cpp b/src/snap.cpp index 91d5d64ec..4d5dad55a 100644 --- a/src/snap.cpp +++ b/src/snap.cpp @@ -206,13 +206,6 @@ Inkscape::SnappedPoint SnapManager::freeSnap(Inkscape::SnapPreferences::PointTyp bool first_point, Geom::OptRect const &bbox_to_snap) const { - if (_desktop->event_context && _desktop->event_context->_snap_window_open == false) { - g_warning("The current tool tries to snap, but it hasn't yet opened the snap window. Please report this!"); - // When the context goes into dragging-mode, then Inkscape should call this: sp_event_context_snap_window_open(event_context); - } - - //std::cout << "SnapManager::freeSnap -> postponed: " << snapprefs.getSnapPostponedGlobally() << std::endl; - if (!someSnapperMightSnap()) { return Inkscape::SnappedPoint(p, source_type, Inkscape::SNAPTARGET_UNDEFINED, NR_HUGE, 0, false, false); } @@ -371,12 +364,7 @@ Inkscape::SnappedPoint SnapManager::constrainedSnap(Inkscape::SnapPreferences::P bool first_point, Geom::OptRect const &bbox_to_snap) const { - if (_desktop->event_context && _desktop->event_context->_snap_window_open == false) { - g_warning("The current tool tries to snap, but it hasn't yet opened the snap window. Please report this!"); - // When the context goes into dragging-mode, then Inkscape should call this: sp_event_context_snap_window_open(event_context); - } - - if (!someSnapperMightSnap()) { + if (!someSnapperMightSnap()) { return Inkscape::SnappedPoint(p, source_type, Inkscape::SNAPTARGET_UNDEFINED, NR_HUGE, 0, false, false); } @@ -419,11 +407,6 @@ Inkscape::SnappedPoint SnapManager::constrainedSnap(Inkscape::SnapPreferences::P */ void SnapManager::guideFreeSnap(Geom::Point &p, Geom::Point const &guide_normal) const { - if (_desktop->event_context && _desktop->event_context->_snap_window_open == false) { - g_warning("The current tool tries to snap, but it hasn't yet opened the snap window. Please report this!"); - // When the context goes into dragging-mode, then Inkscape should call this: sp_event_context_snap_window_open(event_context); - } - if (!snapprefs.getSnapEnabledGlobally() || snapprefs.getSnapPostponedGlobally()) { return; } @@ -465,12 +448,7 @@ void SnapManager::guideFreeSnap(Geom::Point &p, Geom::Point const &guide_normal) void SnapManager::guideConstrainedSnap(Geom::Point &p, SPGuide const &guideline) const { - if (_desktop->event_context && _desktop->event_context->_snap_window_open == false) { - g_warning("The current tool tries to snap, but it hasn't yet opened the snap window. Please report this!"); - // When the context goes into dragging-mode, then Inkscape should call this: sp_event_context_snap_window_open(event_context); - } - - if (!snapprefs.getSnapEnabledGlobally() || snapprefs.getSnapPostponedGlobally()) { + if (!snapprefs.getSnapEnabledGlobally() || snapprefs.getSnapPostponedGlobally()) { return; } diff --git a/src/spiral-context.cpp b/src/spiral-context.cpp index 2f65b0ba9..5c7c43c83 100644 --- a/src/spiral-context.cpp +++ b/src/spiral-context.cpp @@ -221,7 +221,6 @@ sp_spiral_context_root_handler(SPEventContext *event_context, GdkEvent *event) if (event->button.button == 1 && !event_context->space_panning) { dragging = TRUE; - sp_event_context_snap_window_open(event_context); sc->center = Inkscape::setup_for_drag_start(desktop, event_context, event); SnapManager &m = desktop->namedview->snap_manager; @@ -270,7 +269,7 @@ sp_spiral_context_root_handler(SPEventContext *event_context, GdkEvent *event) event_context->xp = event_context->yp = 0; if (event->button.button == 1 && !event_context->space_panning) { dragging = FALSE; - sp_event_context_snap_window_closed(event_context, false); //button release will also occur on a double-click; in that case suppress warnings + sp_event_context_discard_delayed_snap_event(event_context); if (!event_context->within_tolerance) { // we've been dragging, finish the spiral sp_spiral_finish(sc); @@ -323,7 +322,7 @@ sp_spiral_context_root_handler(SPEventContext *event_context, GdkEvent *event) case GDK_Escape: if (dragging) { dragging = false; - sp_event_context_snap_window_closed(event_context); + sp_event_context_discard_delayed_snap_event(event_context); // if drawing, cancel, otherwise pass it up for deselecting sp_spiral_cancel(sc); ret = TRUE; @@ -335,7 +334,7 @@ sp_spiral_context_root_handler(SPEventContext *event_context, GdkEvent *event) sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), event->button.time); dragging = false; - sp_event_context_snap_window_closed(event_context); + sp_event_context_discard_delayed_snap_event(event_context); if (!event_context->within_tolerance) { // we've been dragging, finish the spiral sp_spiral_finish(sc); diff --git a/src/star-context.cpp b/src/star-context.cpp index f0c64e875..80d378f27 100644 --- a/src/star-context.cpp +++ b/src/star-context.cpp @@ -236,7 +236,6 @@ static gint sp_star_context_root_handler(SPEventContext *event_context, GdkEvent if (event->button.button == 1 && !event_context->space_panning) { dragging = TRUE; - sp_event_context_snap_window_open(event_context); sc->center = Inkscape::setup_for_drag_start(desktop, event_context, event); @@ -283,7 +282,7 @@ static gint sp_star_context_root_handler(SPEventContext *event_context, GdkEvent event_context->xp = event_context->yp = 0; if (event->button.button == 1 && !event_context->space_panning) { dragging = FALSE; - sp_event_context_snap_window_closed(event_context, false); //button release will also occur on a double-click; in that case suppress warnings + sp_event_context_discard_delayed_snap_event(event_context); if (!event_context->within_tolerance) { // we've been dragging, finish the star sp_star_finish (sc); @@ -336,7 +335,7 @@ static gint sp_star_context_root_handler(SPEventContext *event_context, GdkEvent case GDK_Escape: if (dragging) { dragging = false; - sp_event_context_snap_window_closed(event_context); + sp_event_context_discard_delayed_snap_event(event_context); // if drawing, cancel, otherwise pass it up for deselecting sp_star_cancel(sc); ret = TRUE; @@ -347,7 +346,7 @@ static gint sp_star_context_root_handler(SPEventContext *event_context, GdkEvent sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), event->button.time); dragging = false; - sp_event_context_snap_window_closed(event_context); + sp_event_context_discard_delayed_snap_event(event_context); if (!event_context->within_tolerance) { // we've been dragging, finish the star sp_star_finish(sc); diff --git a/src/text-context.cpp b/src/text-context.cpp index 538e13e43..c1986972a 100644 --- a/src/text-context.cpp +++ b/src/text-context.cpp @@ -352,7 +352,6 @@ sp_text_context_item_handler(SPEventContext *event_context, SPItem *item, GdkEve sp_text_context_update_cursor(tc); sp_text_context_update_text_selection(tc); tc->dragging = 1; - sp_event_context_snap_window_open(event_context); } ret = TRUE; } @@ -369,7 +368,6 @@ sp_text_context_item_handler(SPEventContext *event_context, SPItem *item, GdkEve sp_text_context_update_cursor(tc); sp_text_context_update_text_selection(tc); tc->dragging = 2; - sp_event_context_snap_window_open(event_context); ret = TRUE; } } @@ -381,14 +379,13 @@ sp_text_context_item_handler(SPEventContext *event_context, SPItem *item, GdkEve sp_text_context_update_cursor(tc); sp_text_context_update_text_selection(tc); tc->dragging = 3; - sp_event_context_snap_window_open(event_context); ret = TRUE; } break; case GDK_BUTTON_RELEASE: if (event->button.button == 1 && tc->dragging && !event_context->space_panning) { tc->dragging = 0; - sp_event_context_snap_window_closed(event_context, false); //button release will also occur on a double-click; in that case suppress warnings + sp_event_context_discard_delayed_snap_event(event_context); ret = TRUE; } break; -- cgit v1.2.3 From 3e9f6d71f94c836b185f961ead466e282eb8e750 Mon Sep 17 00:00:00 2001 From: Josh Andler Date: Tue, 21 Jul 2009 22:33:35 +0000 Subject: Per #401826, removing unused dependency on libgnome. Tested on Ubuntu 9.04 & 9.10 with no difference in compiler messages or functionality. (bzr r8325) --- src/libgdl/gdl-switcher.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/libgdl/gdl-switcher.c b/src/libgdl/gdl-switcher.c index 23f05b924..28b9fe661 100644 --- a/src/libgdl/gdl-switcher.c +++ b/src/libgdl/gdl-switcher.c @@ -42,7 +42,6 @@ #if HAVE_GNOME #include -#include #endif static void gdl_switcher_set_property (GObject *object, -- cgit v1.2.3 From bd1beb298bf99404ee58d833222ab86562d34726 Mon Sep 17 00:00:00 2001 From: Diederik van Lierop Date: Tue, 28 Jul 2009 19:44:22 +0000 Subject: Fix bug #168387 (Display mode toggle doesn't update radio button) (bzr r8354) --- src/helper/action.h | 2 +- src/interface.cpp | 54 ++++++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 50 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/helper/action.h b/src/helper/action.h index 4c99e31d8..c4367df62 100644 --- a/src/helper/action.h +++ b/src/helper/action.h @@ -26,7 +26,7 @@ #include "forward.h" #include -//class Inkscape::UI::View::View; +//class Inkscape::UI::View::View; namespace Inkscape { class Verb; diff --git a/src/interface.cpp b/src/interface.cpp index a751608c5..cf7072064 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -98,6 +98,7 @@ static GtkTargetEntry ui_drop_target_entries [] = { static GtkTargetEntry *completeDropTargets = 0; static int completeDropTargetsCount = 0; +static bool temporarily_block_actions = false; #define ENTRIES_SIZE(n) sizeof(n)/sizeof(n[0]) static guint nui_drop_target_entries = ENTRIES_SIZE(ui_drop_target_entries); @@ -364,7 +365,9 @@ sp_ui_close_all(void) static void sp_ui_menu_activate(void */*object*/, SPAction *action) { - sp_action_perform(action, NULL); + if (!temporarily_block_actions) { + sp_action_perform(action, NULL); + } } static void @@ -615,9 +618,8 @@ sp_ui_menu_append_item_from_verb(GtkMenu *menu, Inkscape::Verb *verb, Inkscape:: sp_ui_menuitem_add_icon(item, action->image); } gtk_widget_set_events(item, GDK_KEY_PRESS_MASK); - g_signal_connect( G_OBJECT(item), "activate", - G_CALLBACK(sp_ui_menu_activate), action ); - + g_object_set_data(G_OBJECT(item), "view", (gpointer) view); + g_signal_connect( G_OBJECT(item), "activate", G_CALLBACK(sp_ui_menu_activate), action ); g_signal_connect( G_OBJECT(item), "select", G_CALLBACK(sp_ui_menu_select_action), action ); g_signal_connect( G_OBJECT(item), "deselect", G_CALLBACK(sp_ui_menu_deselect_action), action ); } @@ -680,6 +682,44 @@ checkitem_update(GtkWidget *widget, GdkEventExpose */*event*/, gpointer user_dat return FALSE; } +/** + * \brief Callback function to update the status of the radio buttons in the View -> Display mode menu (Normal, No Filters, Outline) + */ + +static gboolean +update_view_menu(GtkWidget *widget, GdkEventExpose */*event*/, gpointer user_data) +{ + SPAction *action = (SPAction *) user_data; + g_assert(action->id != NULL); + + Inkscape::UI::View::View *view = (Inkscape::UI::View::View *) g_object_get_data(G_OBJECT(widget), "view"); + SPDesktop *dt = static_cast(view); + Inkscape::RenderMode mode = dt->getMode(); + + bool new_state = false; + if (!strcmp(action->id, "ViewModeNormal")) { + new_state = mode == Inkscape::RENDERMODE_NORMAL; + } else if (!strcmp(action->id, "ViewModeNoFilters")) { + new_state = mode == Inkscape::RENDERMODE_NO_FILTERS; + } else if (!strcmp(action->id, "ViewModeOutline")) { + new_state = mode == Inkscape::RENDERMODE_OUTLINE; + } else { + g_warning("update_view_menu does not handle this verb"); + } + + if (new_state) { //only one of the radio buttons has to be activated; the others will automatically be deactivated + if (!gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (widget))) { + // When the GtkMenuItem version of the "activate" signal has been emitted by a GtkRadioMenuItem, there is a second + // emission as the most recently active item is toggled to inactive. This is dealt with before the original signal is handled. + // This emission however should not invoke any actions, hence we block it here: + temporarily_block_actions = true; + gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (widget), TRUE); + temporarily_block_actions = false; + } + } + + return FALSE; +} void sp_ui_menu_append_check_item_from_verb(GtkMenu *menu, Inkscape::UI::View::View *view, gchar const *label, gchar const *tip, gchar const *pref, @@ -870,7 +910,7 @@ private: a couple of submenus, it is unlikely this will go more than two or three times. - In the case of an unreconginzed verb, a menu item is made to identify + In the case of an unrecognized verb, a menu item is made to identify the verb that is missing, and display that. The menu item is also made insensitive. */ @@ -903,6 +943,10 @@ sp_ui_build_dyn_menus(Inkscape::XML::Node *menus, GtkWidget *menu, Inkscape::UI: if (menu_pntr->attribute("default") != NULL) { gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), TRUE); } + if (verb->get_code() != SP_VERB_NONE) { + SPAction *action = verb->get_action(view); + g_signal_connect( G_OBJECT(item), "expose_event", (GCallback) update_view_menu, (void *) action); + } } else { sp_ui_menu_append_item_from_verb(GTK_MENU(menu), verb, view); group = NULL; -- cgit v1.2.3 From ac75b20aebb67b665c402867135b0184c493d963 Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Wed, 29 Jul 2009 07:09:54 +0000 Subject: Fix for bug #396580 (non-ASCII characters not displayed correctly in the open dialog). (bzr r8355) --- src/ui/dialog/filedialogimpl-win32.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ui/dialog/filedialogimpl-win32.cpp b/src/ui/dialog/filedialogimpl-win32.cpp index 6fd753abb..0d8f0de5f 100644 --- a/src/ui/dialog/filedialogimpl-win32.cpp +++ b/src/ui/dialog/filedialogimpl-win32.cpp @@ -608,9 +608,12 @@ LRESULT CALLBACK FileOpenDialogImplWin32::preview_wnd_proc(HWND hwnd, UINT uMsg, if(pImpl->_path_string[0] == 0) { + WCHAR* noFileText=(WCHAR*)g_utf8_to_utf16(_("No file selected"), + -1, NULL, NULL, NULL); FillRect(dc, &rcClient, (HBRUSH)(COLOR_3DFACE + 1)); - DrawText(dc, _("No file selected"), -1, &rcClient, + DrawTextW(dc, noFileText, -1, &rcClient, DT_CENTER | DT_VCENTER | DT_NOPREFIX); + g_free(noFileText); } else if(pImpl->_preview_bitmap != NULL) { -- cgit v1.2.3 From f4d504c2d26ed9d1f72f99cfbe2d437555366c9c Mon Sep 17 00:00:00 2001 From: Maximilian Albert Date: Wed, 29 Jul 2009 18:17:12 +0000 Subject: Remove unnecessary tab in Layers dialog (closes LP #364224) (bzr r8358) --- src/ui/dialog/layers.cpp | 4 +--- src/ui/dialog/layers.h | 1 - 2 files changed, 1 insertion(+), 4 deletions(-) (limited to 'src') diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp index d79f18801..fa47ad88d 100644 --- a/src/ui/dialog/layers.cpp +++ b/src/ui/dialog/layers.cpp @@ -642,9 +642,7 @@ LayersPanel::LayersPanel() : _layersPage.pack_end(_compositeSettings, Gtk::PACK_SHRINK); _layersPage.pack_end(_buttonsRow, Gtk::PACK_SHRINK); - _notebook.append_page(_layersPage, _("Layers")); - - _getContents()->pack_start(_notebook, Gtk::PACK_EXPAND_WIDGET); + _getContents()->pack_start(_layersPage, Gtk::PACK_EXPAND_WIDGET); SPDesktop* targetDesktop = getDesktop(); diff --git a/src/ui/dialog/layers.h b/src/ui/dialog/layers.h index 1f593b9c6..16b3be350 100644 --- a/src/ui/dialog/layers.h +++ b/src/ui/dialog/layers.h @@ -117,7 +117,6 @@ private: Gtk::ScrolledWindow _scroller; Gtk::Menu _popupMenu; Gtk::SpinButton _spinBtn; - Gtk::Notebook _notebook; Gtk::VBox _layersPage; UI::Widget::StyleSubject::CurrentLayer _subject; -- cgit v1.2.3 From 80b7d8872d0893ec95c1f280a1f67a3dbbada99f Mon Sep 17 00:00:00 2001 From: Diederik van Lierop Date: Wed, 29 Jul 2009 19:10:49 +0000 Subject: Fix for bug #404488 by Yann Papouin (bzr r8359) --- src/display/canvas-axonomgrid.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/display/canvas-axonomgrid.cpp b/src/display/canvas-axonomgrid.cpp index 71b22d2ad..a92e7cf5b 100644 --- a/src/display/canvas-axonomgrid.cpp +++ b/src/display/canvas-axonomgrid.cpp @@ -311,7 +311,7 @@ CanvasAxonomGrid::readRepr() if ( (value = repr->attribute("spacingy")) ) { sp_nv_read_length(value, SP_UNIT_ABSOLUTE | SP_UNIT_DEVICE, &lengthy, &gridunit); lengthy = sp_units_get_pixels(lengthy, *(gridunit)); - if (lengthy < 1.0) lengthy = 1.0; + if (lengthy < 0.0500) lengthy = 0.0500; } if ( (value = repr->attribute("gridanglex")) ) { -- cgit v1.2.3 From 9889ebe49ba2e8132d6e49ac97622e2f5bdb2e78 Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Wed, 29 Jul 2009 19:46:17 +0000 Subject: Fix for bug LP #383244 (patch by Hannes Hochreiner) (bzr r8360) --- src/ui/dialog/document-properties.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index bb9ab4d02..423778276 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -653,7 +653,7 @@ void DocumentProperties::removeExternalScript(){ while ( current ) { SPObject* obj = SP_OBJECT(current->data); SPScript* script = (SPScript*) obj; - if (!name.compare(script->xlinkhref)){ + if (name == script->xlinkhref){ sp_repr_unparent(obj->repr); sp_document_done(SP_ACTIVE_DOCUMENT, SP_VERB_EDIT_REMOVE_EXTERNAL_SCRIPT, _("Remove external script")); } @@ -671,8 +671,12 @@ void DocumentProperties::populate_external_scripts_box(){ while ( current ) { SPObject* obj = SP_OBJECT(current->data); SPScript* script = (SPScript*) obj; - Gtk::TreeModel::Row row = *(_ExternalScriptsListStore->append()); - row[_ExternalScriptsListColumns.filenameColumn] = script->xlinkhref; + if (script->xlinkhref) + { + Gtk::TreeModel::Row row = *(_ExternalScriptsListStore->append()); + row[_ExternalScriptsListColumns.filenameColumn] = script->xlinkhref; + } + current = g_slist_next(current); } } -- cgit v1.2.3 From 2400be6dd81349d88a004ad61be6aac7772bf750 Mon Sep 17 00:00:00 2001 From: Diederik van Lierop Date: Wed, 29 Jul 2009 20:55:51 +0000 Subject: Snap guides to intersections of curves too (see bug #405419) (bzr r8361) --- src/object-snapper.cpp | 14 +++++++++++--- src/snap.cpp | 16 +++++++++++----- src/snap.h | 2 +- 3 files changed, 23 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/object-snapper.cpp b/src/object-snapper.cpp index 5dd9350dc..aece2e9ec 100644 --- a/src/object-snapper.cpp +++ b/src/object-snapper.cpp @@ -296,6 +296,13 @@ void Inkscape::ObjectSnapper::_snapTranslatingGuideToNodes(SnappedConstraints &s // Iterate through all nodes, find out which one is the closest to this guide, and snap to it! _collectNodes(t, true); + // Although we won't snap to paths here (which would give us under constrained snaps) we can still snap to intersections of paths. + if (_snapmanager->snapprefs.getSnapToItemPath() || _snapmanager->snapprefs.getSnapToBBoxPath() || _snapmanager->snapprefs.getSnapToPageBorder()) { + _collectPaths(t, true); + _snapPaths(sc, t, p, SNAPSOURCE_GUIDE, true, NULL, NULL); + // The paths themselves should be discarded in findBestSnap(), as we should only snap to their intersections + } + SnappedPoint s; Geom::Coord tol = getSnapperTolerance(); @@ -683,7 +690,7 @@ void Inkscape::ObjectSnapper::guideFreeSnap(SnappedConstraints &sc, _findCandidates(sp_document_root(_snapmanager->getDocument()), &it, true, Geom::Rect(p, p), snap_dim, false, Geom::identity()); _snapTranslatingGuideToNodes(sc, Inkscape::SnapPreferences::SNAPPOINT_GUIDE, p, guide_normal); - // _snapRotatingGuideToNodes has not been implemented yet. + } // This method is used to snap the origin of a guide to nodes/paths, while dragging the origin along the guide @@ -707,7 +714,7 @@ void Inkscape::ObjectSnapper::guideConstrainedSnap(SnappedConstraints &sc, _findCandidates(sp_document_root(_snapmanager->getDocument()), &it, true, Geom::Rect(p, p), snap_dim, false, Geom::identity()); _snapTranslatingGuideToNodes(sc, Inkscape::SnapPreferences::SNAPPOINT_GUIDE, p, guide_normal); - // _snapRotatingGuideToNodes has not been implemented yet. + } /** @@ -734,7 +741,8 @@ bool Inkscape::ObjectSnapper::GuidesMightSnap() const // almost the same as This || (_snapmanager->snapprefs.getSnapModeBBox() && _snapmanager->snapprefs.getSnapToBBoxNode()) || (_snapmanager->snapprefs.getSnapModeBBox() && (_snapmanager->snapprefs.getSnapBBoxEdgeMidpoints() || _snapmanager->snapprefs.getSnapBBoxMidpoints())) || (_snapmanager->snapprefs.getSnapModeNode() && (_snapmanager->snapprefs.getSnapLineMidpoints() || _snapmanager->snapprefs.getSnapObjectMidpoints())) - || (_snapmanager->snapprefs.getSnapModeNode() && _snapmanager->snapprefs.getIncludeItemCenter()); + || (_snapmanager->snapprefs.getSnapModeNode() && _snapmanager->snapprefs.getIncludeItemCenter()) + || (_snapmanager->snapprefs.getSnapModeNode() && (_snapmanager->snapprefs.getSnapToItemPath() && _snapmanager->snapprefs.getSnapIntersectionCS())); return (_snap_enabled && _snapmanager->snapprefs.getSnapModeGuide() && snap_to_something); } diff --git a/src/snap.cpp b/src/snap.cpp index 4d5dad55a..9b8a7aea7 100644 --- a/src/snap.cpp +++ b/src/snap.cpp @@ -428,7 +428,9 @@ void SnapManager::guideFreeSnap(Geom::Point &p, Geom::Point const &guide_normal) // We won't snap to grids, what's the use? - Inkscape::SnappedPoint const s = findBestSnap(p, Inkscape::SNAPSOURCE_GUIDE, sc, false); + // Including snapping to intersections of curves, but not to the curves themself! (see _snapTranslatingGuideToNodes in object-snapper.cpp) + Inkscape::SnappedPoint const s = findBestSnap(p, Inkscape::SNAPSOURCE_GUIDE, sc, false, true); + s.getPoint(p); } @@ -900,13 +902,15 @@ Inkscape::SnappedPoint SnapManager::constrainedSnapSkew(Inkscape::SnapPreference * \param source_type Detailed description of the source type, will be used by the snap indicator * \param sc A structure holding all snap targets that have been found so far * \param constrained True if the snap is constrained, e.g. for stretching or for purely horizontal translation. + * \param noCurves If true, then do consider snapping to intersections of curves, but not to the curves themself * \return An instance of the SnappedPoint class, which holds data on the snap source, snap target, and various metrics */ Inkscape::SnappedPoint SnapManager::findBestSnap(Geom::Point const &p, Inkscape::SnapSourceType const source_type, SnappedConstraints &sc, - bool constrained) const + bool constrained, + bool noCurves) const { /* @@ -928,9 +932,11 @@ Inkscape::SnappedPoint SnapManager::findBestSnap(Geom::Point const &p, } // search for the closest snapped curve - Inkscape::SnappedCurve closestCurve; - if (getClosestCurve(sc.curves, closestCurve)) { - sp_list.push_back(Inkscape::SnappedPoint(closestCurve)); + if (!noCurves) { + Inkscape::SnappedCurve closestCurve; + if (getClosestCurve(sc.curves, closestCurve)) { + sp_list.push_back(Inkscape::SnappedPoint(closestCurve)); + } } if (snapprefs.getSnapIntersectionCS()) { diff --git a/src/snap.h b/src/snap.h index 866775789..e360eda00 100644 --- a/src/snap.h +++ b/src/snap.h @@ -193,7 +193,7 @@ private: void _displaySnapsource(Inkscape::SnapPreferences::PointType point_type, std::pair const &p) const; - Inkscape::SnappedPoint findBestSnap(Geom::Point const &p, Inkscape::SnapSourceType const source_type, SnappedConstraints &sc, bool constrained) const; + Inkscape::SnappedPoint findBestSnap(Geom::Point const &p, Inkscape::SnapSourceType const source_type, SnappedConstraints &sc, bool constrained, bool noCurves = false) const; }; #endif /* !SEEN_SNAP_H */ -- cgit v1.2.3 From 1619e274a9d9193fbd6df1b7817beaa96d030e6a Mon Sep 17 00:00:00 2001 From: Diederik van Lierop Date: Sat, 1 Aug 2009 12:29:37 +0000 Subject: When switching context by pressing a key, while dragging to create a new shape, the original context should be finished properly and sp_canvas_item_ungrab should be called. set_event_context() was looking for e.g. sp_rect_context_finish, but this wasn't implemented for any of the shape tools. This closes bug #195101 (bzr r8375) --- src/arc-context.cpp | 16 ++++++++++++++++ src/box3d-context.cpp | 17 +++++++++++++++++ src/rect-context.cpp | 17 +++++++++++++++++ src/spiral-context.cpp | 16 ++++++++++++++++ src/star-context.cpp | 17 +++++++++++++++++ 5 files changed, 83 insertions(+) (limited to 'src') diff --git a/src/arc-context.cpp b/src/arc-context.cpp index dcb326bcd..e689c93db 100644 --- a/src/arc-context.cpp +++ b/src/arc-context.cpp @@ -50,6 +50,7 @@ static void sp_arc_context_init(SPArcContext *arc_context); static void sp_arc_context_dispose(GObject *object); static void sp_arc_context_setup(SPEventContext *ec); +static void sp_arc_context_finish(SPEventContext *ec); static gint sp_arc_context_root_handler(SPEventContext *event_context, GdkEvent *event); static gint sp_arc_context_item_handler(SPEventContext *event_context, SPItem *item, GdkEvent *event); @@ -89,6 +90,7 @@ static void sp_arc_context_class_init(SPArcContextClass *klass) object_class->dispose = sp_arc_context_dispose; event_context_class->setup = sp_arc_context_setup; + event_context_class->finish = sp_arc_context_finish; event_context_class->root_handler = sp_arc_context_root_handler; event_context_class->item_handler = sp_arc_context_item_handler; } @@ -111,6 +113,20 @@ static void sp_arc_context_init(SPArcContext *arc_context) new (&arc_context->sel_changed_connection) sigc::connection(); } +static void sp_arc_context_finish(SPEventContext *ec) +{ + SPArcContext *ac = SP_ARC_CONTEXT(ec); + SPDesktop *desktop = ec->desktop; + + sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), GDK_CURRENT_TIME); + sp_arc_finish(ac); + ac->sel_changed_connection.disconnect(); + + if (((SPEventContextClass *) parent_class)->finish) { + ((SPEventContextClass *) parent_class)->finish(ec); + } +} + static void sp_arc_context_dispose(GObject *object) { SPEventContext *ec = SP_EVENT_CONTEXT(object); diff --git a/src/box3d-context.cpp b/src/box3d-context.cpp index fd72e406b..128b5f2ff 100644 --- a/src/box3d-context.cpp +++ b/src/box3d-context.cpp @@ -54,6 +54,7 @@ static void sp_box3d_context_init(Box3DContext *box3d_context); static void sp_box3d_context_dispose(GObject *object); static void sp_box3d_context_setup(SPEventContext *ec); +static void sp_box3d_context_finish(SPEventContext *ec); static gint sp_box3d_context_root_handler(SPEventContext *event_context, GdkEvent *event); static gint sp_box3d_context_item_handler(SPEventContext *event_context, SPItem *item, GdkEvent *event); @@ -92,6 +93,7 @@ static void sp_box3d_context_class_init(Box3DContextClass *klass) object_class->dispose = sp_box3d_context_dispose; event_context_class->setup = sp_box3d_context_setup; + event_context_class->finish = sp_box3d_context_finish; event_context_class->root_handler = sp_box3d_context_root_handler; event_context_class->item_handler = sp_box3d_context_item_handler; } @@ -119,6 +121,21 @@ static void sp_box3d_context_init(Box3DContext *box3d_context) new (&box3d_context->sel_changed_connection) sigc::connection(); } +static void sp_box3d_context_finish(SPEventContext *ec) +{ + Box3DContext *bc = SP_BOX3D_CONTEXT(ec); + SPDesktop *desktop = ec->desktop; + + sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), GDK_CURRENT_TIME); + sp_box3d_finish(bc); + bc->sel_changed_connection.disconnect(); + + if (((SPEventContextClass *) parent_class)->finish) { + ((SPEventContextClass *) parent_class)->finish(ec); + } +} + + static void sp_box3d_context_dispose(GObject *object) { Box3DContext *bc = SP_BOX3D_CONTEXT(object); diff --git a/src/rect-context.cpp b/src/rect-context.cpp index ef5881378..b88b4b83a 100644 --- a/src/rect-context.cpp +++ b/src/rect-context.cpp @@ -50,6 +50,7 @@ static void sp_rect_context_init(SPRectContext *rect_context); static void sp_rect_context_dispose(GObject *object); static void sp_rect_context_setup(SPEventContext *ec); +static void sp_rect_context_finish(SPEventContext *ec); static void sp_rect_context_set(SPEventContext *ec, Inkscape::Preferences::Entry *val); static gint sp_rect_context_root_handler(SPEventContext *event_context, GdkEvent *event); @@ -91,6 +92,7 @@ static void sp_rect_context_class_init(SPRectContextClass *klass) object_class->dispose = sp_rect_context_dispose; event_context_class->setup = sp_rect_context_setup; + event_context_class->finish = sp_rect_context_finish; event_context_class->set = sp_rect_context_set; event_context_class->root_handler = sp_rect_context_root_handler; event_context_class->item_handler = sp_rect_context_item_handler; @@ -117,6 +119,21 @@ static void sp_rect_context_init(SPRectContext *rect_context) new (&rect_context->sel_changed_connection) sigc::connection(); } +static void sp_rect_context_finish(SPEventContext *ec) +{ + SPRectContext *rc = SP_RECT_CONTEXT(ec); + SPDesktop *desktop = ec->desktop; + + sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), GDK_CURRENT_TIME); + sp_rect_finish(rc); + rc->sel_changed_connection.disconnect(); + + if (((SPEventContextClass *) parent_class)->finish) { + ((SPEventContextClass *) parent_class)->finish(ec); + } +} + + static void sp_rect_context_dispose(GObject *object) { SPRectContext *rc = SP_RECT_CONTEXT(object); diff --git a/src/spiral-context.cpp b/src/spiral-context.cpp index 5c7c43c83..3825f74c7 100644 --- a/src/spiral-context.cpp +++ b/src/spiral-context.cpp @@ -46,6 +46,7 @@ static void sp_spiral_context_class_init(SPSpiralContextClass * klass); static void sp_spiral_context_init(SPSpiralContext *spiral_context); static void sp_spiral_context_dispose(GObject *object); static void sp_spiral_context_setup(SPEventContext *ec); +static void sp_spiral_context_finish(SPEventContext *ec); static void sp_spiral_context_set(SPEventContext *ec, Inkscape::Preferences::Entry *val); static gint sp_spiral_context_root_handler(SPEventContext *event_context, GdkEvent *event); @@ -87,6 +88,7 @@ sp_spiral_context_class_init(SPSpiralContextClass *klass) object_class->dispose = sp_spiral_context_dispose; event_context_class->setup = sp_spiral_context_setup; + event_context_class->finish = sp_spiral_context_finish; event_context_class->set = sp_spiral_context_set; event_context_class->root_handler = sp_spiral_context_root_handler; } @@ -114,6 +116,20 @@ sp_spiral_context_init(SPSpiralContext *spiral_context) new (&spiral_context->sel_changed_connection) sigc::connection(); } +static void sp_spiral_context_finish(SPEventContext *ec) +{ + SPSpiralContext *sc = SP_SPIRAL_CONTEXT(ec); + SPDesktop *desktop = ec->desktop; + + sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), GDK_CURRENT_TIME); + sp_spiral_finish(sc); + sc->sel_changed_connection.disconnect(); + + if (((SPEventContextClass *) parent_class)->finish) { + ((SPEventContextClass *) parent_class)->finish(ec); + } +} + static void sp_spiral_context_dispose(GObject *object) { diff --git a/src/star-context.cpp b/src/star-context.cpp index 80d378f27..3d6825e31 100644 --- a/src/star-context.cpp +++ b/src/star-context.cpp @@ -52,6 +52,7 @@ static void sp_star_context_init (SPStarContext * star_context); static void sp_star_context_dispose (GObject *object); static void sp_star_context_setup (SPEventContext *ec); +static void sp_star_context_finish(SPEventContext *ec); static void sp_star_context_set (SPEventContext *ec, Inkscape::Preferences::Entry *val); static gint sp_star_context_root_handler (SPEventContext *ec, GdkEvent *event); @@ -92,6 +93,7 @@ sp_star_context_class_init (SPStarContextClass * klass) object_class->dispose = sp_star_context_dispose; event_context_class->setup = sp_star_context_setup; + event_context_class->finish = sp_star_context_finish; event_context_class->set = sp_star_context_set; event_context_class->root_handler = sp_star_context_root_handler; } @@ -119,6 +121,21 @@ sp_star_context_init (SPStarContext * star_context) new (&star_context->sel_changed_connection) sigc::connection(); } +static void sp_star_context_finish(SPEventContext *ec) +{ + SPStarContext *sc = SP_STAR_CONTEXT(ec); + SPDesktop *desktop = ec->desktop; + + sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), GDK_CURRENT_TIME); + sp_star_finish(sc); + sc->sel_changed_connection.disconnect(); + + if (((SPEventContextClass *) parent_class)->finish) { + ((SPEventContextClass *) parent_class)->finish(ec); + } +} + + static void sp_star_context_dispose (GObject *object) { -- cgit v1.2.3 From d8d60c60ebeeefb068d9b68bf7d96f1f1f88518a Mon Sep 17 00:00:00 2001 From: Adib Taraben Date: Sat, 1 Aug 2009 23:31:02 +0000 Subject: FIX 309856 353847: correctly advertise exception leads to error message dialogue (bzr r8380) --- src/extension/implementation/script.cpp | 15 ++++++++++----- src/extension/implementation/script.h | 12 ++++++++---- src/extension/output.cpp | 2 +- src/extension/system.cpp | 14 +++++++++++++- 4 files changed, 32 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp index eabf147f6..e6ce40bc0 100644 --- a/src/extension/implementation/script.cpp +++ b/src/extension/implementation/script.cpp @@ -63,7 +63,7 @@ namespace Extension { namespace Implementation { /** \brief Make GTK+ events continue to come through a little bit - + This just keeps coming the events through so that we'll make the GUI update and look pretty. */ @@ -604,6 +604,7 @@ Script::open(Inkscape::Extension::Input *module, \param module Extention to be used \param doc Document to be saved \param filename The name to save the final file as + \return false in case of any failure writing the file, otherwise true Well, at some point people need to save - it is really what makes the entire application useful. And, it is possible that someone @@ -634,7 +635,7 @@ Script::save(Inkscape::Extension::Output *module, tempfd_in = Inkscape::IO::file_open_tmp(tempfilename_in, "ink_ext_XXXXXX.svg"); } catch (...) { /// \todo Popup dialog here - return; + throw Inkscape::Extension::Output::save_failed(); } if (helper_extension.size() == 0) { @@ -652,13 +653,17 @@ Script::save(Inkscape::Extension::Output *module, execute(command, params, tempfilename_in, fileout); std::string lfilename = Glib::filename_from_utf8(filenameArg); - fileout.toFile(lfilename); + bool success = fileout.toFile(lfilename); // make sure we don't leak file descriptors from g_file_open_tmp close(tempfd_in); // FIXME: convert to utf8 (from "filename encoding") and unlink_utf8name unlink(tempfilename_in.c_str()); + if(success == false) { + throw Inkscape::Extension::Output::save_failed(); + } + return; } @@ -840,7 +845,7 @@ Script::copy_doc (Inkscape::XML::Node * oldroot, Inkscape::XML::Node * newroot) { using Inkscape::Util::List; - using Inkscape::XML::AttributeRecord; + using Inkscape::XML::AttributeRecord; std::vector attribs; // Make a list of all attributes of the old root node. @@ -1007,7 +1012,7 @@ Script::execute (const std::list &in_command, for (std::list::const_iterator i = in_params.begin(); i != in_params.end(); i++) { //g_message("Script parameter: %s",(*i)g.c_str()); - argv.push_back(*i); + argv.push_back(*i); } if (!(filein.empty())) { diff --git a/src/extension/implementation/script.h b/src/extension/implementation/script.h index 4620375f9..8e25fb351 100644 --- a/src/extension/implementation/script.h +++ b/src/extension/implementation/script.h @@ -135,7 +135,7 @@ private: /** * */ - void checkStderr (const Glib::ustring &filename, + void checkStderr (const Glib::ustring &filename, Gtk::MessageType type, const Glib::ustring &message); @@ -146,7 +146,7 @@ private: Glib::RefPtr _channel; Glib::RefPtr _main_loop; bool _dead; - + public: file_listener () : _dead(false) { }; virtual ~file_listener () { @@ -187,11 +187,15 @@ private: // Note, doing a copy here, on purpose Glib::ustring string (void) { return _string; }; - void toFile (const Glib::ustring &name) { + bool toFile (const Glib::ustring &name) { + try { Glib::RefPtr stdout_file = Glib::IOChannel::create_from_file(name, "w"); stdout_file->set_encoding(); stdout_file->write(_string); - return; + } catch (Glib::FileError &e) { + return false; + } + return true; }; }; diff --git a/src/extension/output.cpp b/src/extension/output.cpp index e1481d000..742e938de 100644 --- a/src/extension/output.cpp +++ b/src/extension/output.cpp @@ -218,7 +218,7 @@ Output::save(SPDocument *doc, gchar const *filename) imp->save(this, doc, filename); } catch (...) { - g_warning("There was an error saving the file."); + throw Inkscape::Extension::Output::save_failed(); } return; diff --git a/src/extension/system.cpp b/src/extension/system.cpp index a7828d3fc..33ee544a1 100644 --- a/src/extension/system.cpp +++ b/src/extension/system.cpp @@ -277,7 +277,19 @@ save(Extension *key, SPDocument *doc, gchar const *filename, bool setextension, doc->setModifiedSinceSave(false); } - omod->save(doc, fileName); + try { + omod->save(doc, fileName); + } + catch(...) { + // free used ressources + if ( !official) { + g_free(saved_output_extension); + g_free(saved_dataloss); + } + g_free(fileName); + + throw Inkscape::Extension::Output::save_failed(); + } // If it is an unofficial save, set the modified attributes back to what they were. if ( !official) { -- cgit v1.2.3 From 211ec1ef762f2c2447fe8b5fc5c6ab8459a57558 Mon Sep 17 00:00:00 2001 From: Diederik van Lierop Date: Sun, 2 Aug 2009 09:55:12 +0000 Subject: Snap guides to grids (fixes bug #170741) (bzr r8381) --- src/desktop-events.cpp | 29 ++++------------------------- src/snap.cpp | 41 ++++++++++++++++++++++++----------------- src/snap.h | 10 +++++++++- 3 files changed, 37 insertions(+), 43 deletions(-) (limited to 'src') diff --git a/src/desktop-events.cpp b/src/desktop-events.cpp index 1fae9367c..cea478f85 100644 --- a/src/desktop-events.cpp +++ b/src/desktop-events.cpp @@ -150,7 +150,7 @@ static gint sp_dt_ruler_event(GtkWidget *widget, GdkEvent *event, SPDesktopWidge // We only have a temporary guide which is not stored in our document yet. // Because the guide snapper only looks in the document for guides to snap to, // we don't have to worry about a guide snapping to itself here - m.guideFreeSnap(event_dt, normal); + m.guideFreeSnap(event_dt, normal, SP_DRAG_MOVE_ORIGIN); sp_guideline_set_position(SP_GUIDELINE(guide), from_2geom(event_dt)); desktop->set_coordinate_status(to_2geom(event_dt)); @@ -168,7 +168,7 @@ static gint sp_dt_ruler_event(GtkWidget *widget, GdkEvent *event, SPDesktopWidge // We only have a temporary guide which is not stored in our document yet. // Because the guide snapper only looks in the document for guides to snap to, // we don't have to worry about a guide snapping to itself here - m.guideFreeSnap(event_dt, normal); + m.guideFreeSnap(event_dt, normal, SP_DRAG_MOVE_ORIGIN); dragging = false; @@ -213,15 +213,6 @@ int sp_dt_vruler_event(GtkWidget *widget, GdkEvent *event, SPDesktopWidget *dtw) return sp_dt_ruler_event(widget, event, dtw, false); } -/* Guides */ -enum SPGuideDragType { - SP_DRAG_TRANSLATE, - SP_DRAG_TRANSLATE_CONSTRAINED, // Is not being used currently! - SP_DRAG_ROTATE, - SP_DRAG_MOVE_ORIGIN, - SP_DRAG_NONE -}; - static Geom::Point drag_origin; static SPGuideDragType drag_type = SP_DRAG_NONE; //static bool reset_drag_origin = false; // when Ctrl is pressed while dragging, this is used to trigger resetting of the @@ -303,7 +294,7 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data) motion_dt = line.pointAt(t); m.guideConstrainedSnap(motion_dt, *guide); } else { - m.guideFreeSnap(motion_dt, guide->normal_to_line); + m.guideFreeSnap(motion_dt, guide->normal_to_line, drag_type); } switch (drag_type) { @@ -312,12 +303,6 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data) sp_guide_moveto(*guide, motion_dt, false); break; } - case SP_DRAG_TRANSLATE_CONSTRAINED: // Is not being used currently! - { - Geom::Point pt_constr = Geom::constrain_angle(guide->point_on_line, motion_dt); - sp_guide_moveto(*guide, pt_constr, false); - break; - } case SP_DRAG_ROTATE: { Geom::Point pt = motion_dt - guide->point_on_line; @@ -368,7 +353,7 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data) event_dt = line.pointAt(t); m.guideConstrainedSnap(event_dt, *guide); } else { - m.guideFreeSnap(event_dt, guide->normal_to_line); + m.guideFreeSnap(event_dt, guide->normal_to_line, drag_type); } if (sp_canvas_world_pt_inside_window(item->canvas, event_w)) { @@ -378,12 +363,6 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data) sp_guide_moveto(*guide, event_dt, true); break; } - case SP_DRAG_TRANSLATE_CONSTRAINED: // Is not being used currently! - { - Geom::Point pt_constr = Geom::constrain_angle(guide->point_on_line, event_dt); - sp_guide_moveto(*guide, pt_constr, true); - break; - } case SP_DRAG_ROTATE: { Geom::Point pt = event_dt - guide->point_on_line; diff --git a/src/snap.cpp b/src/snap.cpp index 9b8a7aea7..f0769e0a1 100644 --- a/src/snap.cpp +++ b/src/snap.cpp @@ -405,7 +405,7 @@ Inkscape::SnappedPoint SnapManager::constrainedSnap(Inkscape::SnapPreferences::P * \param p Current position of the point on the guide that is to be snapped; will be overwritten by the position of the snap target if snapping has occurred * \param guide_normal Vector normal to the guide line */ -void SnapManager::guideFreeSnap(Geom::Point &p, Geom::Point const &guide_normal) const +void SnapManager::guideFreeSnap(Geom::Point &p, Geom::Point const &guide_normal, SPGuideDragType drag_type) const { if (!snapprefs.getSnapEnabledGlobally() || snapprefs.getSnapPostponedGlobally()) { return; @@ -415,21 +415,26 @@ void SnapManager::guideFreeSnap(Geom::Point &p, Geom::Point const &guide_normal) return; } + Inkscape::SnapSourceType source_type = Inkscape::SNAPSOURCE_GUIDE_ORIGIN; + if (drag_type == SP_DRAG_ROTATE) { + source_type = Inkscape::SNAPSOURCE_GUIDE; + } + // Snap to nodes SnappedConstraints sc; if (object.GuidesMightSnap()) { object.guideFreeSnap(sc, p, guide_normal); } - // Snap to guides - if (snapprefs.getSnapToGuides()) { - guide.freeSnap(sc, Inkscape::SnapPreferences::SNAPPOINT_GUIDE, p, Inkscape::SNAPSOURCE_GUIDE, true, Geom::OptRect(), NULL, NULL); - } - - // We won't snap to grids, what's the use? + // Snap to guides & grid lines + SnapperList snappers = getGridSnappers(); + snappers.push_back(&guide); + for (SnapperList::const_iterator i = snappers.begin(); i != snappers.end(); i++) { + (*i)->freeSnap(sc, Inkscape::SnapPreferences::SNAPPOINT_GUIDE, p, source_type, true, Geom::OptRect(), NULL, NULL); + } - // Including snapping to intersections of curves, but not to the curves themself! (see _snapTranslatingGuideToNodes in object-snapper.cpp) - Inkscape::SnappedPoint const s = findBestSnap(p, Inkscape::SNAPSOURCE_GUIDE, sc, false, true); + // Snap to intersections of curves, but not to the curves themselves! (see _snapTranslatingGuideToNodes in object-snapper.cpp) + Inkscape::SnappedPoint const s = findBestSnap(p, source_type, sc, false, true); s.getPoint(p); } @@ -458,21 +463,23 @@ void SnapManager::guideConstrainedSnap(Geom::Point &p, SPGuide const &guideline) return; } + Inkscape::SnapSourceType source_type = Inkscape::SNAPSOURCE_GUIDE_ORIGIN; + // Snap to nodes or paths SnappedConstraints sc; Inkscape::Snapper::ConstraintLine cl(guideline.point_on_line, Geom::rot90(guideline.normal_to_line)); if (object.ThisSnapperMightSnap()) { - object.constrainedSnap(sc, Inkscape::SnapPreferences::SNAPPOINT_GUIDE, p, Inkscape::SNAPSOURCE_GUIDE_ORIGIN, true, Geom::OptRect(), cl, NULL); - } - - // Snap to guides - if (snapprefs.getSnapToGuides()) { - guide.constrainedSnap(sc, Inkscape::SnapPreferences::SNAPPOINT_GUIDE, p, Inkscape::SNAPSOURCE_GUIDE_ORIGIN, true, Geom::OptRect(), cl, NULL); + object.constrainedSnap(sc, Inkscape::SnapPreferences::SNAPPOINT_GUIDE, p, source_type, true, Geom::OptRect(), cl, NULL); } - // We won't snap to grids, what's the use? + // Snap to guides & grid lines + SnapperList snappers = getGridSnappers(); + snappers.push_back(&guide); + for (SnapperList::const_iterator i = snappers.begin(); i != snappers.end(); i++) { + (*i)->constrainedSnap(sc, Inkscape::SnapPreferences::SNAPPOINT_GUIDE, p, source_type, true, Geom::OptRect(), cl, NULL); + } - Inkscape::SnappedPoint const s = findBestSnap(p, Inkscape::SNAPSOURCE_GUIDE, sc, false); + Inkscape::SnappedPoint const s = findBestSnap(p, source_type, sc, false); s.getPoint(p); } diff --git a/src/snap.h b/src/snap.h index e360eda00..e621bdb60 100644 --- a/src/snap.h +++ b/src/snap.h @@ -31,6 +31,14 @@ #include "object-snapper.h" #include "snap-preferences.h" +/* Guides */ +enum SPGuideDragType { // used both here and in desktop-events.cpp + SP_DRAG_TRANSLATE, + SP_DRAG_ROTATE, + SP_DRAG_MOVE_ORIGIN, + SP_DRAG_NONE +}; + class SPNamedView; /// Class to coordinate snapping operations @@ -103,7 +111,7 @@ public: bool first_point = true, Geom::OptRect const &bbox_to_snap = Geom::OptRect()) const; - void guideFreeSnap(Geom::Point &p, Geom::Point const &guide_normal) const; + void guideFreeSnap(Geom::Point &p, Geom::Point const &guide_normal, SPGuideDragType drag_type) const; void guideConstrainedSnap(Geom::Point &p, SPGuide const &guideline) const; Inkscape::SnappedPoint freeSnapTranslation(Inkscape::SnapPreferences::PointType point_type, -- cgit v1.2.3 From 1491c7366dff69bc5e5dc9de5c6574f71d31ed1b Mon Sep 17 00:00:00 2001 From: Diederik van Lierop Date: Sun, 2 Aug 2009 12:32:58 +0000 Subject: Snap to a guide's origin too (resulting in a 2D constraint), instead of only to the guide itself (only 1D constraint) (bzr r8383) --- src/display/snap-indicator.cpp | 317 +++++++++++++++++++++-------------------- src/guide-snapper.cpp | 27 ++-- src/guide-snapper.h | 1 + src/line-snapper.cpp | 52 +++++-- src/line-snapper.h | 6 +- src/snapped-point.h | 1 + 6 files changed, 225 insertions(+), 179 deletions(-) (limited to 'src') diff --git a/src/display/snap-indicator.cpp b/src/display/snap-indicator.cpp index 081496fd0..20ea7d58c 100644 --- a/src/display/snap-indicator.cpp +++ b/src/display/snap-indicator.cpp @@ -26,8 +26,8 @@ namespace Display { SnapIndicator::SnapIndicator(SPDesktop * desktop) : _snaptarget(NULL), - _snaptarget_tooltip(NULL), - _snapsource(NULL), + _snaptarget_tooltip(NULL), + _snapsource(NULL), _desktop(desktop) { } @@ -35,14 +35,14 @@ SnapIndicator::SnapIndicator(SPDesktop * desktop) SnapIndicator::~SnapIndicator() { // remove item that might be present - remove_snaptarget(); - remove_snapsource(); + remove_snaptarget(); + remove_snapsource(); } void SnapIndicator::set_new_snaptarget(Inkscape::SnappedPoint const p) { - remove_snaptarget(); //only display one snaptarget at a time + remove_snaptarget(); //only display one snaptarget at a time g_assert(_desktop != NULL); @@ -59,191 +59,194 @@ SnapIndicator::set_new_snaptarget(Inkscape::SnappedPoint const p) // TRANSLATORS: undefined target for snapping gchar *target_name = _("UNDEFINED"); switch (p.getTarget()) { - case SNAPTARGET_UNDEFINED: - target_name = _("UNDEFINED"); - break; - case SNAPTARGET_GRID: - target_name = _("grid line"); - break; + case SNAPTARGET_UNDEFINED: + target_name = _("UNDEFINED"); + break; + case SNAPTARGET_GRID: + target_name = _("grid line"); + break; case SNAPTARGET_GRID_INTERSECTION: - target_name = _("grid intersection"); - break; + target_name = _("grid intersection"); + break; case SNAPTARGET_GUIDE: - target_name = _("guide"); - break; + target_name = _("guide"); + break; case SNAPTARGET_GUIDE_INTERSECTION: - target_name = _("guide intersection"); - break; + target_name = _("guide intersection"); + break; + case SNAPTARGET_GUIDE_ORIGIN: + target_name = _("guide origin"); + break; case SNAPTARGET_GRID_GUIDE_INTERSECTION: - target_name = _("grid-guide intersection"); - break; + target_name = _("grid-guide intersection"); + break; case SNAPTARGET_NODE_CUSP: - target_name = _("cusp node"); - break; + target_name = _("cusp node"); + break; case SNAPTARGET_NODE_SMOOTH: - target_name = _("smooth node"); - break; - case SNAPTARGET_PATH: - target_name = _("path"); - break; + target_name = _("smooth node"); + break; + case SNAPTARGET_PATH: + target_name = _("path"); + break; case SNAPTARGET_PATH_INTERSECTION: - target_name = _("path intersection"); - break; + target_name = _("path intersection"); + break; case SNAPTARGET_BBOX_CORNER: - target_name = _("bounding box corner"); - break; + target_name = _("bounding box corner"); + break; case SNAPTARGET_BBOX_EDGE: - target_name = _("bounding box side"); - break; + target_name = _("bounding box side"); + break; case SNAPTARGET_GRADIENTS_PARENT_BBOX: - target_name = _("bounding box"); - break; + target_name = _("bounding box"); + break; case SNAPTARGET_PAGE_BORDER: - target_name = _("page border"); - break; + target_name = _("page border"); + break; case SNAPTARGET_LINE_MIDPOINT: - target_name = _("line midpoint"); - break; + target_name = _("line midpoint"); + break; case SNAPTARGET_OBJECT_MIDPOINT: - target_name = _("object midpoint"); - break; + target_name = _("object midpoint"); + break; case SNAPTARGET_ROTATION_CENTER: - target_name = _("object rotation center"); - break; + target_name = _("object rotation center"); + break; case SNAPTARGET_HANDLE: - target_name = _("handle"); - break; + target_name = _("handle"); + break; case SNAPTARGET_BBOX_EDGE_MIDPOINT: - target_name = _("bounding box side midpoint"); - break; + target_name = _("bounding box side midpoint"); + break; case SNAPTARGET_BBOX_MIDPOINT: - target_name = _("bounding box midpoint"); - break; + target_name = _("bounding box midpoint"); + break; case SNAPTARGET_PAGE_CORNER: - target_name = _("page corner"); - break; + target_name = _("page corner"); + break; case SNAPTARGET_CONVEX_HULL_CORNER: - target_name = _("convex hull corner"); - break; + target_name = _("convex hull corner"); + break; case SNAPTARGET_ELLIPSE_QUADRANT_POINT: - target_name = _("quadrant point"); - break; + target_name = _("quadrant point"); + break; case SNAPTARGET_CENTER: - target_name = _("center"); - break; + target_name = _("center"); + break; case SNAPTARGET_CORNER: - target_name = _("corner"); - break; + target_name = _("corner"); + break; case SNAPTARGET_TEXT_BASELINE: - target_name = _("text baseline"); - break; + target_name = _("text baseline"); + break; default: - g_warning("Snap target has not yet been defined!"); + g_warning("Snap target has not yet been defined!"); break; } gchar *source_name = _("UNDEFINED"); - switch (p.getSource()) { - case SNAPSOURCE_UNDEFINED: - source_name = _("UNDEFINED"); - break; - case SNAPSOURCE_BBOX_CORNER: - source_name = _("Bounding box corner"); - break; - case SNAPSOURCE_BBOX_MIDPOINT: - source_name = _("Bounding box midpoint"); - break; - case SNAPSOURCE_BBOX_EDGE_MIDPOINT: - source_name = _("Bounding box side midpoint"); - break; - case SNAPSOURCE_NODE_SMOOTH: - source_name = _("Smooth node"); - break; - case SNAPSOURCE_NODE_CUSP: - source_name = _("Cusp node"); - break; - case SNAPSOURCE_LINE_MIDPOINT: - source_name = _("Line midpoint"); - break; - case SNAPSOURCE_OBJECT_MIDPOINT: - source_name = _("Object midpoint"); - break; - case SNAPSOURCE_ROTATION_CENTER: - source_name = _("Object rotation center"); - break; - case SNAPSOURCE_HANDLE: - source_name = _("Handle"); - break; - case SNAPSOURCE_PATH_INTERSECTION: - source_name = _("Path intersection"); - break; - case SNAPSOURCE_GUIDE: - source_name = _("Guide"); - break; - case SNAPSOURCE_GUIDE_ORIGIN: - source_name = _("Guide origin"); - break; - case SNAPSOURCE_CONVEX_HULL_CORNER: - source_name = _("Convex hull corner"); - break; - case SNAPSOURCE_ELLIPSE_QUADRANT_POINT: - source_name = _("Quadrant point"); - break; - case SNAPSOURCE_CENTER: - source_name = _("Center"); - break; - case SNAPSOURCE_CORNER: - source_name = _("Corner"); - break; - case SNAPSOURCE_TEXT_BASELINE: - source_name = _("Text baseline"); - break; - default: - g_warning("Snap source has not yet been defined!"); - break; - } + switch (p.getSource()) { + case SNAPSOURCE_UNDEFINED: + source_name = _("UNDEFINED"); + break; + case SNAPSOURCE_BBOX_CORNER: + source_name = _("Bounding box corner"); + break; + case SNAPSOURCE_BBOX_MIDPOINT: + source_name = _("Bounding box midpoint"); + break; + case SNAPSOURCE_BBOX_EDGE_MIDPOINT: + source_name = _("Bounding box side midpoint"); + break; + case SNAPSOURCE_NODE_SMOOTH: + source_name = _("Smooth node"); + break; + case SNAPSOURCE_NODE_CUSP: + source_name = _("Cusp node"); + break; + case SNAPSOURCE_LINE_MIDPOINT: + source_name = _("Line midpoint"); + break; + case SNAPSOURCE_OBJECT_MIDPOINT: + source_name = _("Object midpoint"); + break; + case SNAPSOURCE_ROTATION_CENTER: + source_name = _("Object rotation center"); + break; + case SNAPSOURCE_HANDLE: + source_name = _("Handle"); + break; + case SNAPSOURCE_PATH_INTERSECTION: + source_name = _("Path intersection"); + break; + case SNAPSOURCE_GUIDE: + source_name = _("Guide"); + break; + case SNAPSOURCE_GUIDE_ORIGIN: + source_name = _("Guide origin"); + break; + case SNAPSOURCE_CONVEX_HULL_CORNER: + source_name = _("Convex hull corner"); + break; + case SNAPSOURCE_ELLIPSE_QUADRANT_POINT: + source_name = _("Quadrant point"); + break; + case SNAPSOURCE_CENTER: + source_name = _("Center"); + break; + case SNAPSOURCE_CORNER: + source_name = _("Corner"); + break; + case SNAPSOURCE_TEXT_BASELINE: + source_name = _("Text baseline"); + break; + default: + g_warning("Snap source has not yet been defined!"); + break; + } //std::cout << "Snapped " << source_name << " to " << target_name << std::endl; - remove_snapsource(); // Don't set both the source and target indicators, as these will overlap + remove_snapsource(); // Don't set both the source and target indicators, as these will overlap // Display the snap indicator (i.e. the cross) SPCanvasItem * canvasitem = NULL; - if (p.getTarget() == SNAPTARGET_NODE_SMOOTH || p.getTarget() == SNAPTARGET_NODE_CUSP) { - canvasitem = sp_canvas_item_new(sp_desktop_tempgroup (_desktop), - SP_TYPE_CTRL, - "anchor", GTK_ANCHOR_CENTER, - "size", 10.0, - "stroked", TRUE, - "stroke_color", 0xf000f0ff, - "mode", SP_KNOT_MODE_XOR, - "shape", SP_KNOT_SHAPE_DIAMOND, - NULL ); - } else { - canvasitem = sp_canvas_item_new(sp_desktop_tempgroup (_desktop), - SP_TYPE_CTRL, - "anchor", GTK_ANCHOR_CENTER, - "size", 10.0, - "stroked", TRUE, - "stroke_color", 0xf000f0ff, - "mode", SP_KNOT_MODE_XOR, - "shape", SP_KNOT_SHAPE_CROSS, - NULL ); - } + if (p.getTarget() == SNAPTARGET_NODE_SMOOTH || p.getTarget() == SNAPTARGET_NODE_CUSP) { + canvasitem = sp_canvas_item_new(sp_desktop_tempgroup (_desktop), + SP_TYPE_CTRL, + "anchor", GTK_ANCHOR_CENTER, + "size", 10.0, + "stroked", TRUE, + "stroke_color", 0xf000f0ff, + "mode", SP_KNOT_MODE_XOR, + "shape", SP_KNOT_SHAPE_DIAMOND, + NULL ); + } else { + canvasitem = sp_canvas_item_new(sp_desktop_tempgroup (_desktop), + SP_TYPE_CTRL, + "anchor", GTK_ANCHOR_CENTER, + "size", 10.0, + "stroked", TRUE, + "stroke_color", 0xf000f0ff, + "mode", SP_KNOT_MODE_XOR, + "shape", SP_KNOT_SHAPE_CROSS, + NULL ); + } - const int timeout_val = 1200; // TODO add preference for snap indicator timeout? + const int timeout_val = 1200; // TODO add preference for snap indicator timeout? - SP_CTRL(canvasitem)->moveto(p.getPoint()); - _snaptarget = _desktop->add_temporary_canvasitem(canvasitem, timeout_val); + SP_CTRL(canvasitem)->moveto(p.getPoint()); + _snaptarget = _desktop->add_temporary_canvasitem(canvasitem, timeout_val); - gchar *tooltip_str = g_strconcat(source_name, _(" to "), target_name, NULL); - Geom::Point tooltip_pos = p.getPoint() + _desktop->w2d(Geom::Point(15, -15)); + gchar *tooltip_str = g_strconcat(source_name, _(" to "), target_name, NULL); + Geom::Point tooltip_pos = p.getPoint() + _desktop->w2d(Geom::Point(15, -15)); - SPCanvasItem *canvas_tooltip = sp_canvastext_new(sp_desktop_tempgroup(_desktop), _desktop, tooltip_pos, tooltip_str); - g_free(tooltip_str); + SPCanvasItem *canvas_tooltip = sp_canvastext_new(sp_desktop_tempgroup(_desktop), _desktop, tooltip_pos, tooltip_str); + g_free(tooltip_str); - sp_canvastext_set_anchor((SPCanvasText* )canvas_tooltip, -1, 1); - _snaptarget_tooltip = _desktop->add_temporary_canvasitem(canvas_tooltip, timeout_val); - } + sp_canvastext_set_anchor((SPCanvasText* )canvas_tooltip, -1, 1); + _snaptarget_tooltip = _desktop->add_temporary_canvasitem(canvas_tooltip, timeout_val); + } } void @@ -255,16 +258,16 @@ SnapIndicator::remove_snaptarget() } if (_snaptarget_tooltip) { - _desktop->remove_temporary_canvasitem(_snaptarget_tooltip); - _snaptarget_tooltip = NULL; - } + _desktop->remove_temporary_canvasitem(_snaptarget_tooltip); + _snaptarget_tooltip = NULL; + } } void SnapIndicator::set_new_snapsource(std::pair const p) { - remove_snapsource(); + remove_snapsource(); g_assert(_desktop != NULL); @@ -284,7 +287,7 @@ SnapIndicator::set_new_snapsource(std::pair const p) SP_CTRL(canvasitem)->moveto(p.first); _snapsource = _desktop->add_temporary_canvasitem(canvasitem, 1000); - } + } } void diff --git a/src/guide-snapper.cpp b/src/guide-snapper.cpp index 3a9a861e5..5cf97958a 100644 --- a/src/guide-snapper.cpp +++ b/src/guide-snapper.cpp @@ -26,9 +26,9 @@ Inkscape::GuideSnapper::GuideSnapper(SnapManager *sm, Geom::Coord const d) : Lin */ Geom::Coord Inkscape::GuideSnapper::getSnapperTolerance() const { - SPDesktop const *dt = _snapmanager->getDesktop(); - double const zoom = dt ? dt->current_zoom() : 1; - return _snapmanager->snapprefs.getGuideTolerance() / zoom; + SPDesktop const *dt = _snapmanager->getDesktop(); + double const zoom = dt ? dt->current_zoom() : 1; + return _snapmanager->snapprefs.getGuideTolerance() / zoom; } bool Inkscape::GuideSnapper::getSnapperAlwaysSnap() const @@ -49,7 +49,7 @@ Inkscape::GuideSnapper::LineList Inkscape::GuideSnapper::_getSnapLines(Geom::Poi for (GSList const *l = _snapmanager->getNamedView()->guides; l != NULL; l = l->next) { SPGuide const *g = SP_GUIDE(l->data); if (g != guide_to_ignore) { - s.push_back(std::make_pair(g->normal_to_line, g->point_on_line)); + s.push_back(std::make_pair(g->normal_to_line, g->point_on_line)); } } @@ -61,11 +61,11 @@ Inkscape::GuideSnapper::LineList Inkscape::GuideSnapper::_getSnapLines(Geom::Poi */ bool Inkscape::GuideSnapper::ThisSnapperMightSnap() const { - if (_snapmanager->getNamedView() == NULL) { - return false; - } + if (_snapmanager->getNamedView() == NULL) { + return false; + } - return (_snap_enabled && _snapmanager->snapprefs.getSnapToGuides() && _snapmanager->getNamedView()->showguides); + return (_snap_enabled && _snapmanager->snapprefs.getSnapToGuides() && _snapmanager->getNamedView()->showguides); } void Inkscape::GuideSnapper::_addSnappedLine(SnappedConstraints &sc, Geom::Point const snapped_point, Geom::Coord const snapped_distance, SnapSourceType const &source, Geom::Point const normal_to_line, Geom::Point const point_on_line) const @@ -74,10 +74,17 @@ void Inkscape::GuideSnapper::_addSnappedLine(SnappedConstraints &sc, Geom::Point sc.guide_lines.push_back(dummy); } +void Inkscape::GuideSnapper::_addSnappedLinesOrigin(SnappedConstraints &sc, Geom::Point const origin, Geom::Coord const snapped_distance, SnapSourceType const &source) const +{ + SnappedPoint dummy = SnappedPoint(origin, source, Inkscape::SNAPTARGET_GUIDE_ORIGIN, snapped_distance, getSnapperTolerance(), getSnapperAlwaysSnap(), true); + sc.points.push_back(dummy); +} + + void Inkscape::GuideSnapper::_addSnappedPoint(SnappedConstraints &sc, Geom::Point const snapped_point, Geom::Coord const snapped_distance, SnapSourceType const &source) const { - SnappedPoint dummy = SnappedPoint(snapped_point, source, Inkscape::SNAPTARGET_GUIDE, snapped_distance, getSnapperTolerance(), getSnapperAlwaysSnap(), true); - sc.points.push_back(dummy); + SnappedPoint dummy = SnappedPoint(snapped_point, source, Inkscape::SNAPTARGET_GUIDE, snapped_distance, getSnapperTolerance(), getSnapperAlwaysSnap(), true); + sc.points.push_back(dummy); } /* diff --git a/src/guide-snapper.h b/src/guide-snapper.h index f9f433bf4..1dc602f72 100644 --- a/src/guide-snapper.h +++ b/src/guide-snapper.h @@ -35,6 +35,7 @@ public: private: LineList _getSnapLines(Geom::Point const &p) const; void _addSnappedLine(SnappedConstraints &sc, Geom::Point const snapped_point, Geom::Coord const snapped_distance, SnapSourceType const &source, Geom::Point const normal_to_line, Geom::Point const point_on_line) const; + void _addSnappedLinesOrigin(SnappedConstraints &sc, Geom::Point const origin, Geom::Coord const snapped_distance, SnapSourceType const &source) const; void _addSnappedPoint(SnappedConstraints &sc, Geom::Point const snapped_point, Geom::Coord const snapped_distance, SnapSourceType const &source) const; }; diff --git a/src/line-snapper.cpp b/src/line-snapper.cpp index 73f46c0a2..5d5a77280 100644 --- a/src/line-snapper.cpp +++ b/src/line-snapper.cpp @@ -14,7 +14,7 @@ #include <2geom/line.h> #include "line-snapper.h" #include "snapped-line.h" -#include +//#include #include "snap.h" Inkscape::LineSnapper::LineSnapper(SnapManager *sm, Geom::Coord const d) : Snapper(sm, d) @@ -30,7 +30,7 @@ void Inkscape::LineSnapper::freeSnap(SnappedConstraints &sc, std::vector const */*it*/, std::vector > */*unselected_nodes*/) const { - if (!(_snap_enabled && _snapmanager->snapprefs.getSnapFrom(t)) ) { + if (!(_snap_enabled && _snapmanager->snapprefs.getSnapFrom(t)) ) { return; } @@ -50,6 +50,15 @@ void Inkscape::LineSnapper::freeSnap(SnappedConstraints &sc, //Store any line that's within snapping range if (dist < getSnapperTolerance()) { _addSnappedLine(sc, p_proj, dist, source_type, i->first, i->second); + // For any line that's within range, we will also look at it's "point on line" p1. For guides + // this point coincides with its origin; for grids this is of no use, but we cannot + // discern between grids and guides here + Geom::Coord const dist_p1 = Geom::L2(p1 - p); + if (dist_p1 < getSnapperTolerance()) { + _addSnappedLinesOrigin(sc, p1, dist_p1, source_type); + // Only relevant for guides; grids don't have an origin per line + // Therefore _addSnappedLinesOrigin() will only be implemented for guides + } // std::cout << " -> distance = " << dist; } // std::cout << std::endl; @@ -75,35 +84,56 @@ void Inkscape::LineSnapper::constrainedSnap(SnappedConstraints &sc, for (LineList::const_iterator i = lines.begin(); i != lines.end(); i++) { if (Geom::L2(c.getDirection()) > 0) { // Can't do a constrained snap without a constraint - Geom::Point const point_on_line = c.hasPoint() ? c.getPoint() : p; + // constraint line + Geom::Point const point_on_line = c.hasPoint() ? c.getPoint() : p; Geom::Line line1(point_on_line, point_on_line + c.getDirection()); - Geom::Line line2(i->second, i->second + Geom::rot90(i->first)); + + // grid/guide line + Geom::Point const p1 = i->second; // point at guide/grid line + Geom::Point const p2 = p1 + Geom::rot90(i->first); // 2nd point at guide/grid line + Geom::Line line2(p1, p2); + Geom::OptCrossing inters = Geom::OptCrossing(); // empty by default try { - inters = Geom::intersection(line1, line2); + inters = Geom::intersection(line1, line2); } catch (Geom::InfiniteSolutions e) { - // We're probably dealing with parallel lines, so snapping doesn't make any sense here - continue; // jump to the next iterator in the for-loop + // We're probably dealing with parallel lines, so snapping doesn't make any sense here + continue; // jump to the next iterator in the for-loop } - if (inters) { - Geom::Point t = line1.pointAt((*inters).ta); - const Geom::Coord dist = Geom::L2(t - p); + if (inters) { + Geom::Point t = line1.pointAt((*inters).ta); + const Geom::Coord dist = Geom::L2(t - p); if (dist < getSnapperTolerance()) { - // When doing a constrained snap, we're already at an intersection. + // When doing a constrained snap, we're already at an intersection. // This snappoint is therefore fully constrained, so there's no need // to look for additional intersections; just return the snapped point // and forget about the line _addSnappedPoint(sc, t, dist, source_type); + // For any line that's within range, we will also look at it's "point on line" p1. For guides + // this point coincides with its origin; for grids this is of no use, but we cannot + // discern between grids and guides here + Geom::Coord const dist_p1 = Geom::L2(p1 - p); + if (dist_p1 < getSnapperTolerance()) { + _addSnappedLinesOrigin(sc, p1, dist_p1, source_type); + // Only relevant for guides; grids don't have an origin per line + // Therefore _addSnappedLinesOrigin() will only be implemented for guides + } } } } } } +// Will only be overridden in the guide-snapper class, because grid lines don't have an origin; the +// grid-snapper classes will use this default empty method +void Inkscape::LineSnapper::_addSnappedLinesOrigin(SnappedConstraints &/*sc*/, Geom::Point const /*origin*/, Geom::Coord const /*snapped_distance*/, SnapSourceType const &/*source_type*/) const +{ +} + /* Local Variables: mode:c++ diff --git a/src/line-snapper.h b/src/line-snapper.h index 4c971d238..4ad08a99f 100644 --- a/src/line-snapper.h +++ b/src/line-snapper.h @@ -7,7 +7,7 @@ * * Authors: * Carl Hetherington - * Diederik van Lierop + * Diederik van Lierop * * Copyright (C) 1999-2008 Authors * @@ -55,6 +55,10 @@ private: virtual LineList _getSnapLines(Geom::Point const &p) const = 0; virtual void _addSnappedLine(SnappedConstraints &sc, Geom::Point const snapped_point, Geom::Coord const snapped_distance, SnapSourceType const &source, Geom::Point const normal_to_line, Geom::Point const point_on_line) const = 0; + + // Will only be implemented for guide lines, because grid lines don't have an origin + virtual void _addSnappedLinesOrigin(SnappedConstraints &sc, Geom::Point const origin, Geom::Coord const snapped_distance, SnapSourceType const &source) const; + virtual void _addSnappedPoint(SnappedConstraints &sc, Geom::Point const snapped_point, Geom::Coord const snapped_distance, SnapSourceType const &source) const = 0; }; diff --git a/src/snapped-point.h b/src/snapped-point.h index d071afddc..70d16b0be 100644 --- a/src/snapped-point.h +++ b/src/snapped-point.h @@ -26,6 +26,7 @@ enum SnapTargetType { SNAPTARGET_GRID_INTERSECTION, SNAPTARGET_GUIDE, SNAPTARGET_GUIDE_INTERSECTION, + SNAPTARGET_GUIDE_ORIGIN, SNAPTARGET_GRID_GUIDE_INTERSECTION, SNAPTARGET_NODE_SMOOTH, SNAPTARGET_NODE_CUSP, -- cgit v1.2.3 From 49e03ce9c287145a875165538ee90b7ccd575004 Mon Sep 17 00:00:00 2001 From: theAdib Date: Sun, 2 Aug 2009 15:04:57 +0000 Subject: FIX 407115 test writing into file and throw exception upstream if needed (bzr r8384) --- src/io/uristream.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/io/uristream.cpp b/src/io/uristream.cpp index f529c7f8b..05d7f020a 100644 --- a/src/io/uristream.cpp +++ b/src/io/uristream.cpp @@ -429,7 +429,10 @@ void UriOutputStream::put(int ch) throw(StreamException) if (!outf) return; uch = (unsigned char)(ch & 0xff); - fputc(uch, outf); + if (fputc(uch, outf) == EOF) { + Glib::ustring err = "ERROR writing to file "; + throw StreamException(err); + } //fwrite(uch, 1, 1, outf); break; -- cgit v1.2.3 From d9804423fd9a07b20cce408d514099a72038a74a Mon Sep 17 00:00:00 2001 From: Thomas Holder Date: Sun, 2 Aug 2009 17:09:03 +0000 Subject: remember sticky_zoom toggle button state use short side ratio instead of area ratio for sticky zoom (revise commit 21355) (bzr r8386) --- src/widgets/desktop-widget.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index 9ccc8e80d..a2f88c16d 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -112,6 +112,7 @@ static void sp_dtw_zoom_200 (GtkMenuItem *item, gpointer data); static void sp_dtw_zoom_page (GtkMenuItem *item, gpointer data); static void sp_dtw_zoom_drawing (GtkMenuItem *item, gpointer data); static void sp_dtw_zoom_selection (GtkMenuItem *item, gpointer data); +static void sp_dtw_sticky_zoom_toggled (GtkMenuItem *item, gpointer data); SPViewWidgetClass *dtw_parent_class; @@ -379,6 +380,7 @@ sp_desktop_widget_init (SPDesktopWidget *dtw) dtw->tt); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dtw->sticky_zoom), prefs->getBool("/options/stickyzoom/value")); gtk_box_pack_start (GTK_BOX (dtw->vscrollbar_box), dtw->sticky_zoom, FALSE, FALSE, 0); + g_signal_connect (G_OBJECT (dtw->sticky_zoom), "toggled", G_CALLBACK (sp_dtw_sticky_zoom_toggled), dtw); dtw->vadj = (GtkAdjustment *) gtk_adjustment_new (0.0, -4000.0, 4000.0, 10.0, 100.0, 4.0); dtw->vscrollbar = gtk_vscrollbar_new (GTK_ADJUSTMENT (dtw->vadj)); gtk_box_pack_start (GTK_BOX (dtw->vscrollbar_box), dtw->vscrollbar, TRUE, TRUE, 0); @@ -659,7 +661,9 @@ sp_desktop_widget_size_allocate (GtkWidget *widget, GtkAllocation *allocation) /* Find new visible area */ Geom::Rect newarea = dtw->desktop->get_display_area(); /* Calculate adjusted zoom */ - zoom *= sqrt(newarea.area() / area.area()); + double oldshortside = MIN( area.width(), area.height()); + double newshortside = MIN(newarea.width(), newarea.height()); + zoom *= newshortside / oldshortside; } dtw->desktop->zoom_absolute(area.midpoint()[Geom::X], area.midpoint()[Geom::Y], zoom); @@ -1613,6 +1617,13 @@ sp_dtw_zoom_selection (GtkMenuItem */*item*/, gpointer data) static_cast(data)->zoom_selection(); } +static void +sp_dtw_sticky_zoom_toggled (GtkMenuItem *, gpointer data) +{ + SPDesktopWidget *dtw = SP_DESKTOP_WIDGET(data); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + prefs->setBool("/options/stickyzoom/value", SP_BUTTON_IS_DOWN(dtw->sticky_zoom)); +} void -- cgit v1.2.3 From 98f6e4db3c307628c9d02cb432986741d59af058 Mon Sep 17 00:00:00 2001 From: theAdib Date: Sun, 2 Aug 2009 20:42:44 +0000 Subject: FIX 309856 353847 in case save_as fails the document uri is reverted (bzr r8387) --- src/extension/system.cpp | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/extension/system.cpp b/src/extension/system.cpp index 33ee544a1..d7e0eebf3 100644 --- a/src/extension/system.cpp +++ b/src/extension/system.cpp @@ -247,15 +247,16 @@ save(Extension *key, SPDocument *doc, gchar const *filename, bool setextension, Inkscape::XML::Node *repr = sp_document_repr_root(doc); - // remember attributes in case this is an unofficial save + + // remember attributes in case this is an unofficial save and/or overwrite fails + gchar *saved_uri = g_strdup(doc->uri); bool saved_modified = false; gchar *saved_output_extension = NULL; gchar *saved_dataloss = NULL; - if (!official) { - saved_modified = doc->isModifiedSinceSave(); - saved_output_extension = g_strdup(repr->attribute("inkscape:output_extension")); - saved_dataloss = g_strdup(repr->attribute("inkscape:dataloss")); - } else { + saved_modified = doc->isModifiedSinceSave(); + saved_output_extension = g_strdup(repr->attribute("inkscape:output_extension")); + saved_dataloss = g_strdup(repr->attribute("inkscape:dataloss")); + if (official) { /* The document is changing name/uri. */ sp_document_change_uri_and_hrefs(doc, fileName); } @@ -281,11 +282,23 @@ save(Extension *key, SPDocument *doc, gchar const *filename, bool setextension, omod->save(doc, fileName); } catch(...) { - // free used ressources - if ( !official) { - g_free(saved_output_extension); - g_free(saved_dataloss); + // revert attributes in case of official and overwrite + if(check_overwrite && official) { + bool const saved = sp_document_get_undo_sensitive(doc); + sp_document_set_undo_sensitive(doc, false); + { + repr->setAttribute("inkscape:output_extension", saved_output_extension); + repr->setAttribute("inkscape:dataloss", saved_dataloss); + } + sp_document_set_undo_sensitive(doc, saved); + sp_document_change_uri_and_hrefs(doc, saved_uri); } + doc->setModifiedSinceSave(saved_modified); + // free used ressources + g_free(saved_output_extension); + g_free(saved_dataloss); + g_free(saved_uri); + g_free(fileName); throw Inkscape::Extension::Output::save_failed(); -- cgit v1.2.3 From a9cf26f946b19982ae8f35df29fe94cf109c6a94 Mon Sep 17 00:00:00 2001 From: theAdib Date: Mon, 3 Aug 2009 21:16:32 +0000 Subject: FIX 2922232 win32 dialogue for browse file on export-bitmap dialogue, also solved the case where filename is emphty (bzr r8399) --- src/dialogs/export.cpp | 55 ++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 53 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/dialogs/export.cpp b/src/dialogs/export.cpp index 4e235bbf5..0cde76657 100644 --- a/src/dialogs/export.cpp +++ b/src/dialogs/export.cpp @@ -60,6 +60,11 @@ #include "helper/png-write.h" +#ifdef WIN32 +#include +#include +#include +#endif #define SP_EXPORT_MIN_SIZE 1.0 @@ -167,7 +172,7 @@ sp_export_dialog_delete ( GtkObject */*object*/, GdkEvent */*event*/, gpointer / if (x<0) x=0; if (y<0) y=0; - + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); prefs->setInt(prefs_path + "x", x); prefs->setInt(prefs_path + "y", y); @@ -1290,6 +1295,7 @@ sp_export_export_clicked (GtkButton */*button*/, GtkObject *base) } // end of sp_export_export_clicked() /// Called when Browse button is clicked +/// @todo refactor this code to use ui/dialogs/filedialog.cpp static void sp_export_browse_clicked (GtkButton */*button*/, gpointer /*userdata*/) { @@ -1318,11 +1324,55 @@ sp_export_browse_clicked (GtkButton */*button*/, gpointer /*userdata*/) filename = gtk_entry_get_text (GTK_ENTRY (fe)); if (*filename == '\0') { - filename = homedir_path(NULL); + filename = create_filepath_from_id(NULL, NULL); } gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (fs), filename); +#ifdef WIN32 + // code in this section is borrowed from ui/dialogs/filedialogimpl-win32.cpp + OPENFILENAMEW opf; + WCHAR* filter_string = (WCHAR*)g_utf8_to_utf16("PNG\0*.png\0\0", 12, NULL, NULL, NULL); + WCHAR* title_string = (WCHAR*)g_utf8_to_utf16(_("Select a filename for exporting"), -1, NULL, NULL, NULL); + WCHAR* extension_string = (WCHAR*)g_utf8_to_utf16("*.png", -1, NULL, NULL, NULL); + // Copy the selected file name, converting from UTF-8 to UTF-16 + WCHAR _filename[_MAX_PATH + 1]; + memset(_filename, 0, sizeof(_filename)); + gunichar2* utf16_path_string = g_utf8_to_utf16(filename, -1, NULL, NULL, NULL); + wcsncpy(_filename, (wchar_t*)utf16_path_string, _MAX_PATH); + g_free(utf16_path_string); + + opf.hwndOwner = (HWND)(GDK_WINDOW_HWND(GTK_WIDGET(dlg)->window)); + opf.lpstrFilter = filter_string; + opf.lpstrCustomFilter = 0; + opf.nMaxCustFilter = 0L; + opf.nFilterIndex = 1L; + opf.lpstrFile = _filename; + opf.nMaxFile = _MAX_PATH; + opf.lpstrFileTitle = NULL; + opf.nMaxFileTitle=0; + opf.lpstrInitialDir = 0; + opf.lpstrTitle = title_string; + opf.nFileOffset = 0; + opf.nFileExtension = 2; + opf.lpstrDefExt = extension_string; + opf.lpfnHook = NULL; + opf.lCustData = 0; + opf.Flags = OFN_PATHMUSTEXIST; + opf.lStructSize = sizeof(OPENFILENAMEW); + if (GetSaveFileNameW(&opf) != 0) + { + // Copy the selected file name, converting from UTF-16 to UTF-8 + gchar *utf8string = g_utf16_to_utf8((const gunichar2*)opf.lpstrFile, _MAX_PATH, NULL, NULL, NULL); + gtk_entry_set_text (GTK_ENTRY (fe), utf8string); + g_object_set_data (G_OBJECT (dlg), "filename", fe); + g_free(utf8string); + + } + g_free(extension_string); + g_free(title_string); + g_free(filter_string); +#else if (gtk_dialog_run (GTK_DIALOG (fs)) == GTK_RESPONSE_ACCEPT) { gchar *file; @@ -1337,6 +1387,7 @@ sp_export_browse_clicked (GtkButton */*button*/, gpointer /*userdata*/) g_free(utf8file); g_free(file); } +#endif gtk_widget_destroy (fs); -- cgit v1.2.3 From 8b04d0db6c55e36935690d37defb6f9b68945796 Mon Sep 17 00:00:00 2001 From: johnce Date: Wed, 5 Aug 2009 05:40:36 +0000 Subject: SPDocument->Document (bzr r8404) --- src/Makefile_insert | 3 + src/bind/javabind.cpp | 4 +- src/box3d-context.cpp | 2 +- src/box3d-side.cpp | 6 +- src/box3d.cpp | 10 +- src/color-profile-fns.h | 4 +- src/color-profile-test.h | 2 +- src/color-profile.cpp | 10 +- src/color-profile.h | 2 +- src/composite-undo-stack-observer.cpp | 2 +- src/composite-undo-stack-observer.h | 4 +- src/conditions.cpp | 2 +- src/conn-avoid-ref.cpp | 2 +- src/connector-context.cpp | 10 +- src/desktop-events.cpp | 2 +- src/desktop-handles.cpp | 2 +- src/desktop-handles.h | 2 +- src/desktop.cpp | 6 +- src/desktop.h | 8 +- src/document-private.h | 18 ++-- src/document-subset.h | 2 +- src/document-undo.cpp | 30 +++--- src/document.cpp | 152 +++++++++++++-------------- src/document.h | 98 +++++++++--------- src/doxygen-main.cpp | 2 +- src/draw-context.cpp | 4 +- src/event-log.cpp | 2 +- src/event-log.h | 4 +- src/file.cpp | 177 ++++++++++++++++++++++++++++---- src/file.h | 37 ++++++- src/filter-chemistry.cpp | 10 +- src/filter-chemistry.h | 8 +- src/flood-context.cpp | 4 +- src/forward.h | 4 +- src/gradient-chemistry.cpp | 10 +- src/gradient-chemistry.h | 4 +- src/gradient-context.cpp | 6 +- src/gradient-drag.cpp | 2 +- src/id-clash.cpp | 4 +- src/id-clash.h | 2 +- src/inkscape-private.h | 4 +- src/inkscape.cpp | 28 ++--- src/inkscape.h | 4 +- src/inkview.cpp | 16 +-- src/interface.cpp | 10 +- src/jabber_whiteboard/node-tracker.h | 2 +- src/jabber_whiteboard/session-manager.h | 6 +- src/layer-fns.cpp | 2 +- src/layer-manager.cpp | 8 +- src/layer-manager.h | 6 +- src/livarot/LivarotDefs.h | 4 +- src/live_effects/effect.h | 8 +- src/lpe-tool-context.cpp | 4 +- src/lpe-tool-context.h | 2 +- src/main-cmdlineact.cpp | 2 +- src/main.cpp | 22 ++-- src/marker.cpp | 6 +- src/marker.h | 2 +- src/nodepath.cpp | 4 +- src/path-chemistry.cpp | 4 +- src/persp3d.cpp | 10 +- src/persp3d.h | 8 +- src/print.cpp | 6 +- src/print.h | 6 +- src/profile-manager.cpp | 2 +- src/profile-manager.h | 6 +- src/rdf.cpp | 18 ++-- src/rdf.h | 10 +- src/selection-chemistry.cpp | 40 ++++---- src/selection-chemistry.h | 8 +- src/snap.cpp | 2 +- src/snap.h | 2 +- src/sp-anchor.cpp | 4 +- src/sp-animation.cpp | 12 +-- src/sp-clippath.cpp | 6 +- src/sp-clippath.h | 2 +- src/sp-ellipse.cpp | 12 +-- src/sp-filter-primitive.cpp | 4 +- src/sp-filter-reference.h | 2 +- src/sp-filter.cpp | 4 +- src/sp-flowdiv.cpp | 12 +-- src/sp-flowtext.cpp | 6 +- src/sp-font-face.cpp | 4 +- src/sp-font.cpp | 4 +- src/sp-gaussian-blur.cpp | 4 +- src/sp-glyph-kerning.cpp | 4 +- src/sp-glyph.cpp | 4 +- src/sp-gradient-test.h | 2 +- src/sp-gradient.cpp | 16 +-- src/sp-guide.cpp | 8 +- src/sp-image.cpp | 6 +- src/sp-item-group.cpp | 6 +- src/sp-item.cpp | 4 +- src/sp-line.cpp | 4 +- src/sp-lpe-item.cpp | 4 +- src/sp-mask.cpp | 6 +- src/sp-mask.h | 2 +- src/sp-metadata.cpp | 6 +- src/sp-metadata.h | 2 +- src/sp-missing-glyph.cpp | 4 +- src/sp-namedview.cpp | 14 +-- src/sp-namedview.h | 4 +- src/sp-object-repr.cpp | 2 +- src/sp-object-repr.h | 2 +- src/sp-object.cpp | 12 +-- src/sp-object.h | 8 +- src/sp-offset.cpp | 6 +- src/sp-paint-server.h | 2 +- src/sp-path.cpp | 4 +- src/sp-pattern.cpp | 8 +- src/sp-pattern.h | 2 +- src/sp-polygon.cpp | 4 +- src/sp-polyline.cpp | 4 +- src/sp-rect.cpp | 4 +- src/sp-root.cpp | 4 +- src/sp-script.cpp | 4 +- src/sp-shape.cpp | 4 +- src/sp-skeleton.cpp | 4 +- src/sp-spiral.cpp | 4 +- src/sp-star.cpp | 4 +- src/sp-string.cpp | 4 +- src/sp-style-elem-test.h | 2 +- src/sp-style-elem.cpp | 4 +- src/sp-symbol.cpp | 4 +- src/sp-text.cpp | 4 +- src/sp-tref.cpp | 6 +- src/sp-tspan.cpp | 8 +- src/sp-use.cpp | 6 +- src/splivarot.cpp | 4 +- src/style-test.h | 2 +- src/style.cpp | 26 ++--- src/style.h | 4 +- src/svg-view-widget.cpp | 2 +- src/svg-view-widget.h | 4 +- src/svg-view.cpp | 2 +- src/svg-view.h | 2 +- src/test-helpers.h | 2 +- src/text-chemistry.cpp | 4 +- src/tweak-context.cpp | 4 +- src/uri-references.cpp | 8 +- src/uri-references.h | 10 +- src/vanishing-point.cpp | 2 +- src/vanishing-point.h | 4 +- src/verbs.cpp | 16 +-- src/verbs.h | 4 +- src/widgets/desktop-widget.cpp | 4 +- src/widgets/fill-style.cpp | 2 +- src/widgets/gradient-selector.cpp | 4 +- src/widgets/gradient-selector.h | 2 +- src/widgets/gradient-toolbar.cpp | 4 +- src/widgets/gradient-vector.cpp | 8 +- src/widgets/gradient-vector.h | 8 +- src/widgets/icon.cpp | 6 +- src/widgets/paint-selector.cpp | 12 +-- src/widgets/select-toolbar.cpp | 2 +- src/widgets/stroke-style.cpp | 34 +++--- src/widgets/toolbox.cpp | 8 +- src/xml/rebase-hrefs.h | 4 +- 158 files changed, 793 insertions(+), 622 deletions(-) (limited to 'src') diff --git a/src/Makefile_insert b/src/Makefile_insert index de986ca16..5967c7cfc 100644 --- a/src/Makefile_insert +++ b/src/Makefile_insert @@ -225,6 +225,9 @@ ink_common_sources += \ star-context.cpp star-context.h \ streq.h \ strneq.h \ + streams-handles.h streams-handles.cpp \ + streams-ftp.h streams-ftp.cpp \ + streams-http.h streams-http.cpp \ style.cpp style.h \ svg-profile.h \ svg-view.cpp svg-view.h \ diff --git a/src/bind/javabind.cpp b/src/bind/javabind.cpp index f7022584f..aedd72e13 100644 --- a/src/bind/javabind.cpp +++ b/src/bind/javabind.cpp @@ -44,9 +44,9 @@ #include #endif -#if HAVE_SYS_STAT_H +//--tullarisc #if HAVE_SYS_STAT_H #include -#endif +//#endif #include "javabind.h" #include "javabind-private.h" diff --git a/src/box3d-context.cpp b/src/box3d-context.cpp index 128b5f2ff..7e6eaaa22 100644 --- a/src/box3d-context.cpp +++ b/src/box3d-context.cpp @@ -185,7 +185,7 @@ static void sp_box3d_context_selection_changed(Inkscape::Selection *selection, g /* create a default perspective in document defs if none is present (can happen after 'vacuum defs' or when a pre-0.46 file is opened) */ -static void sp_box3d_context_check_for_persp_in_defs(SPDocument *document) { +static void sp_box3d_context_check_for_persp_in_defs(Document *document) { SPDefs *defs = (SPDefs *) SP_DOCUMENT_DEFS(document); bool has_persp = false; diff --git a/src/box3d-side.cpp b/src/box3d-side.cpp index 241279100..f09a2f9f6 100644 --- a/src/box3d-side.cpp +++ b/src/box3d-side.cpp @@ -28,7 +28,7 @@ static void box3d_side_class_init (Box3DSideClass *klass); static void box3d_side_init (Box3DSide *side); -static void box3d_side_build (SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void box3d_side_build (SPObject *object, Document *document, Inkscape::XML::Node *repr); static Inkscape::XML::Node *box3d_side_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void box3d_side_set (SPObject *object, unsigned int key, const gchar *value); static void box3d_side_update (SPObject *object, SPCtx *ctx, guint flags); @@ -94,7 +94,7 @@ box3d_side_init (Box3DSide * side) } static void -box3d_side_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr) +box3d_side_build (SPObject * object, Document * document, Inkscape::XML::Node * repr) { if (((SPObjectClass *) parent_class)->build) ((SPObjectClass *) parent_class)->build (object, document, repr); @@ -307,7 +307,7 @@ box3d_side_perspective(Box3DSide *side) { Inkscape::XML::Node * box3d_side_convert_to_path(Box3DSide *side) { // TODO: Copy over all important attributes (see sp_selected_item_to_curved_repr() for an example) - SPDocument *doc = SP_OBJECT_DOCUMENT(side); + Document *doc = SP_OBJECT_DOCUMENT(side); Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc); Inkscape::XML::Node *repr = xml_doc->createElement("svg:path"); diff --git a/src/box3d.cpp b/src/box3d.cpp index 5cffa66d9..9ec0625aa 100644 --- a/src/box3d.cpp +++ b/src/box3d.cpp @@ -43,7 +43,7 @@ static void box3d_class_init(SPBox3DClass *klass); static void box3d_init(SPBox3D *box3d); -static void box3d_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void box3d_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); static void box3d_release(SPObject *object); static void box3d_set(SPObject *object, unsigned int key, const gchar *value); static void box3d_update(SPObject *object, SPCtx *ctx, guint flags); @@ -110,7 +110,7 @@ box3d_init(SPBox3D *box) } static void -box3d_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +box3d_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) (parent_class))->build) { ((SPObjectClass *) (parent_class))->build(object, document, repr); @@ -126,7 +126,7 @@ box3d_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) // TODO: Create/link to the correct perspective - SPDocument *doc = SP_OBJECT_DOCUMENT(box); + Document *doc = SP_OBJECT_DOCUMENT(box); if (!doc) { g_print ("No document for the box!!!!\n"); return; @@ -272,7 +272,7 @@ static Inkscape::XML::Node *box3d_write(SPObject *object, Inkscape::XML::Documen repr->setAttribute("inkscape:perspectiveID", box->persp_href); } else { /* box is not yet linked to a perspective; use the document's current perspective */ - SPDocument *doc = SP_OBJECT_DOCUMENT(object); + Document *doc = SP_OBJECT_DOCUMENT(object); if (box->persp_ref->getURI()) { gchar *uri_string = box->persp_ref->getURI()->toString(); repr->setAttribute("inkscape:perspectiveID", uri_string); @@ -1378,7 +1378,7 @@ box3d_switch_perspectives(SPBox3D *box, Persp3D *old_persp, Persp3D *new_persp, the original box and deletes the latter */ SPGroup * box3d_convert_to_group(SPBox3D *box) { - SPDocument *doc = SP_OBJECT_DOCUMENT(box); + Document *doc = SP_OBJECT_DOCUMENT(box); Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc); // remember position of the box diff --git a/src/color-profile-fns.h b/src/color-profile-fns.h index c8c51b551..62e4c865f 100644 --- a/src/color-profile-fns.h +++ b/src/color-profile-fns.h @@ -13,7 +13,7 @@ #include #endif // ENABLE_LCMS -class SPDocument; +class Document; namespace Inkscape { @@ -27,7 +27,7 @@ GType colorprofile_get_type(); #if ENABLE_LCMS -cmsHPROFILE colorprofile_get_handle( SPDocument* document, guint* intent, gchar const* name ); +cmsHPROFILE colorprofile_get_handle( Document* document, guint* intent, gchar const* name ); cmsHTRANSFORM colorprofile_get_display_transform(); Glib::ustring colorprofile_get_display_id( int screen, int monitor ); diff --git a/src/color-profile-test.h b/src/color-profile-test.h index cdbf76b44..d7b361c50 100644 --- a/src/color-profile-test.h +++ b/src/color-profile-test.h @@ -14,7 +14,7 @@ class ColorProfileTest : public CxxTest::TestSuite { public: - SPDocument* _doc; + Document* _doc; ColorProfileTest() : _doc(0) diff --git a/src/color-profile.cpp b/src/color-profile.cpp index 5868a9582..b2487a6a9 100644 --- a/src/color-profile.cpp +++ b/src/color-profile.cpp @@ -151,7 +151,7 @@ void ColorProfile::init( ColorProfile *cprof ) void ColorProfile::release( SPObject *object ) { // Unregister ourselves - SPDocument* document = SP_OBJECT_DOCUMENT(object); + Document* document = SP_OBJECT_DOCUMENT(object); if ( document ) { sp_document_remove_resource (SP_OBJECT_DOCUMENT (object), "iccprofile", SP_OBJECT (object)); } @@ -205,7 +205,7 @@ void ColorProfile::_clearProfile() /** * Callback: set attributes from associated repr. */ -void ColorProfile::build( SPObject *object, SPDocument *document, Inkscape::XML::Node *repr ) +void ColorProfile::build( SPObject *object, Document *document, Inkscape::XML::Node *repr ) { ColorProfile *cprof = COLORPROFILE(object); g_assert(cprof->href == 0); @@ -251,7 +251,7 @@ void ColorProfile::set( SPObject *object, unsigned key, gchar const *value ) //LCMSAPI cmsHPROFILE LCMSEXPORT cmsOpenProfileFromMem(LPVOID MemPtr, DWORD dwSize); // Try to open relative - SPDocument *doc = SP_OBJECT_DOCUMENT(object); + Document *doc = SP_OBJECT_DOCUMENT(object); if (!doc) { doc = SP_ACTIVE_DOCUMENT; g_warning("object has no document. using active"); @@ -436,7 +436,7 @@ static int getLcmsIntent( guint svgIntent ) return intent; } -static SPObject* bruteFind( SPDocument* document, gchar const* name ) +static SPObject* bruteFind( Document* document, gchar const* name ) { SPObject* result = 0; const GSList * current = sp_document_get_resource_list(document, "iccprofile"); @@ -456,7 +456,7 @@ static SPObject* bruteFind( SPDocument* document, gchar const* name ) return result; } -cmsHPROFILE Inkscape::colorprofile_get_handle( SPDocument* document, guint* intent, gchar const* name ) +cmsHPROFILE Inkscape::colorprofile_get_handle( Document* document, guint* intent, gchar const* name ) { cmsHPROFILE prof = 0; diff --git a/src/color-profile.h b/src/color-profile.h index 2e57e7ef0..2d8ac5b6d 100644 --- a/src/color-profile.h +++ b/src/color-profile.h @@ -56,7 +56,7 @@ private: static void init( ColorProfile *cprof ); static void release( SPObject *object ); - static void build( SPObject *object, SPDocument *document, Inkscape::XML::Node *repr ); + static void build( SPObject *object, Document *document, Inkscape::XML::Node *repr ); static void set( SPObject *object, unsigned key, gchar const *value ); static Inkscape::XML::Node *write( SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags ); #if ENABLE_LCMS diff --git a/src/composite-undo-stack-observer.cpp b/src/composite-undo-stack-observer.cpp index 03e4796bd..89ffdc65e 100644 --- a/src/composite-undo-stack-observer.cpp +++ b/src/composite-undo-stack-observer.cpp @@ -1,5 +1,5 @@ /** - * Aggregates undo stack observers for convenient management and triggering in SPDocument + * Aggregates undo stack observers for convenient management and triggering in Document * * Heavily inspired by Inkscape::XML::CompositeNodeObserver. * diff --git a/src/composite-undo-stack-observer.h b/src/composite-undo-stack-observer.h index cd00d4211..01c64f4fd 100644 --- a/src/composite-undo-stack-observer.h +++ b/src/composite-undo-stack-observer.h @@ -1,5 +1,5 @@ /** - * Aggregates undo stack observers for management and triggering in SPDocument + * Aggregates undo stack observers for management and triggering in Document * * Heavily inspired by Inkscape::XML::CompositeNodeObserver. * @@ -25,7 +25,7 @@ namespace Inkscape { class Event; /** - * Aggregates UndoStackObservers for management and triggering in an SPDocument's undo/redo + * Aggregates UndoStackObservers for management and triggering in an Document's undo/redo * system. */ class CompositeUndoStackObserver : public UndoStackObserver { diff --git a/src/conditions.cpp b/src/conditions.cpp index 4a18a6913..c431600f3 100644 --- a/src/conditions.cpp +++ b/src/conditions.cpp @@ -108,7 +108,7 @@ static bool evaluateSystemLanguage(SPItem const *item, gchar const *value) { if (language_codes.empty()) return false; - SPDocument *document = SP_OBJECT_DOCUMENT(item); + Document *document = SP_OBJECT_DOCUMENT(item); Glib::ustring document_language = document->getLanguage(); if (document_language.size() == 0) diff --git a/src/conn-avoid-ref.cpp b/src/conn-avoid-ref.cpp index 43c9c0b66..0bc961e5d 100644 --- a/src/conn-avoid-ref.cpp +++ b/src/conn-avoid-ref.cpp @@ -254,7 +254,7 @@ void init_avoided_shape_geometry(SPDesktop *desktop) { // Don't count this as changes to the document, // it is basically just late initialisation. - SPDocument *document = sp_desktop_document(desktop); + Document *document = sp_desktop_document(desktop); bool saved = sp_document_get_undo_sensitive(document); sp_document_set_undo_sensitive(document, false); diff --git a/src/connector-context.cpp b/src/connector-context.cpp index 2131bdced..17e5f6f32 100644 --- a/src/connector-context.cpp +++ b/src/connector-context.cpp @@ -686,7 +686,7 @@ connector_handle_button_release(SPConnectorContext *const cc, GdkEventButton con if ( revent.button == 1 && !event_context->space_panning ) { SPDesktop *desktop = SP_EVENT_CONTEXT_DESKTOP(cc); - SPDocument *doc = sp_desktop_document(desktop); + Document *doc = sp_desktop_document(desktop); SnapManager &m = desktop->namedview->snap_manager; m.setup(desktop); @@ -763,7 +763,7 @@ connector_handle_key_press(SPConnectorContext *const cc, guint const keyval) if (cc->state == SP_CONNECTOR_CONTEXT_REROUTING) { SPDesktop *desktop = SP_EVENT_CONTEXT_DESKTOP(cc); - SPDocument *doc = sp_desktop_document(desktop); + Document *doc = sp_desktop_document(desktop); cc_connector_rerouting_finish(cc, NULL); @@ -794,7 +794,7 @@ static void cc_connector_rerouting_finish(SPConnectorContext *const cc, Geom::Point *const p) { SPDesktop *desktop = SP_EVENT_CONTEXT_DESKTOP(cc); - SPDocument *doc = sp_desktop_document(desktop); + Document *doc = sp_desktop_document(desktop); // Clear the temporary path: cc->red_curve->reset(); @@ -936,7 +936,7 @@ spcc_flush_white(SPConnectorContext *cc, SPCurve *gc) c->transform(SP_EVENT_CONTEXT_DESKTOP(cc)->dt2doc()); SPDesktop *desktop = SP_EVENT_CONTEXT_DESKTOP(cc); - SPDocument *doc = sp_desktop_document(desktop); + Document *doc = sp_desktop_document(desktop); Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc); if ( c && !c->is_empty() ) { @@ -1311,7 +1311,7 @@ void cc_selection_set_avoid(bool const set_avoid) return; } - SPDocument *document = sp_desktop_document(desktop); + Document *document = sp_desktop_document(desktop); Inkscape::Selection *selection = sp_desktop_selection(desktop); diff --git a/src/desktop-events.cpp b/src/desktop-events.cpp index cea478f85..41b7ab4da 100644 --- a/src/desktop-events.cpp +++ b/src/desktop-events.cpp @@ -440,7 +440,7 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data) case GDK_KP_Delete: case GDK_BackSpace: { - SPDocument *doc = SP_OBJECT_DOCUMENT(guide); + Document *doc = SP_OBJECT_DOCUMENT(guide); sp_guide_remove(guide); sp_document_done(doc, SP_VERB_NONE, _("Delete guide")); ret = TRUE; diff --git a/src/desktop-handles.cpp b/src/desktop-handles.cpp index 481bf35ea..b0ca4b84a 100644 --- a/src/desktop-handles.cpp +++ b/src/desktop-handles.cpp @@ -31,7 +31,7 @@ sp_desktop_selection (SPDesktop const * desktop) return desktop->selection; } -SPDocument * +Document * sp_desktop_document (SPDesktop const * desktop) { g_return_val_if_fail (desktop != NULL, NULL); diff --git a/src/desktop-handles.h b/src/desktop-handles.h index a8d0a3d1e..8c48d0bbd 100644 --- a/src/desktop-handles.h +++ b/src/desktop-handles.h @@ -30,7 +30,7 @@ namespace Inkscape { SPEventContext * sp_desktop_event_context (SPDesktop const * desktop); Inkscape::Selection * sp_desktop_selection (SPDesktop const * desktop); -SPDocument * sp_desktop_document (SPDesktop const * desktop); +Document * sp_desktop_document (SPDesktop const * desktop); SPCanvas * sp_desktop_canvas (SPDesktop const * desktop); SPCanvasItem * sp_desktop_acetate (SPDesktop const * desktop); SPCanvasGroup * sp_desktop_main (SPDesktop const * desktop); diff --git a/src/desktop.cpp b/src/desktop.cpp index 6b7c20094..4f832682d 100644 --- a/src/desktop.cpp +++ b/src/desktop.cpp @@ -178,7 +178,7 @@ SPDesktop::init (SPNamedView *nv, SPCanvas *aCanvas) namedview = nv; canvas = aCanvas; - SPDocument *document = SP_OBJECT_DOCUMENT (namedview); + Document *document = SP_OBJECT_DOCUMENT (namedview); /* Kill flicker */ sp_document_ensure_up_to_date (document); @@ -577,7 +577,7 @@ SPDesktop::activate_guides(bool activate) * Make desktop switch documents. */ void -SPDesktop::change_document (SPDocument *theDocument) +SPDesktop::change_document (Document *theDocument) { g_return_if_fail (theDocument != NULL); @@ -1492,7 +1492,7 @@ SPDesktop::updateCanvasNow() * Associate document with desktop. */ void -SPDesktop::setDocument (SPDocument *doc) +SPDesktop::setDocument (Document *doc) { if (this->doc() && doc) { namedview->hide(this); diff --git a/src/desktop.h b/src/desktop.h index 73b9262dd..f9e7f6a17 100644 --- a/src/desktop.h +++ b/src/desktop.h @@ -143,7 +143,7 @@ struct SPDesktop : public Inkscape::UI::View::View sigc::signal _layer_changed_signal; sigc::signal::accumulated _set_style_signal; sigc::signal::accumulated _query_style_signal; - sigc::connection connectDocumentReplaced (const sigc::slot & slot) + sigc::connection connectDocumentReplaced (const sigc::slot & slot) { return _document_replaced_signal.connect (slot); } @@ -219,7 +219,7 @@ struct SPDesktop : public Inkscape::UI::View::View bool itemIsHidden(SPItem const *item) const; void activate_guides (bool activate); - void change_document (SPDocument *document); + void change_document (Document *document); void set_event_context (GtkType type, const gchar *config); void push_event_context (GtkType type, const gchar *config, unsigned int key); @@ -315,7 +315,7 @@ struct SPDesktop : public Inkscape::UI::View::View Geom::Point doc2dt(Geom::Point const &p) const; Geom::Point dt2doc(Geom::Point const &p) const; - virtual void setDocument (SPDocument* doc); + virtual void setDocument (Document* doc); virtual bool shutdown(); virtual void mouseover() {} virtual void mouseout() {} @@ -337,7 +337,7 @@ private: void push_current_zoom (GList**); - sigc::signal _document_replaced_signal; + sigc::signal _document_replaced_signal; sigc::signal _activate_signal; sigc::signal _deactivate_signal; sigc::signal _event_context_changed_signal; diff --git a/src/document-private.h b/src/document-private.h index fa4754248..221cfa17c 100644 --- a/src/document-private.h +++ b/src/document-private.h @@ -36,9 +36,9 @@ class Event; } -struct SPDocumentPrivate { - typedef std::map IDChangedSignalMap; - typedef std::map ResourcesChangedSignalMap; +struct DocumentPrivate { + typedef std::map IDChangedSignalMap; + typedef std::map ResourcesChangedSignalMap; GHashTable *iddef; /**< Dictionary of id -> SPObject mappings */ GHashTable *reprdef; /**< Dictionary of Inkscape::XML::Node -> SPObject mappings */ @@ -53,12 +53,12 @@ struct SPDocumentPrivate { GHashTable *resources; ResourcesChangedSignalMap resources_changed_signals; - SPDocument::ModifiedSignal modified_signal; - SPDocument::URISetSignal uri_set_signal; - SPDocument::ResizedSignal resized_signal; - SPDocument::ReconstructionStart _reconstruction_start_signal; - SPDocument::ReconstructionFinish _reconstruction_finish_signal; - SPDocument::CommitSignal commit_signal; + Document::ModifiedSignal modified_signal; + Document::URISetSignal uri_set_signal; + Document::ResizedSignal resized_signal; + Document::ReconstructionStart _reconstruction_start_signal; + Document::ReconstructionFinish _reconstruction_finish_signal; + Document::CommitSignal commit_signal; /* Undo/Redo state */ bool sensitive: true; /* If we save actions to undo stack */ diff --git a/src/document-subset.h b/src/document-subset.h index e424a289c..b7b724162 100644 --- a/src/document-subset.h +++ b/src/document-subset.h @@ -17,7 +17,7 @@ #include "gc-anchored.h" class SPObject; -class SPDocument; +class Document; namespace Inkscape { diff --git a/src/document-undo.cpp b/src/document-undo.cpp index ae1c82e71..9dbf5db25 100644 --- a/src/document-undo.cpp +++ b/src/document-undo.cpp @@ -23,8 +23,8 @@ * stack. Two methods exist to indicate that the given action is completed: * * \verbatim - void sp_document_done (SPDocument *document); - void sp_document_maybe_done (SPDocument *document, const unsigned char *key) \endverbatim + void sp_document_done (Document *document); + void sp_document_maybe_done (Document *document, const unsigned char *key) \endverbatim * * Both move the recent action list into the undo stack and clear the * list afterwards. While the first method does an unconditional push, @@ -85,7 +85,7 @@ sp_document_set_undo_sensitive(document, saved); \endverbatim */ void -sp_document_set_undo_sensitive (SPDocument *doc, bool sensitive) +sp_document_set_undo_sensitive (Document *doc, bool sensitive) { g_assert (doc != NULL); g_assert (doc->priv != NULL); @@ -112,7 +112,7 @@ sp_document_set_undo_sensitive (SPDocument *doc, bool sensitive) * the saved bools in a stack. Perhaps this is why the above solution is better. */ -bool sp_document_get_undo_sensitive(SPDocument const *document) { +bool sp_document_get_undo_sensitive(Document const *document) { g_assert(document != NULL); g_assert(document->priv != NULL); @@ -120,7 +120,7 @@ bool sp_document_get_undo_sensitive(SPDocument const *document) { } void -sp_document_done (SPDocument *doc, const unsigned int event_type, Glib::ustring event_description) +sp_document_done (Document *doc, const unsigned int event_type, Glib::ustring event_description) { sp_document_maybe_done (doc, NULL, event_type, event_description); } @@ -128,7 +128,7 @@ sp_document_done (SPDocument *doc, const unsigned int event_type, Glib::ustring void sp_document_reset_key (Inkscape::Application */*inkscape*/, SPDesktop */*desktop*/, GtkObject *base) { - SPDocument *doc = (SPDocument *) base; + Document *doc = (Document *) base; doc->actionkey = NULL; } @@ -145,7 +145,7 @@ typedef SimpleEvent InteractionEvent; class CommitEvent : public InteractionEvent { public: - CommitEvent(SPDocument *doc, const gchar *key, const unsigned int type) + CommitEvent(Document *doc, const gchar *key, const unsigned int type) : InteractionEvent(share_static_string("commit")) { _addProperty(share_static_string("timestamp"), timestamp()); @@ -165,7 +165,7 @@ public: } void -sp_document_maybe_done (SPDocument *doc, const gchar *key, const unsigned int event_type, +sp_document_maybe_done (Document *doc, const gchar *key, const unsigned int event_type, Glib::ustring event_description) { g_assert (doc != NULL); @@ -209,7 +209,7 @@ sp_document_maybe_done (SPDocument *doc, const gchar *key, const unsigned int ev } void -sp_document_cancel (SPDocument *doc) +sp_document_cancel (Document *doc) { g_assert (doc != NULL); g_assert (doc->priv != NULL); @@ -226,8 +226,8 @@ sp_document_cancel (SPDocument *doc) sp_repr_begin_transaction (doc->rdoc); } -static void finish_incomplete_transaction(SPDocument &doc) { - SPDocumentPrivate &priv=*doc.priv; +static void finish_incomplete_transaction(Document &doc) { + DocumentPrivate &priv=*doc.priv; Inkscape::XML::Event *log=sp_repr_commit_undoable(doc.rdoc); if (log || priv.partial) { g_warning ("Incomplete undo transaction:"); @@ -241,7 +241,7 @@ static void finish_incomplete_transaction(SPDocument &doc) { } gboolean -sp_document_undo (SPDocument *doc) +sp_document_undo (Document *doc) { using Inkscape::Debug::EventTracker; using Inkscape::Debug::SimpleEvent; @@ -287,7 +287,7 @@ sp_document_undo (SPDocument *doc) } gboolean -sp_document_redo (SPDocument *doc) +sp_document_redo (Document *doc) { using Inkscape::Debug::EventTracker; using Inkscape::Debug::SimpleEvent; @@ -333,7 +333,7 @@ sp_document_redo (SPDocument *doc) } void -sp_document_clear_undo (SPDocument *doc) +sp_document_clear_undo (Document *doc) { if (doc->priv->undo) doc->priv->undoStackObservers.notifyClearUndoEvent(); @@ -351,7 +351,7 @@ sp_document_clear_undo (SPDocument *doc) } void -sp_document_clear_redo (SPDocument *doc) +sp_document_clear_redo (Document *doc) { if (doc->priv->redo) doc->priv->undoStackObservers.notifyClearRedoEvent(); diff --git a/src/document.cpp b/src/document.cpp index 288e52c6d..750b29301 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -1,7 +1,7 @@ -#define __SP_DOCUMENT_C__ +#define __DOCUMENT_C__ /** \file - * SPDocument manipulation + * Document manipulation * * Authors: * Lauris Kaplinski @@ -15,17 +15,17 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -/** \class SPDocument - * SPDocument serves as the container of both model trees (agnostic XML +/** \class Document + * Document serves as the container of both model trees (agnostic XML * and typed object tree), and implements all of the document-level * functionality used by the program. Many document level operations, like - * load, save, print, export and so on, use SPDocument as their basic datatype. + * load, save, print, export and so on, use Document as their basic datatype. * - * SPDocument implements undo and redo stacks and an id-based object + * Document implements undo and redo stacks and an id-based object * dictionary. Thanks to unique id attributes, the latter can be used to * map from the XML tree back to the object tree. * - * SPDocument performs the basic operations needed for asynchronous + * Document performs the basic operations needed for asynchronous * update notification (SPObject ::modified virtual method), and implements * the 'modified' signal, as well. */ @@ -74,7 +74,7 @@ static gint doc_count = 0; static unsigned long next_serial = 0; -SPDocument::SPDocument() : +Document::Document() : keepalive(FALSE), virgin(TRUE), modified_since_save(FALSE), @@ -98,7 +98,7 @@ SPDocument::SPDocument() : // Don't use the Consolidate moves optimisation. router->ConsolidateMoves = false; - SPDocumentPrivate *p = new SPDocumentPrivate(); + DocumentPrivate *p = new DocumentPrivate(); p->serial = next_serial++; @@ -123,7 +123,7 @@ SPDocument::SPDocument() : priv->undoStackObservers.add(p->console_output_undo_observer); } -SPDocument::~SPDocument() { +Document::~Document() { collectOrphans(); // kill/unhook this first @@ -204,7 +204,7 @@ SPDocument::~SPDocument() { } -void SPDocument::add_persp3d (Persp3D * const /*persp*/) +void Document::add_persp3d (Persp3D * const /*persp*/) { SPDefs *defs = SP_ROOT(this->root)->defs; for (SPObject *i = sp_object_first_child(SP_OBJECT(defs)); i != NULL; i = SP_OBJECT_NEXT(i) ) { @@ -217,18 +217,18 @@ void SPDocument::add_persp3d (Persp3D * const /*persp*/) persp3d_create_xml_element (this); } -void SPDocument::remove_persp3d (Persp3D * const /*persp*/) +void Document::remove_persp3d (Persp3D * const /*persp*/) { // TODO: Delete the repr, maybe perform a check if any boxes are still linked to the perspective. // Anything else? g_print ("Please implement deletion of perspectives here.\n"); } -unsigned long SPDocument::serial() const { +unsigned long Document::serial() const { return priv->serial; } -void SPDocument::queueForOrphanCollection(SPObject *object) { +void Document::queueForOrphanCollection(SPObject *object) { g_return_if_fail(object != NULL); g_return_if_fail(SP_OBJECT_DOCUMENT(object) == this); @@ -236,7 +236,7 @@ void SPDocument::queueForOrphanCollection(SPObject *object) { _collection_queue = g_slist_prepend(_collection_queue, object); } -void SPDocument::collectOrphans() { +void Document::collectOrphans() { while (_collection_queue) { GSList *objects=_collection_queue; _collection_queue = NULL; @@ -249,25 +249,25 @@ void SPDocument::collectOrphans() { } } -void SPDocument::reset_key (void */*dummy*/) +void Document::reset_key (void */*dummy*/) { actionkey = NULL; } -SPDocument * +Document * sp_document_create(Inkscape::XML::Document *rdoc, gchar const *uri, gchar const *base, gchar const *name, unsigned int keepalive) { - SPDocument *document; + Document *document; Inkscape::XML::Node *rroot; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); rroot = rdoc->root(); - document = new SPDocument(); + document = new Document(); document->keepalive = keepalive; @@ -389,8 +389,8 @@ sp_document_create(Inkscape::XML::Document *rdoc, G_CALLBACK(sp_document_reset_key), document); document->oldSignalsConnected = true; } else { - document->_selection_changed_connection = Inkscape::NSApplication::Editor::connectSelectionChanged (sigc::mem_fun (*document, &SPDocument::reset_key)); - document->_desktop_activated_connection = Inkscape::NSApplication::Editor::connectDesktopActivated (sigc::mem_fun (*document, &SPDocument::reset_key)); + document->_selection_changed_connection = Inkscape::NSApplication::Editor::connectSelectionChanged (sigc::mem_fun (*document, &Document::reset_key)); + document->_desktop_activated_connection = Inkscape::NSApplication::Editor::connectDesktopActivated (sigc::mem_fun (*document, &Document::reset_key)); document->oldSignalsConnected = false; } @@ -401,10 +401,10 @@ sp_document_create(Inkscape::XML::Document *rdoc, * Fetches document from URI, or creates new, if NULL; public document * appears in document list. */ -SPDocument * +Document * sp_document_new(gchar const *uri, unsigned int keepalive, bool make_new) { - SPDocument *doc; + Document *doc; Inkscape::XML::Document *rdoc; gchar *base = NULL; gchar *name = NULL; @@ -452,10 +452,10 @@ sp_document_new(gchar const *uri, unsigned int keepalive, bool make_new) return doc; } -SPDocument * +Document * sp_document_new_from_mem(gchar const *buffer, gint length, unsigned int keepalive) { - SPDocument *doc; + Document *doc; Inkscape::XML::Document *rdoc; Inkscape::XML::Node *rroot; gchar *name; @@ -477,23 +477,23 @@ sp_document_new_from_mem(gchar const *buffer, gint length, unsigned int keepaliv return doc; } -SPDocument * -sp_document_ref(SPDocument *doc) +Document * +sp_document_ref(Document *doc) { g_return_val_if_fail(doc != NULL, NULL); Inkscape::GC::anchor(doc); return doc; } -SPDocument * -sp_document_unref(SPDocument *doc) +Document * +sp_document_unref(Document *doc) { g_return_val_if_fail(doc != NULL, NULL); Inkscape::GC::release(doc); return NULL; } -gdouble sp_document_width(SPDocument *document) +gdouble sp_document_width(Document *document) { g_return_val_if_fail(document != NULL, 0.0); g_return_val_if_fail(document->priv != NULL, 0.0); @@ -507,7 +507,7 @@ gdouble sp_document_width(SPDocument *document) } void -sp_document_set_width (SPDocument *document, gdouble width, const SPUnit *unit) +sp_document_set_width (Document *document, gdouble width, const SPUnit *unit) { SPRoot *root = SP_ROOT(document->root); @@ -533,7 +533,7 @@ sp_document_set_width (SPDocument *document, gdouble width, const SPUnit *unit) SP_OBJECT (root)->updateRepr(); } -void sp_document_set_height (SPDocument * document, gdouble height, const SPUnit *unit) +void sp_document_set_height (Document * document, gdouble height, const SPUnit *unit) { SPRoot *root = SP_ROOT(document->root); @@ -559,7 +559,7 @@ void sp_document_set_height (SPDocument * document, gdouble height, const SPUnit SP_OBJECT (root)->updateRepr(); } -gdouble sp_document_height(SPDocument *document) +gdouble sp_document_height(Document *document) { g_return_val_if_fail(document != NULL, 0.0); g_return_val_if_fail(document->priv != NULL, 0.0); @@ -572,7 +572,7 @@ gdouble sp_document_height(SPDocument *document) return root->height.computed; } -Geom::Point sp_document_dimensions(SPDocument *doc) +Geom::Point sp_document_dimensions(Document *doc) { return Geom::Point(sp_document_width(doc), sp_document_height(doc)); } @@ -582,7 +582,7 @@ Geom::Point sp_document_dimensions(SPDocument *doc) * this function fits the canvas to that rect by resizing the canvas * and translating the document root into position. */ -void SPDocument::fitToRect(Geom::Rect const &rect) +void Document::fitToRect(Geom::Rect const &rect) { double const w = rect.width(); double const h = rect.height(); @@ -606,7 +606,7 @@ void SPDocument::fitToRect(Geom::Rect const &rect) } static void -do_change_uri(SPDocument *const document, gchar const *const filename, bool const rebase) +do_change_uri(Document *const document, gchar const *const filename, bool const rebase) { g_return_if_fail(document != NULL); @@ -662,7 +662,7 @@ do_change_uri(SPDocument *const document, gchar const *const filename, bool cons * * \see sp_document_change_uri_and_hrefs */ -void sp_document_set_uri(SPDocument *document, gchar const *filename) +void sp_document_set_uri(Document *document, gchar const *filename) { g_return_if_fail(document != NULL); @@ -675,7 +675,7 @@ void sp_document_set_uri(SPDocument *document, gchar const *filename) * * \see sp_document_set_uri */ -void sp_document_change_uri_and_hrefs(SPDocument *document, gchar const *filename) +void sp_document_change_uri_and_hrefs(Document *document, gchar const *filename) { g_return_if_fail(document != NULL); @@ -683,36 +683,36 @@ void sp_document_change_uri_and_hrefs(SPDocument *document, gchar const *filenam } void -sp_document_resized_signal_emit(SPDocument *doc, gdouble width, gdouble height) +sp_document_resized_signal_emit(Document *doc, gdouble width, gdouble height) { g_return_if_fail(doc != NULL); doc->priv->resized_signal.emit(width, height); } -sigc::connection SPDocument::connectModified(SPDocument::ModifiedSignal::slot_type slot) +sigc::connection Document::connectModified(Document::ModifiedSignal::slot_type slot) { return priv->modified_signal.connect(slot); } -sigc::connection SPDocument::connectURISet(SPDocument::URISetSignal::slot_type slot) +sigc::connection Document::connectURISet(Document::URISetSignal::slot_type slot) { return priv->uri_set_signal.connect(slot); } -sigc::connection SPDocument::connectResized(SPDocument::ResizedSignal::slot_type slot) +sigc::connection Document::connectResized(Document::ResizedSignal::slot_type slot) { return priv->resized_signal.connect(slot); } sigc::connection -SPDocument::connectReconstructionStart(SPDocument::ReconstructionStart::slot_type slot) +Document::connectReconstructionStart(Document::ReconstructionStart::slot_type slot) { return priv->_reconstruction_start_signal.connect(slot); } void -SPDocument::emitReconstructionStart(void) +Document::emitReconstructionStart(void) { // printf("Starting Reconstruction\n"); priv->_reconstruction_start_signal.emit(); @@ -720,33 +720,33 @@ SPDocument::emitReconstructionStart(void) } sigc::connection -SPDocument::connectReconstructionFinish(SPDocument::ReconstructionFinish::slot_type slot) +Document::connectReconstructionFinish(Document::ReconstructionFinish::slot_type slot) { return priv->_reconstruction_finish_signal.connect(slot); } void -SPDocument::emitReconstructionFinish(void) +Document::emitReconstructionFinish(void) { // printf("Finishing Reconstruction\n"); priv->_reconstruction_finish_signal.emit(); return; } -sigc::connection SPDocument::connectCommit(SPDocument::CommitSignal::slot_type slot) +sigc::connection Document::connectCommit(Document::CommitSignal::slot_type slot) { return priv->commit_signal.connect(slot); } -void SPDocument::_emitModified() { +void Document::_emitModified() { static guint const flags = SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG | SP_OBJECT_PARENT_MODIFIED_FLAG; root->emitModified(0); priv->modified_signal.emit(flags); } -void SPDocument::bindObjectToId(gchar const *id, SPObject *object) { +void Document::bindObjectToId(gchar const *id, SPObject *object) { GQuark idq = g_quark_from_string(id); if (object) { @@ -757,7 +757,7 @@ void SPDocument::bindObjectToId(gchar const *id, SPObject *object) { g_hash_table_remove(priv->iddef, GINT_TO_POINTER(idq)); } - SPDocumentPrivate::IDChangedSignalMap::iterator pos; + DocumentPrivate::IDChangedSignalMap::iterator pos; pos = priv->id_changed_signals.find(idq); if ( pos != priv->id_changed_signals.end() ) { @@ -770,31 +770,31 @@ void SPDocument::bindObjectToId(gchar const *id, SPObject *object) { } void -SPDocument::addUndoObserver(Inkscape::UndoStackObserver& observer) +Document::addUndoObserver(Inkscape::UndoStackObserver& observer) { this->priv->undoStackObservers.add(observer); } void -SPDocument::removeUndoObserver(Inkscape::UndoStackObserver& observer) +Document::removeUndoObserver(Inkscape::UndoStackObserver& observer) { this->priv->undoStackObservers.remove(observer); } -SPObject *SPDocument::getObjectById(gchar const *id) { +SPObject *Document::getObjectById(gchar const *id) { g_return_val_if_fail(id != NULL, NULL); GQuark idq = g_quark_from_string(id); return (SPObject*)g_hash_table_lookup(priv->iddef, GINT_TO_POINTER(idq)); } -sigc::connection SPDocument::connectIdChanged(gchar const *id, - SPDocument::IDChangedSignal::slot_type slot) +sigc::connection Document::connectIdChanged(gchar const *id, + Document::IDChangedSignal::slot_type slot) { return priv->id_changed_signals[g_quark_from_string(id)].connect(slot); } -void SPDocument::bindObjectToRepr(Inkscape::XML::Node *repr, SPObject *object) { +void Document::bindObjectToRepr(Inkscape::XML::Node *repr, SPObject *object) { if (object) { g_assert(g_hash_table_lookup(priv->reprdef, repr) == NULL); g_hash_table_insert(priv->reprdef, repr, object); @@ -804,12 +804,12 @@ void SPDocument::bindObjectToRepr(Inkscape::XML::Node *repr, SPObject *object) { } } -SPObject *SPDocument::getObjectByRepr(Inkscape::XML::Node *repr) { +SPObject *Document::getObjectByRepr(Inkscape::XML::Node *repr) { g_return_val_if_fail(repr != NULL, NULL); return (SPObject*)g_hash_table_lookup(priv->reprdef, repr); } -Glib::ustring SPDocument::getLanguage() { +Glib::ustring Document::getLanguage() { gchar const *document_language = rdf_get_work_entity(this, rdf_find_entity("language")); if (document_language) { while (isspace(*document_language)) @@ -841,7 +841,7 @@ Glib::ustring SPDocument::getLanguage() { /* Object modification root handler */ void -sp_document_request_modified(SPDocument *doc) +sp_document_request_modified(Document *doc) { if (!doc->modified_id) { doc->modified_id = gtk_idle_add_priority(SP_DOCUMENT_UPDATE_PRIORITY, sp_document_idle_handler, doc); @@ -849,7 +849,7 @@ sp_document_request_modified(SPDocument *doc) } void -sp_document_setup_viewport (SPDocument *doc, SPItemCtx *ctx) +sp_document_setup_viewport (Document *doc, SPItemCtx *ctx) { ctx->ctx.flags = 0; ctx->i2doc = Geom::identity(); @@ -874,7 +874,7 @@ sp_document_setup_viewport (SPDocument *doc, SPItemCtx *ctx) * been brought fully up to date. */ bool -SPDocument::_updateDocument() +Document::_updateDocument() { /* Process updates */ if (this->root->uflags || this->root->mflags) { @@ -904,7 +904,7 @@ SPDocument::_updateDocument() * since this typically indicates we're stuck in an update loop. */ gint -sp_document_ensure_up_to_date(SPDocument *doc) +sp_document_ensure_up_to_date(Document *doc) { int counter = 32; while (!doc->_updateDocument()) { @@ -930,7 +930,7 @@ sp_document_ensure_up_to_date(SPDocument *doc) static gint sp_document_idle_handler(gpointer data) { - SPDocument *doc = static_cast(data); + Document *doc = static_cast(data); if (doc->_updateDocument()) { doc->modified_id = 0; return false; @@ -1106,7 +1106,7 @@ find_group_at_point(unsigned int dkey, SPGroup *group, Geom::Point const p) * */ -GSList *sp_document_items_in_box(SPDocument *document, unsigned int dkey, Geom::Rect const &box) +GSList *sp_document_items_in_box(Document *document, unsigned int dkey, Geom::Rect const &box) { g_return_val_if_fail(document != NULL, NULL); g_return_val_if_fail(document->priv != NULL, NULL); @@ -1121,7 +1121,7 @@ GSList *sp_document_items_in_box(SPDocument *document, unsigned int dkey, Geom:: * */ -GSList *sp_document_partial_items_in_box(SPDocument *document, unsigned int dkey, Geom::Rect const &box) +GSList *sp_document_partial_items_in_box(Document *document, unsigned int dkey, Geom::Rect const &box) { g_return_val_if_fail(document != NULL, NULL); g_return_val_if_fail(document->priv != NULL, NULL); @@ -1130,7 +1130,7 @@ GSList *sp_document_partial_items_in_box(SPDocument *document, unsigned int dkey } GSList * -sp_document_items_at_points(SPDocument *document, unsigned const key, std::vector points) +sp_document_items_at_points(Document *document, unsigned const key, std::vector points) { GSList *items = NULL; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); @@ -1155,7 +1155,7 @@ sp_document_items_at_points(SPDocument *document, unsigned const key, std::vecto } SPItem * -sp_document_item_at_point(SPDocument *document, unsigned const key, Geom::Point const p, +sp_document_item_at_point(Document *document, unsigned const key, Geom::Point const p, gboolean const into_groups, SPItem *upto) { g_return_val_if_fail(document != NULL, NULL); @@ -1165,7 +1165,7 @@ sp_document_item_at_point(SPDocument *document, unsigned const key, Geom::Point } SPItem* -sp_document_group_at_point(SPDocument *document, unsigned int key, Geom::Point const p) +sp_document_group_at_point(Document *document, unsigned int key, Geom::Point const p) { g_return_val_if_fail(document != NULL, NULL); g_return_val_if_fail(document->priv != NULL, NULL); @@ -1177,7 +1177,7 @@ sp_document_group_at_point(SPDocument *document, unsigned int key, Geom::Point c /* Resource management */ gboolean -sp_document_add_resource(SPDocument *document, gchar const *key, SPObject *object) +sp_document_add_resource(Document *document, gchar const *key, SPObject *object) { GSList *rlist; GQuark q = g_quark_from_string(key); @@ -1202,7 +1202,7 @@ sp_document_add_resource(SPDocument *document, gchar const *key, SPObject *objec } gboolean -sp_document_remove_resource(SPDocument *document, gchar const *key, SPObject *object) +sp_document_remove_resource(Document *document, gchar const *key, SPObject *object) { GSList *rlist; GQuark q = g_quark_from_string(key); @@ -1228,7 +1228,7 @@ sp_document_remove_resource(SPDocument *document, gchar const *key, SPObject *ob } GSList const * -sp_document_get_resource_list(SPDocument *document, gchar const *key) +sp_document_get_resource_list(Document *document, gchar const *key) { g_return_val_if_fail(document != NULL, NULL); g_return_val_if_fail(key != NULL, NULL); @@ -1237,9 +1237,9 @@ sp_document_get_resource_list(SPDocument *document, gchar const *key) return (GSList*)g_hash_table_lookup(document->priv->resources, key); } -sigc::connection sp_document_resources_changed_connect(SPDocument *document, +sigc::connection sp_document_resources_changed_connect(Document *document, gchar const *key, - SPDocument::ResourcesChangedSignal::slot_type slot) + Document::ResourcesChangedSignal::slot_type slot) { GQuark q = g_quark_from_string(key); return document->priv->resources_changed_signals[q].connect(slot); @@ -1267,7 +1267,7 @@ count_objects_recursive(SPObject *obj, unsigned int count) } unsigned int -objects_in_document(SPDocument *document) +objects_in_document(Document *document) { return count_objects_recursive(SP_DOCUMENT_ROOT(document), 0); } @@ -1288,7 +1288,7 @@ vacuum_document_recursive(SPObject *obj) } unsigned int -vacuum_document(SPDocument *document) +vacuum_document(Document *document) { unsigned int start = objects_in_document(document); unsigned int end; @@ -1310,7 +1310,7 @@ vacuum_document(SPDocument *document) return start - newend; } -bool SPDocument::isSeeking() const { +bool Document::isSeeking() const { return priv->seeking; } diff --git a/src/document.h b/src/document.h index 696e568ad..b849181f9 100644 --- a/src/document.h +++ b/src/document.h @@ -1,8 +1,8 @@ -#ifndef __SP_DOCUMENT_H__ -#define __SP_DOCUMENT_H__ +#ifndef __DOCUMENT_H__ +#define __DOCUMENT_H__ /** \file - * SPDocument: Typed SVG document implementation + * Document: Typed SVG document implementation */ /* Authors: * Lauris Kaplinski @@ -60,10 +60,10 @@ namespace Proj { class TransfMat3x4; } -class SPDocumentPrivate; +class DocumentPrivate; /// Typed SVG document implementation. -struct SPDocument : public Inkscape::GC::Managed<>, +class Document : public Inkscape::GC::Managed<>, public Inkscape::GC::Finalized, public Inkscape::GC::Anchored { @@ -76,8 +76,8 @@ struct SPDocument : public Inkscape::GC::Managed<>, typedef sigc::signal ReconstructionFinish; typedef sigc::signal CommitSignal; - SPDocument(); - virtual ~SPDocument(); + Document(); + virtual ~Document(); unsigned int keepalive : 1; unsigned int virgin : 1; ///< Has the document never been touched? @@ -92,7 +92,7 @@ struct SPDocument : public Inkscape::GC::Managed<>, gchar *base; ///< To be used for resolving relative hrefs. gchar *name; ///< basename(uri) or other human-readable label for the document. - SPDocumentPrivate *priv; + DocumentPrivate *priv; /// Last action key const gchar *actionkey; @@ -148,8 +148,8 @@ sigc::connection connectCommit(CommitSignal::slot_type slot); } private: - SPDocument(SPDocument const &); // no copy - void operator=(SPDocument const &); // no assign + Document(Document const &); // no copy + void operator=(Document const &); // no assign public: sigc::connection connectReconstructionStart(ReconstructionStart::slot_type slot); @@ -165,14 +165,14 @@ public: void fitToRect(Geom::Rect const &rect); }; -SPDocument *sp_document_new(const gchar *uri, unsigned int keepalive, bool make_new = false); -SPDocument *sp_document_new_from_mem(const gchar *buffer, gint length, unsigned int keepalive); +Document *sp_document_new(const gchar *uri, unsigned int keepalive, bool make_new = false); +Document *sp_document_new_from_mem(const gchar *buffer, gint length, unsigned int keepalive); -SPDocument *sp_document_ref(SPDocument *doc); -SPDocument *sp_document_unref(SPDocument *doc); +Document *sp_document_ref(Document *doc); +Document *sp_document_unref(Document *doc); -SPDocument *sp_document_create(Inkscape::XML::Document *rdoc, gchar const *uri, gchar const *base, gchar const *name, unsigned int keepalive); +Document *sp_document_create(Inkscape::XML::Document *rdoc, gchar const *uri, gchar const *base, gchar const *name, unsigned int keepalive); /* * Access methods @@ -183,14 +183,14 @@ SPDocument *sp_document_create(Inkscape::XML::Document *rdoc, gchar const *uri, #define sp_document_root(d) (d->root) #define SP_DOCUMENT_ROOT(d) (d->root) -gdouble sp_document_width(SPDocument *document); -gdouble sp_document_height(SPDocument *document); -Geom::Point sp_document_dimensions(SPDocument *document); +gdouble sp_document_width(Document *document); +gdouble sp_document_height(Document *document); +Geom::Point sp_document_dimensions(Document *document); struct SPUnit; -void sp_document_set_width(SPDocument *document, gdouble width, const SPUnit *unit); -void sp_document_set_height(SPDocument *document, gdouble height, const SPUnit *unit); +void sp_document_set_width(Document *document, gdouble width, const SPUnit *unit); +void sp_document_set_height(Document *document, gdouble height, const SPUnit *unit); #define SP_DOCUMENT_URI(d) (d->uri) #define SP_DOCUMENT_NAME(d) (d->name) @@ -204,39 +204,39 @@ void sp_document_set_height(SPDocument *document, gdouble height, const SPUnit * * Undo & redo */ -void sp_document_set_undo_sensitive(SPDocument *document, bool sensitive); -bool sp_document_get_undo_sensitive(SPDocument const *document); +void sp_document_set_undo_sensitive(Document *document, bool sensitive); +bool sp_document_get_undo_sensitive(Document const *document); -void sp_document_clear_undo(SPDocument *document); -void sp_document_clear_redo(SPDocument *document); +void sp_document_clear_undo(Document *document); +void sp_document_clear_redo(Document *document); -void sp_document_child_added(SPDocument *doc, SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref); -void sp_document_child_removed(SPDocument *doc, SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref); -void sp_document_attr_changed(SPDocument *doc, SPObject *object, const gchar *key, const gchar *oldval, const gchar *newval); -void sp_document_content_changed(SPDocument *doc, SPObject *object, const gchar *oldcontent, const gchar *newcontent); -void sp_document_order_changed(SPDocument *doc, SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *oldref, Inkscape::XML::Node *newref); +void sp_document_child_added(Document *doc, SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref); +void sp_document_child_removed(Document *doc, SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref); +void sp_document_attr_changed(Document *doc, SPObject *object, const gchar *key, const gchar *oldval, const gchar *newval); +void sp_document_content_changed(Document *doc, SPObject *object, const gchar *oldcontent, const gchar *newcontent); +void sp_document_order_changed(Document *doc, SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *oldref, Inkscape::XML::Node *newref); /* Object modification root handler */ -void sp_document_request_modified(SPDocument *doc); -gint sp_document_ensure_up_to_date(SPDocument *doc); +void sp_document_request_modified(Document *doc); +gint sp_document_ensure_up_to_date(Document *doc); /* Save all previous actions to stack, as one undo step */ -void sp_document_done(SPDocument *document, unsigned int event_type, Glib::ustring event_description); -void sp_document_maybe_done(SPDocument *document, const gchar *keyconst, unsigned int event_type, Glib::ustring event_description); +void sp_document_done(Document *document, unsigned int event_type, Glib::ustring event_description); +void sp_document_maybe_done(Document *document, const gchar *keyconst, unsigned int event_type, Glib::ustring event_description); void sp_document_reset_key(Inkscape::Application *inkscape, SPDesktop *desktop, GtkObject *base); /* Cancel (and revert) current unsaved actions */ -void sp_document_cancel(SPDocument *document); +void sp_document_cancel(Document *document); /* Undo and redo */ -gboolean sp_document_undo(SPDocument *document); -gboolean sp_document_redo(SPDocument *document); +gboolean sp_document_undo(Document *document); +gboolean sp_document_redo(Document *document); /* Resource management */ -gboolean sp_document_add_resource(SPDocument *document, const gchar *key, SPObject *object); -gboolean sp_document_remove_resource(SPDocument *document, const gchar *key, SPObject *object); -const GSList *sp_document_get_resource_list(SPDocument *document, const gchar *key); -sigc::connection sp_document_resources_changed_connect(SPDocument *document, const gchar *key, SPDocument::ResourcesChangedSignal::slot_type slot); +gboolean sp_document_add_resource(Document *document, const gchar *key, SPObject *object); +gboolean sp_document_remove_resource(Document *document, const gchar *key, SPObject *object); +const GSList *sp_document_get_resource_list(Document *document, const gchar *key); +sigc::connection sp_document_resources_changed_connect(Document *document, const gchar *key, Document::ResourcesChangedSignal::slot_type slot); /* @@ -257,19 +257,19 @@ sigc::connection sp_document_resources_changed_connect(SPDocument *document, con * Misc */ -GSList *sp_document_items_in_box(SPDocument *document, unsigned int dkey, Geom::Rect const &box); -GSList *sp_document_partial_items_in_box(SPDocument *document, unsigned int dkey, Geom::Rect const &box); +GSList *sp_document_items_in_box(Document *document, unsigned int dkey, Geom::Rect const &box); +GSList *sp_document_partial_items_in_box(Document *document, unsigned int dkey, Geom::Rect const &box); SPItem *sp_document_item_from_list_at_point_bottom(unsigned int dkey, SPGroup *group, const GSList *list, Geom::Point const p, bool take_insensitive = false); -SPItem *sp_document_item_at_point (SPDocument *document, unsigned int key, Geom::Point const p, gboolean into_groups, SPItem *upto = NULL); -GSList *sp_document_items_at_points(SPDocument *document, unsigned const key, std::vector points); -SPItem *sp_document_group_at_point (SPDocument *document, unsigned int key, Geom::Point const p); +SPItem *sp_document_item_at_point (Document *document, unsigned int key, Geom::Point const p, gboolean into_groups, SPItem *upto = NULL); +GSList *sp_document_items_at_points(Document *document, unsigned const key, std::vector points); +SPItem *sp_document_group_at_point (Document *document, unsigned int key, Geom::Point const p); -void sp_document_set_uri(SPDocument *document, gchar const *uri); -void sp_document_change_uri_and_hrefs(SPDocument *document, gchar const *uri); +void sp_document_set_uri(Document *document, gchar const *uri); +void sp_document_change_uri_and_hrefs(Document *document, gchar const *uri); -void sp_document_resized_signal_emit(SPDocument *doc, gdouble width, gdouble height); +void sp_document_resized_signal_emit(Document *doc, gdouble width, gdouble height); -unsigned int vacuum_document(SPDocument *document); +unsigned int vacuum_document(Document *document); #endif diff --git a/src/doxygen-main.cpp b/src/doxygen-main.cpp index fd8f4bb1a..47ef14987 100644 --- a/src/doxygen-main.cpp +++ b/src/doxygen-main.cpp @@ -288,7 +288,7 @@ namespace XML {} * - SPSVGView [\ref svg-view.cpp, \ref svg-view.h] * * SPDesktopWidget [\ref desktop-widget.h] SPSVGSPViewWidget [\ref svg-view.cpp] - * SPDocument [\ref document.cpp, \ref document.h] + * Document [\ref document.cpp, \ref document.h] * * SPDrawAnchor [\ref draw-anchor.cpp, \ref draw-anchor.h] * SPKnot [\ref knot.cpp, \ref knot.h, \ref knot-enums.h] diff --git a/src/draw-context.cpp b/src/draw-context.cpp index d2794f0c2..89c2c454e 100644 --- a/src/draw-context.cpp +++ b/src/draw-context.cpp @@ -1,4 +1,4 @@ -#define __SP_DRAW_CONTEXT_C__ +#define __DRAW_CONTEXT_C__ /* * Generic drawing context @@ -664,7 +664,7 @@ spdc_flush_white(SPDrawContext *dc, SPCurve *gc) : SP_EVENT_CONTEXT_DESKTOP(dc)->dt2doc() ); SPDesktop *desktop = SP_EVENT_CONTEXT_DESKTOP(dc); - SPDocument *doc = sp_desktop_document(desktop); + Document *doc = sp_desktop_document(desktop); Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc); if ( c && !c->is_empty() ) { diff --git a/src/event-log.cpp b/src/event-log.cpp index 82de44696..d111c43e1 100644 --- a/src/event-log.cpp +++ b/src/event-log.cpp @@ -19,7 +19,7 @@ namespace Inkscape { -EventLog::EventLog(SPDocument* document) : +EventLog::EventLog(Document* document) : UndoStackObserver(), _connected (false), _document (document), diff --git a/src/event-log.h b/src/event-log.h index 9fcd01e1c..bb17a19a4 100644 --- a/src/event-log.h +++ b/src/event-log.h @@ -44,7 +44,7 @@ public: typedef Gtk::TreeModel::iterator iterator; typedef Gtk::TreeModel::const_iterator const_iterator; - EventLog(SPDocument* document); + EventLog(Document* document); virtual ~EventLog(); /** @@ -115,7 +115,7 @@ public: private: bool _connected; //< connected with dialog - SPDocument *_document; //< document that is logged + Document *_document; //< document that is logged const EventModelColumns _columns; diff --git a/src/file.cpp b/src/file.cpp index 049c1acb4..afca379ca 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -1,3 +1,4 @@ + /** @file * @brief File/Print operations */ @@ -65,6 +66,14 @@ #include "uri.h" #include "xml/rebase-hrefs.h" +#include "streams-handles.h" +#include "streams-webdav.h" +#include "streams-ftp.h" +#include "streams-http.h" + +//#include "buffersystem.h" +#include + #ifdef WITH_GNOME_VFS # include #endif @@ -119,7 +128,7 @@ sp_file_new(const Glib::ustring &templ) char *templName = NULL; if (templ.size()>0) templName = (char *)templ.c_str(); - SPDocument *doc = sp_document_new(templName, TRUE, true); + Document *doc = sp_document_new(templName, TRUE, true); g_return_val_if_fail(doc != NULL, NULL); SPDesktop *dt; @@ -201,7 +210,7 @@ sp_file_open(const Glib::ustring &uri, if (desktop) desktop->setWaitingCursor(); - SPDocument *doc = NULL; + Document *doc = NULL; try { doc = Inkscape::Extension::open(key, uri.c_str()); } catch (Inkscape::Extension::Input::no_extension_found &e) { @@ -214,7 +223,7 @@ sp_file_open(const Glib::ustring &uri, desktop->clearWaitingCursor(); if (doc) { - SPDocument *existing = desktop ? sp_desktop_document(desktop) : NULL; + Document *existing = desktop ? sp_desktop_document(desktop) : NULL; if (existing && existing->virgin && replace_empty) { // If the current desktop is empty, open the document there @@ -254,6 +263,137 @@ sp_file_open(const Glib::ustring &uri, } } + + + +//NOTE1 +bool +sp_file_open_uri(const Inkscape::URI &uri, + Inkscape::Extension::Extension *key, + bool add_to_recent, bool replace_empty) +{ + Document *doc = NULL; + try { + doc = Inkscape::Extension::open(key, uri.toNativeFilename()); + } catch (Inkscape::Extension::Input::no_extension_found &e) { + doc = NULL; + } catch (Inkscape::Extension::Input::open_failed &e) { + doc = NULL; + } + + //FIXME1 KLUDGE switch + + //WebDAV + /* + if (std::strstr(uri.toString(), "http") != NULL) + { + if (strcmp(uri.toString(), "/http") >= 5//FIXME3 skip begining '/' + || + strcmp(uri.toString(), "http") >= 4 + ) + { + + std::cout<<"+++ 'http' uri.toString->"< FTP , HTTP etc."<= 4//FIXME3 skip begining '/' + || + strcmp(uri.toString(), "ftp") >= 3 + ) + { + std::cout<<"+++ 'ftp' uri.toString->"<> buf; + std::cout<<"buf->"<= 5//FIXME3 skip begining '/' + || + strcmp(uri.toString(), "http") >= 4 + ) + { + std::cout<<"+++ 'http' uri.toString->"<> buf; + std::cout<<"buf->"<virgin && replace_empty) { + // If the current desktop is empty, open the document there + sp_document_ensure_up_to_date (doc); + desktop->change_document(doc); + sp_document_resized_signal_emit (doc, sp_document_width(doc), sp_document_height(doc)); + } else { + if (!Inkscape::NSApplication::Application::getNewGui()) { + // create a whole new desktop and window + SPViewWidget *dtw = sp_desktop_widget_new(sp_document_namedview(doc, NULL)); + sp_create_window(dtw, TRUE); + desktop = static_cast(dtw->view); + } else { + desktop = Inkscape::NSApplication::Editor::createDesktop (doc); + } + } + + doc->virgin = FALSE; + // everyone who cares now has a reference, get rid of ours + sp_document_unref(doc); + // resize the window to match the document properties + sp_namedview_window_from_document(desktop); + sp_namedview_update_layers_from_document(desktop); + + if (add_to_recent) { +//--tullarisc prefs_set_recent_file(SP_DOCUMENT_URI(doc), SP_DOCUMENT_NAME(doc)); + } + + return TRUE; + } else { + //FIXME 1 + //gchar *safeUri = Inkscape::IO::sanitizeString(uri.toNativeFilename()); + //gchar *text = g_strdup_printf(_("Failed to load the requested file %s"), safeUri); + //sp_ui_error_dialog(text); + //g_free(text); + //g_free(safeUri); + return FALSE; + } +} + + /** * Handle prompting user for "do you want to revert"? Revert on "OK" */ @@ -263,7 +403,7 @@ sp_file_revert_dialog() SPDesktop *desktop = SP_ACTIVE_DESKTOP; g_assert(desktop != NULL); - SPDocument *doc = sp_desktop_document(desktop); + Document *doc = sp_desktop_document(desktop); g_assert(doc != NULL); Inkscape::XML::Node *repr = sp_document_repr_root(doc); @@ -397,6 +537,7 @@ void dump_ustr(Glib::ustring const &ustr) /** * Display an file Open selector. Open a document if OK is pressed. * Can select single or multiple files for opening. + * NOTE1 */ void sp_file_open_dialog(Gtk::Window &parentWindow, gpointer /*object*/, gpointer /*data*/) @@ -521,7 +662,7 @@ sp_file_open_dialog(Gtk::Window &parentWindow, gpointer /*object*/, gpointer /*d open_path.append(G_DIR_SEPARATOR_S); prefs->setString("/dialogs/open/path", open_path); - sp_file_open(fileName, selection); + sp_file_open_uri(Inkscape::URI(fileName.c_str()), selection); } return; @@ -540,7 +681,7 @@ sp_file_open_dialog(Gtk::Window &parentWindow, gpointer /*object*/, gpointer /*d void sp_file_vacuum() { - SPDocument *doc = SP_ACTIVE_DOCUMENT; + Document *doc = SP_ACTIVE_DOCUMENT; unsigned int diff = vacuum_document (doc); @@ -572,7 +713,7 @@ sp_file_vacuum() * document; is true for normal save, false for temporary saves */ static bool -file_save(Gtk::Window &parentWindow, SPDocument *doc, const Glib::ustring &uri, +file_save(Gtk::Window &parentWindow, Document *doc, const Glib::ustring &uri, Inkscape::Extension::Extension *key, bool saveas, bool official) { if (!doc || uri.size()<1) //Safety check @@ -614,7 +755,7 @@ file_save(Gtk::Window &parentWindow, SPDocument *doc, const Glib::ustring &uri, * Used only for remote saving using VFS and a specific uri. Gets the file at the /tmp. */ bool -file_save_remote(SPDocument */*doc*/, +file_save_remote(Document */*doc*/, #ifdef WITH_GNOME_VFS const Glib::ustring &uri, #else @@ -702,7 +843,7 @@ file_save_remote(SPDocument */*doc*/, * \param ascopy (optional) wether to set the documents->uri to the new filename or not */ bool -sp_file_save_dialog(Gtk::Window &parentWindow, SPDocument *doc, bool is_copy) +sp_file_save_dialog(Gtk::Window &parentWindow, Document *doc, bool is_copy) { Inkscape::XML::Node *repr = sp_document_repr_root(doc); @@ -837,7 +978,7 @@ sp_file_save_dialog(Gtk::Window &parentWindow, SPDocument *doc, bool is_copy) * Save a document, displaying a SaveAs dialog if necessary. */ bool -sp_file_save_document(Gtk::Window &parentWindow, SPDocument *doc) +sp_file_save_document(Gtk::Window &parentWindow, Document *doc) { bool success = true; @@ -913,13 +1054,13 @@ sp_file_save_a_copy(Gtk::Window &parentWindow, gpointer /*object*/, gpointer /*d * Import a resource. Called by sp_file_import() */ void -file_import(SPDocument *in_doc, const Glib::ustring &uri, +file_import(Document *in_doc, const Glib::ustring &uri, Inkscape::Extension::Extension *key) { SPDesktop *desktop = SP_ACTIVE_DESKTOP; //DEBUG_MESSAGE( fileImport, "file_import( in_doc:%p uri:[%s], key:%p", in_doc, uri, key ); - SPDocument *doc; + Document *doc; try { doc = Inkscape::Extension::open(key, uri.c_str()); } catch (Inkscape::Extension::Input::no_extension_found &e) { @@ -1050,7 +1191,7 @@ sp_file_import(Gtk::Window &parentWindow) { static Glib::ustring import_path; - SPDocument *doc = SP_ACTIVE_DOCUMENT; + Document *doc = SP_ACTIVE_DOCUMENT; if (!doc) return; @@ -1133,7 +1274,7 @@ bool sp_file_export_dialog(void *widget) { //# temp hack for 'doc' until we can switch to this dialog - SPDocument *doc = SP_ACTIVE_DOCUMENT; + Document *doc = SP_ACTIVE_DOCUMENT; Glib::ustring export_path; Glib::ustring export_loc; @@ -1269,7 +1410,7 @@ sp_file_export_to_ocal_dialog(Gtk::Window &parentWindow) if (!SP_ACTIVE_DOCUMENT) return false; - SPDocument *doc = SP_ACTIVE_DOCUMENT; + Document *doc = SP_ACTIVE_DOCUMENT; Glib::ustring export_path; Glib::ustring export_loc; @@ -1427,7 +1568,7 @@ sp_file_import_from_ocal(Gtk::Window &parentWindow) { static Glib::ustring import_path; - SPDocument *doc = SP_ACTIVE_DOCUMENT; + Document *doc = SP_ACTIVE_DOCUMENT; if (!doc) return; @@ -1485,7 +1626,7 @@ sp_file_import_from_ocal(Gtk::Window &parentWindow) void sp_file_print(Gtk::Window& parentWindow) { - SPDocument *doc = SP_ACTIVE_DOCUMENT; + Document *doc = SP_ACTIVE_DOCUMENT; if (doc) sp_print_document(parentWindow, doc); } @@ -1498,7 +1639,7 @@ void sp_file_print_preview(gpointer /*object*/, gpointer /*data*/) { - SPDocument *doc = SP_ACTIVE_DOCUMENT; + Document *doc = SP_ACTIVE_DOCUMENT; if (doc) sp_print_preview_document(doc); diff --git a/src/file.h b/src/file.h index ce75a61a7..2eaace640 100644 --- a/src/file.h +++ b/src/file.h @@ -21,8 +21,15 @@ #include "extension/extension-forward.h" +#include +#include +#include + +#include "uri.h" +#include "streams-webdav.h" + struct SPDesktop; -struct SPDocument; +struct Document; namespace Inkscape { namespace Extension { @@ -64,6 +71,17 @@ bool sp_file_open( bool replace_empty = true ); +//NOTE1 +/* + * Opens a new file and window from the given URI (class) + */ +bool sp_file_open_uri( + const Inkscape::URI &uri, + Inkscape::Extension::Extension *key, + bool add_to_recent = true, + bool replace_empty = true + ); + /** * Displays a file open dialog. Calls sp_file_open on * an OK. @@ -83,7 +101,7 @@ void sp_file_revert_dialog (); * Added to make only the remote savings. */ -bool file_save_remote(SPDocument *doc, const Glib::ustring &uri, +bool file_save_remote(Document *doc, const Glib::ustring &uri, Inkscape::Extension::Extension *key, bool saveas, bool official); /** @@ -108,10 +126,10 @@ bool sp_file_save_a_copy (Gtk::Window &parentWindow, gpointer object, gpointer d * Saves the given document. Displays a file select dialog * if needed. */ -bool sp_file_save_document (Gtk::Window &parentWindow, SPDocument *document); +bool sp_file_save_document (Gtk::Window &parentWindow, Document *document); /* Do the saveas dialog with a document as the parameter */ -bool sp_file_save_dialog (Gtk::Window &parentWindow, SPDocument *doc, bool bAsCopy = FALSE); +bool sp_file_save_dialog (Gtk::Window &parentWindow, Document *doc, bool bAsCopy = FALSE); /*###################### @@ -127,7 +145,7 @@ void sp_file_import (Gtk::Window &parentWindow); /** * Imports a resource */ -void file_import(SPDocument *in_doc, const Glib::ustring &uri, +void file_import(Document *in_doc, const Glib::ustring &uri, Inkscape::Extension::Extension *key); /*###################### @@ -199,6 +217,15 @@ void sp_file_vacuum (); #endif +//namespace Inkscape { +//namespace Net { + + + +//} +//} +// #endif + /* Local Variables: mode:c++ diff --git a/src/filter-chemistry.cpp b/src/filter-chemistry.cpp index 363663ac3..d40347889 100644 --- a/src/filter-chemistry.cpp +++ b/src/filter-chemistry.cpp @@ -88,7 +88,7 @@ static void set_filter_area(Inkscape::XML::Node *repr, gdouble radius, } } -SPFilter *new_filter(SPDocument *document) +SPFilter *new_filter(Document *document) { g_return_val_if_fail(document != NULL, NULL); @@ -184,7 +184,7 @@ filter_add_primitive(SPFilter *filter, const Inkscape::Filters::FilterPrimitiveT * Creates a filter with blur primitive of specified radius for an item with the given matrix expansion, width and height */ SPFilter * -new_filter_gaussian_blur (SPDocument *document, gdouble radius, double expansion, double expansionX, double expansionY, double width, double height) +new_filter_gaussian_blur (Document *document, gdouble radius, double expansion, double expansionX, double expansionY, double width, double height) { g_return_val_if_fail(document != NULL, NULL); @@ -238,7 +238,7 @@ new_filter_gaussian_blur (SPDocument *document, gdouble radius, double expansion * an item with the given matrix expansion, width and height */ SPFilter * -new_filter_blend_gaussian_blur (SPDocument *document, const char *blendmode, gdouble radius, double expansion, +new_filter_blend_gaussian_blur (Document *document, const char *blendmode, gdouble radius, double expansion, double expansionX, double expansionY, double width, double height) { g_return_val_if_fail(document != NULL, NULL); @@ -317,7 +317,7 @@ new_filter_blend_gaussian_blur (SPDocument *document, const char *blendmode, gdo * specified mode and radius, respectively */ SPFilter * -new_filter_simple_from_item (SPDocument *document, SPItem *item, const char *mode, gdouble radius) +new_filter_simple_from_item (Document *document, SPItem *item, const char *mode, gdouble radius) { Geom::OptRect const r = sp_item_bbox_desktop(item, SPItem::GEOMETRIC_BBOX); @@ -345,7 +345,7 @@ new_filter_simple_from_item (SPDocument *document, SPItem *item, const char *mod */ /* TODO: this should be made more generic, not just for blurs */ SPFilter * -modify_filter_gaussian_blur_from_item(SPDocument *document, SPItem *item, +modify_filter_gaussian_blur_from_item(Document *document, SPItem *item, gdouble radius) { if (!item->style || !item->style->filter.set) { diff --git a/src/filter-chemistry.h b/src/filter-chemistry.h index 1b18ec11a..ee249d6f2 100644 --- a/src/filter-chemistry.h +++ b/src/filter-chemistry.h @@ -18,10 +18,10 @@ #include "sp-filter.h" SPFilterPrimitive *filter_add_primitive(SPFilter *filter, Inkscape::Filters::FilterPrimitiveType); -SPFilter *new_filter (SPDocument *document); -SPFilter *new_filter_gaussian_blur (SPDocument *document, gdouble stdDeviation, double expansion, double expansionX, double expansionY, double width, double height); -SPFilter *new_filter_simple_from_item (SPDocument *document, SPItem *item, const char *mode, gdouble stdDeviation); -SPFilter *modify_filter_gaussian_blur_from_item (SPDocument *document, SPItem *item, gdouble stdDeviation); +SPFilter *new_filter (Document *document); +SPFilter *new_filter_gaussian_blur (Document *document, gdouble stdDeviation, double expansion, double expansionX, double expansionY, double width, double height); +SPFilter *new_filter_simple_from_item (Document *document, SPItem *item, const char *mode, gdouble stdDeviation); +SPFilter *modify_filter_gaussian_blur_from_item (Document *document, SPItem *item, gdouble stdDeviation); void remove_filter (SPObject *item, bool recursive); void remove_filter_gaussian_blur (SPObject *item); bool filter_is_single_gaussian_blur(SPFilter *filter); diff --git a/src/flood-context.cpp b/src/flood-context.cpp index 7b6223384..9855c42f1 100644 --- a/src/flood-context.cpp +++ b/src/flood-context.cpp @@ -394,7 +394,7 @@ inline static bool check_if_pixel_is_paintable(guchar *px, unsigned char *trace_ * \param union_with_selection If true, merge the final SVG path with the current selection. */ static void do_trace(bitmap_coords_info bci, guchar *trace_px, SPDesktop *desktop, Geom::Matrix transform, unsigned int min_x, unsigned int max_x, unsigned int min_y, unsigned int max_y, bool union_with_selection) { - SPDocument *document = sp_desktop_document(desktop); + Document *document = sp_desktop_document(desktop); unsigned char *trace_t; @@ -770,7 +770,7 @@ static bool sort_fill_queue_horizontal(Geom::Point a, Geom::Point b) { */ static void sp_flood_do_flood_fill(SPEventContext *event_context, GdkEvent *event, bool union_with_selection, bool is_point_fill, bool is_touch_fill) { SPDesktop *desktop = event_context->desktop; - SPDocument *document = sp_desktop_document(desktop); + Document *document = sp_desktop_document(desktop); /* Create new arena */ NRArena *arena = NRArena::create(); diff --git a/src/forward.h b/src/forward.h index d4a98fbff..852934e96 100644 --- a/src/forward.h +++ b/src/forward.h @@ -43,11 +43,11 @@ GType sp_event_context_get_type (); /* Document tree */ -class SPDocument; +class Document; class SPDocumentClass; #define SP_TYPE_DOCUMENT (sp_document_get_type ()) -#define SP_DOCUMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_DOCUMENT, SPDocument)) +#define SP_DOCUMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_DOCUMENT, Document)) #define SP_IS_DOCUMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_DOCUMENT)) GType sp_document_get_type (); diff --git a/src/gradient-chemistry.cpp b/src/gradient-chemistry.cpp index 4abd7483f..85e4e2c55 100644 --- a/src/gradient-chemistry.cpp +++ b/src/gradient-chemistry.cpp @@ -92,7 +92,7 @@ sp_gradient_ensure_vector_normalized(SPGradient *gr) */ static SPGradient * -sp_gradient_get_private_normalized(SPDocument *document, SPGradient *vector, SPGradientType type) +sp_gradient_get_private_normalized(Document *document, SPGradient *vector, SPGradientType type) { g_return_val_if_fail(document != NULL, NULL); g_return_val_if_fail(vector != NULL, NULL); @@ -199,7 +199,7 @@ sp_gradient_fork_private_if_necessary(SPGradient *gr, SPGradient *vector, return gr; } - SPDocument *doc = SP_OBJECT_DOCUMENT(gr); + Document *doc = SP_OBJECT_DOCUMENT(gr); SPObject *defs = SP_DOCUMENT_DEFS(doc); if ((gr->has_stops) || @@ -245,7 +245,7 @@ sp_gradient_fork_vector_if_necessary (SPGradient *gr) return gr; if (SP_OBJECT_HREFCOUNT(gr) > 1) { - SPDocument *doc = SP_OBJECT_DOCUMENT(gr); + Document *doc = SP_OBJECT_DOCUMENT(gr); Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc); Inkscape::XML::Node *repr = SP_OBJECT_REPR (gr)->duplicate(xml_doc); @@ -1210,7 +1210,7 @@ sp_gradient_repr_set_link(Inkscape::XML::Node *repr, SPGradient *link) */ SPGradient * -sp_document_default_gradient_vector(SPDocument *document, guint32 color) +sp_document_default_gradient_vector(Document *document, guint32 color) { SPDefs *defs = (SPDefs *) SP_DOCUMENT_DEFS(document); Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document); @@ -1271,7 +1271,7 @@ Return the preferred vector for \a o, made from (in order of preference) its cur current fill or stroke color, or from desktop style if \a o is NULL or doesn't have style. */ SPGradient * -sp_gradient_vector_for_object(SPDocument *const doc, SPDesktop *const desktop, +sp_gradient_vector_for_object(Document *const doc, SPDesktop *const desktop, SPObject *const o, bool const is_fill) { guint32 rgba = 0; diff --git a/src/gradient-chemistry.h b/src/gradient-chemistry.h index 73b9893bc..94351d483 100644 --- a/src/gradient-chemistry.h +++ b/src/gradient-chemistry.h @@ -41,8 +41,8 @@ SPGradient *sp_item_set_gradient (SPItem *item, SPGradient *gr, SPGradientType t * Get default normalized gradient vector of document, create if there is none */ -SPGradient *sp_document_default_gradient_vector (SPDocument *document, guint32 color = 0); -SPGradient *sp_gradient_vector_for_object (SPDocument *doc, SPDesktop *desktop, SPObject *o, bool is_fill); +SPGradient *sp_document_default_gradient_vector (Document *document, guint32 color = 0); +SPGradient *sp_gradient_vector_for_object (Document *doc, SPDesktop *desktop, SPObject *o, bool is_fill); void sp_object_ensure_fill_gradient_normalized (SPObject *object); void sp_object_ensure_stroke_gradient_normalized (SPObject *object); diff --git a/src/gradient-context.cpp b/src/gradient-context.cpp index fc5c1af44..64a836b8f 100644 --- a/src/gradient-context.cpp +++ b/src/gradient-context.cpp @@ -346,7 +346,7 @@ sp_gradient_context_get_stop_intervals (GrDrag *drag, GSList **these_stops, GSLi static void sp_gradient_context_add_stops_between_selected_stops (SPGradientContext *rc) { - SPDocument *doc = NULL; + Document *doc = NULL; GrDrag *drag = rc->_grdrag; GSList *these_stops = NULL; @@ -403,7 +403,7 @@ double sqr(double x) {return x*x;} static void sp_gradient_simplify(SPGradientContext *rc, double tolerance) { - SPDocument *doc = NULL; + Document *doc = NULL; GrDrag *drag = rc->_grdrag; GSList *these_stops = NULL; @@ -861,7 +861,7 @@ static void sp_gradient_drag(SPGradientContext &rc, Geom::Point const pt, guint { SPDesktop *desktop = SP_EVENT_CONTEXT(&rc)->desktop; Inkscape::Selection *selection = sp_desktop_selection(desktop); - SPDocument *document = sp_desktop_document(desktop); + Document *document = sp_desktop_document(desktop); SPEventContext *ec = SP_EVENT_CONTEXT(&rc); if (!selection->isEmpty()) { diff --git a/src/gradient-drag.cpp b/src/gradient-drag.cpp index c16ed2456..65f310e6a 100644 --- a/src/gradient-drag.cpp +++ b/src/gradient-drag.cpp @@ -1914,7 +1914,7 @@ GrDrag::deleteSelected (bool just_one) { if (!selected) return; - SPDocument *document = false; + Document *document = false; struct StructStopInfo { SPStop * spstop; diff --git a/src/id-clash.cpp b/src/id-clash.cpp index b215576a4..e739c4e4c 100644 --- a/src/id-clash.cpp +++ b/src/id-clash.cpp @@ -177,7 +177,7 @@ find_references(SPObject *elem, refmap_type *refmap) * a list of those changes that will require fixing up references. */ static void -change_clashing_ids(SPDocument *imported_doc, SPDocument *current_doc, +change_clashing_ids(Document *imported_doc, Document *current_doc, SPObject *elem, const refmap_type *refmap, id_changelist_type *id_changes) { @@ -259,7 +259,7 @@ fix_up_refs(const refmap_type *refmap, const id_changelist_type &id_changes) * those IDs are updated accordingly. */ void -prevent_id_clashes(SPDocument *imported_doc, SPDocument *current_doc) +prevent_id_clashes(Document *imported_doc, Document *current_doc) { refmap_type *refmap = new refmap_type; id_changelist_type id_changes; diff --git a/src/id-clash.h b/src/id-clash.h index 418642738..1abd1dd83 100644 --- a/src/id-clash.h +++ b/src/id-clash.h @@ -3,7 +3,7 @@ #include "document.h" -void prevent_id_clashes(SPDocument *imported_doc, SPDocument *current_doc); +void prevent_id_clashes(Document *imported_doc, Document *current_doc); #endif /* !SEEN_ID_CLASH_H */ diff --git a/src/inkscape-private.h b/src/inkscape-private.h index cb7f98729..001d1201a 100644 --- a/src/inkscape-private.h +++ b/src/inkscape-private.h @@ -47,8 +47,8 @@ void inkscape_add_desktop (SPDesktop * desktop); void inkscape_remove_desktop (SPDesktop * desktop); void inkscape_activate_desktop (SPDesktop * desktop); void inkscape_reactivate_desktop (SPDesktop * desktop); -void inkscape_add_document (SPDocument *document); -bool inkscape_remove_document (SPDocument *document); +void inkscape_add_document (Document *document); +bool inkscape_remove_document (Document *document); void inkscape_set_color (SPColor *color, float opacity); diff --git a/src/inkscape.cpp b/src/inkscape.cpp index 60ab895ed..c2c45d3bb 100644 --- a/src/inkscape.cpp +++ b/src/inkscape.cpp @@ -105,7 +105,7 @@ static void inkscape_deactivate_desktop_private (Inkscape::Application *inkscape struct Inkscape::Application { GObject object; Inkscape::XML::Document *menus; - std::map document_set; + std::map document_set; GSList *desktops; gchar *argv0; gboolean dialogs_toggle; @@ -126,7 +126,7 @@ struct Inkscape::ApplicationClass { void (* set_eventcontext) (Inkscape::Application * inkscape, SPEventContext * eventcontext); void (* activate_desktop) (Inkscape::Application * inkscape, SPDesktop * desktop); void (* deactivate_desktop) (Inkscape::Application * inkscape, SPDesktop * desktop); - void (* destroy_document) (Inkscape::Application *inkscape, SPDocument *doc); + void (* destroy_document) (Inkscape::Application *inkscape, Document *doc); void (* color_set) (Inkscape::Application *inkscape, SPColor *color, double opacity); void (* shut_down) (Inkscape::Application *inkscape); void (* dialogs_hide) (Inkscape::Application *inkscape); @@ -326,11 +326,11 @@ static gint inkscape_autosave(gpointer) gint docnum = 0; SP_ACTIVE_DESKTOP->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Autosaving documents...")); - for (std::map::iterator iter = inkscape->document_set.begin(); + for (std::map::iterator iter = inkscape->document_set.begin(); iter != inkscape->document_set.end(); ++iter) { - SPDocument *doc = iter->first; + Document *doc = iter->first; ++docnum; @@ -463,7 +463,7 @@ inkscape_init (SPObject * object) g_assert_not_reached (); } - new (&inkscape->document_set) std::map(); + new (&inkscape->document_set) std::map(); inkscape->menus = sp_repr_read_mem (_(menus_skeleton), MENUS_SKELETON_SIZE, NULL); inkscape->desktops = NULL; @@ -597,10 +597,10 @@ inkscape_crash_handler (int /*signum*/) gint count = 0; GSList *savednames = NULL; GSList *failednames = NULL; - for (std::map::iterator iter = inkscape->document_set.begin(); + for (std::map::iterator iter = inkscape->document_set.begin(); iter != inkscape->document_set.end(); ++iter) { - SPDocument *doc = iter->first; + Document *doc = iter->first; Inkscape::XML::Node *repr; repr = sp_document_repr_root (doc); if (doc->isModifiedSinceSave()) { @@ -1219,7 +1219,7 @@ inkscape_external_change () * fixme: These need probably signals too */ void -inkscape_add_document (SPDocument *document) +inkscape_add_document (Document *document) { g_return_if_fail (document != NULL); @@ -1228,7 +1228,7 @@ inkscape_add_document (SPDocument *document) // try to insert the pair into the list if (!(inkscape->document_set.insert(std::make_pair(document, 1)).second)) { //insert failed, this key (document) is already in the list - for (std::map::iterator iter = inkscape->document_set.begin(); + for (std::map::iterator iter = inkscape->document_set.begin(); iter != inkscape->document_set.end(); ++iter) { if (iter->first == document) { @@ -1247,13 +1247,13 @@ inkscape_add_document (SPDocument *document) // returns true if this was last reference to this document, so you can delete it bool -inkscape_remove_document (SPDocument *document) +inkscape_remove_document (Document *document) { g_return_val_if_fail (document != NULL, false); if (!Inkscape::NSApplication::Application::getNewGui()) { - for (std::map::iterator iter = inkscape->document_set.begin(); + for (std::map::iterator iter = inkscape->document_set.begin(); iter != inkscape->document_set.end(); ++iter) { if (iter->first == document) { @@ -1290,7 +1290,7 @@ inkscape_active_desktop (void) return (SPDesktop *) inkscape->desktops->data; } -SPDocument * +Document * inkscape_active_document (void) { if (Inkscape::NSApplication::Application::getNewGui()) @@ -1304,13 +1304,13 @@ inkscape_active_document (void) } bool inkscape_is_sole_desktop_for_document(SPDesktop const &desktop) { - SPDocument const* document = desktop.doc(); + Document const* document = desktop.doc(); if (!document) { return false; } for ( GSList *iter = inkscape->desktops ; iter ; iter = iter->next ) { SPDesktop *other_desktop=(SPDesktop *)iter->data; - SPDocument *other_document=other_desktop->doc(); + Document *other_document=other_desktop->doc(); if ( other_document == document && other_desktop != &desktop ) { return false; } diff --git a/src/inkscape.h b/src/inkscape.h index ca2894227..e611af49b 100644 --- a/src/inkscape.h +++ b/src/inkscape.h @@ -16,7 +16,7 @@ #include struct SPDesktop; -struct SPDocument; +struct Document; struct SPEventContext; namespace Inkscape { @@ -46,7 +46,7 @@ Inkscape::Application *inkscape_get_instance(); SPEventContext * inkscape_active_event_context (void); #define SP_ACTIVE_DOCUMENT inkscape_active_document () -SPDocument * inkscape_active_document (void); +Document * inkscape_active_document (void); #define SP_ACTIVE_DESKTOP inkscape_active_desktop () SPDesktop * inkscape_active_desktop (void); diff --git a/src/inkview.cpp b/src/inkview.cpp index 5cfde2c81..0278d3029 100644 --- a/src/inkview.cpp +++ b/src/inkview.cpp @@ -84,7 +84,7 @@ struct SPSlideShow { int size; int length; int current; - SPDocument *doc; + Document *doc; GtkWidget *view; GtkWidget *window; bool fullscreen; @@ -441,7 +441,7 @@ sp_svgview_normal_cursor(struct SPSlideShow *ss) } static void -sp_svgview_set_document(struct SPSlideShow *ss, SPDocument *doc, int current) +sp_svgview_set_document(struct SPSlideShow *ss, Document *doc, int current) { if (doc && doc != ss->doc) { sp_document_ensure_up_to_date (doc); @@ -459,7 +459,7 @@ sp_svgview_show_next (struct SPSlideShow *ss) { sp_svgview_waiting_cursor(ss); - SPDocument *doc = NULL; + Document *doc = NULL; int current = ss->current; while (!doc && (current < ss->length - 1)) { doc = sp_document_new (ss->slides[++current], TRUE, false); @@ -475,7 +475,7 @@ sp_svgview_show_prev (struct SPSlideShow *ss) { sp_svgview_waiting_cursor(ss); - SPDocument *doc = NULL; + Document *doc = NULL; int current = ss->current; while (!doc && (current > 0)) { doc = sp_document_new (ss->slides[--current], TRUE, false); @@ -491,7 +491,7 @@ sp_svgview_goto_first (struct SPSlideShow *ss) { sp_svgview_waiting_cursor(ss); - SPDocument *doc = NULL; + Document *doc = NULL; int current = 0; while ( !doc && (current < ss->length - 1)) { if (current == ss->current) @@ -509,7 +509,7 @@ sp_svgview_goto_last (struct SPSlideShow *ss) { sp_svgview_waiting_cursor(ss); - SPDocument *doc = NULL; + Document *doc = NULL; int current = ss->length - 1; while (!doc && (current >= 0)) { if (current == ss->current) @@ -555,8 +555,8 @@ static void usage() Inkscape::Application *inkscape_get_instance() { return NULL; } void inkscape_ref (void) {} void inkscape_unref (void) {} -void inkscape_add_document (SPDocument *document) {} -void inkscape_remove_document (SPDocument *document) {} +void inkscape_add_document (Document *document) {} +void inkscape_remove_document (Document *document) {} #endif diff --git a/src/interface.cpp b/src/interface.cpp index cf7072064..475ecdf16 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -271,7 +271,7 @@ sp_create_window(SPViewWidget *vw, gboolean editable) void sp_ui_new_view() { - SPDocument *document; + Document *document; SPViewWidget *dtw; document = SP_ACTIVE_DOCUMENT; @@ -290,7 +290,7 @@ sp_ui_new_view() void sp_ui_new_view_preview() { - SPDocument *document; + Document *document; SPViewWidget *dtw; document = SP_ACTIVE_DOCUMENT; @@ -1125,7 +1125,7 @@ sp_ui_drag_data_received(GtkWidget *widget, guint /*event_time*/, gpointer /*user_data*/) { - SPDocument *doc = SP_ACTIVE_DOCUMENT; + Document *doc = SP_ACTIVE_DOCUMENT; SPDesktop *desktop = SP_ACTIVE_DESKTOP; switch (info) { @@ -1508,7 +1508,7 @@ void sp_ui_drag_motion( GtkWidget */*widget*/, guint /*event_time*/, gpointer /*user_data*/) { -// SPDocument *doc = SP_ACTIVE_DOCUMENT; +// Document *doc = SP_ACTIVE_DOCUMENT; // SPDesktop *desktop = SP_ACTIVE_DESKTOP; @@ -1546,7 +1546,7 @@ sp_ui_import_one_file_with_check(gpointer filename, gpointer /*unused*/) static void sp_ui_import_one_file(char const *filename) { - SPDocument *doc = SP_ACTIVE_DOCUMENT; + Document *doc = SP_ACTIVE_DOCUMENT; if (!doc) return; if (filename == NULL) return; diff --git a/src/jabber_whiteboard/node-tracker.h b/src/jabber_whiteboard/node-tracker.h index 66814c5ca..01087d04e 100644 --- a/src/jabber_whiteboard/node-tracker.h +++ b/src/jabber_whiteboard/node-tracker.h @@ -168,7 +168,7 @@ public: const Glib::ustring &name); /** - * Returns whether or not the given node is the root node of the SPDocument associated + * Returns whether or not the given node is the root node of the Document associated * with an XMLNodeTracker's SessionManager. * * \param Reference to an XML::Node to test. diff --git a/src/jabber_whiteboard/session-manager.h b/src/jabber_whiteboard/session-manager.h index 53cc8f5b4..48e912265 100644 --- a/src/jabber_whiteboard/session-manager.h +++ b/src/jabber_whiteboard/session-manager.h @@ -26,7 +26,7 @@ #include "gc-alloc.h" -class SPDocument; +class Document; class SPDesktop; @@ -118,10 +118,10 @@ private: }; -SPDocument* makeInkboardDocument(int code, gchar const* rootname, +Document* makeInkboardDocument(int code, gchar const* rootname, State::SessionType type, Glib::ustring const& to); -SPDesktop* makeInkboardDesktop(SPDocument* doc); +SPDesktop* makeInkboardDesktop(Document* doc); } // namespace Whiteboard diff --git a/src/layer-fns.cpp b/src/layer-fns.cpp index 75bb89bcf..2431b0758 100644 --- a/src/layer-fns.cpp +++ b/src/layer-fns.cpp @@ -165,7 +165,7 @@ SPObject *previous_layer(SPObject *root, SPObject *layer) { * \pre \a root should be either \a layer or an ancestor of it */ SPObject *create_layer(SPObject *root, SPObject *layer, LayerRelativePosition position) { - SPDocument *document=SP_OBJECT_DOCUMENT(root); + Document *document=SP_OBJECT_DOCUMENT(root); static int layer_suffix=1; gchar *id=NULL; diff --git a/src/layer-manager.cpp b/src/layer-manager.cpp index 8c45c7e53..fe0d41904 100644 --- a/src/layer-manager.cpp +++ b/src/layer-manager.cpp @@ -126,12 +126,12 @@ LayerManager::LayerManager(SPDesktop *desktop) { _layer_connection = desktop->connectCurrentLayerChanged( sigc::mem_fun(*this, &LayerManager::_selectedLayerChanged) ); - sigc::bound_mem_functor1 first = sigc::mem_fun(*this, &LayerManager::_setDocument); + sigc::bound_mem_functor1 first = sigc::mem_fun(*this, &LayerManager::_setDocument); // This next line has problems on gcc 4.0.2 - sigc::slot base2 = first; + sigc::slot base2 = first; - sigc::slot slot2 = sigc::hide<0>( base2 ); + sigc::slot slot2 = sigc::hide<0>( base2 ); _document_connection = desktop->connectDocumentReplaced( slot2 ); _setDocument(desktop->doc()); @@ -211,7 +211,7 @@ void LayerManager::renameLayer( SPObject* obj, gchar const *label, bool uniquify -void LayerManager::_setDocument(SPDocument *document) { +void LayerManager::_setDocument(Document *document) { if (_document) { _resource_connection.disconnect(); } diff --git a/src/layer-manager.h b/src/layer-manager.h index 81f75e002..bbd5ccafb 100644 --- a/src/layer-manager.h +++ b/src/layer-manager.h @@ -17,7 +17,7 @@ #include class SPDesktop; -class SPDocument; +class Document; namespace Inkscape { @@ -44,7 +44,7 @@ private: class LayerWatcher; void _objectModified( SPObject* obj, guint flags ); - void _setDocument(SPDocument *document); + void _setDocument(Document *document); void _rebuild(); void _selectedLayerChanged(SPObject *layer); @@ -53,7 +53,7 @@ private: sigc::connection _resource_connection; GC::soft_ptr _desktop; - SPDocument *_document; + Document *_document; std::vector _watchers; diff --git a/src/livarot/LivarotDefs.h b/src/livarot/LivarotDefs.h index 49f954586..c34559a29 100644 --- a/src/livarot/LivarotDefs.h +++ b/src/livarot/LivarotDefs.h @@ -20,9 +20,9 @@ #ifdef HAVE_INTTYPES_H # include #else -# ifdef HAVE_STDINT_H +//--tullarisc # ifdef HAVE_STDINT_H # include -# endif +//# endif #endif // error codes (mostly obsolete) diff --git a/src/live_effects/effect.h b/src/live_effects/effect.h index 6f195b176..461073c3f 100644 --- a/src/live_effects/effect.h +++ b/src/live_effects/effect.h @@ -23,7 +23,7 @@ #define LPE_CONVERSION_TOLERANCE 0.01 // FIXME: find good solution for this. -struct SPDocument; +struct Document; struct SPDesktop; struct SPItem; class SPNodeContext; @@ -56,8 +56,8 @@ enum LPEPathFlashType { class Effect { public: static Effect* New(EffectType lpenr, LivePathEffectObject *lpeobj); - static void createAndApply(const char* name, SPDocument *doc, SPItem *item); - static void createAndApply(EffectType type, SPDocument *doc, SPItem *item); + static void createAndApply(const char* name, Document *doc, SPItem *item); + static void createAndApply(EffectType type, Document *doc, SPItem *item); virtual ~Effect(); @@ -111,7 +111,7 @@ public: Glib::ustring getName(); Inkscape::XML::Node * getRepr(); - SPDocument * getSPDoc(); + Document * getSPDoc(); LivePathEffectObject * getLPEObj() {return lpeobj;}; Parameter * getParameter(const char * key); diff --git a/src/lpe-tool-context.cpp b/src/lpe-tool-context.cpp index be465e324..5f7cb0277 100644 --- a/src/lpe-tool-context.cpp +++ b/src/lpe-tool-context.cpp @@ -422,7 +422,7 @@ lpetool_context_switch_mode(SPLPEToolContext *lc, Inkscape::LivePathEffect::Effe } void -lpetool_get_limiting_bbox_corners(SPDocument *document, Geom::Point &A, Geom::Point &B) { +lpetool_get_limiting_bbox_corners(Document *document, Geom::Point &A, Geom::Point &B) { Geom::Coord w = sp_document_width(document); Geom::Coord h = sp_document_height(document); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); @@ -452,7 +452,7 @@ lpetool_context_reset_limiting_bbox(SPLPEToolContext *lc) if (!prefs->getBool("/tools/lpetool/show_bbox", true)) return; - SPDocument *document = sp_desktop_document(lc->desktop); + Document *document = sp_desktop_document(lc->desktop); Geom::Point A, B; lpetool_get_limiting_bbox_corners(document, A, B); diff --git a/src/lpe-tool-context.h b/src/lpe-tool-context.h index 8a52ba97c..f710e9321 100644 --- a/src/lpe-tool-context.h +++ b/src/lpe-tool-context.h @@ -67,7 +67,7 @@ int lpetool_mode_to_index(Inkscape::LivePathEffect::EffectType const type); int lpetool_item_has_construction(SPLPEToolContext *lc, SPItem *item); bool lpetool_try_construction(SPLPEToolContext *lc, Inkscape::LivePathEffect::EffectType const type); void lpetool_context_switch_mode(SPLPEToolContext *lc, Inkscape::LivePathEffect::EffectType const type); -void lpetool_get_limiting_bbox_corners(SPDocument *document, Geom::Point &A, Geom::Point &B); +void lpetool_get_limiting_bbox_corners(Document *document, Geom::Point &A, Geom::Point &B); void lpetool_context_reset_limiting_bbox(SPLPEToolContext *lc); void lpetool_create_measuring_items(SPLPEToolContext *lc, Inkscape::Selection *selection = NULL); void lpetool_delete_measuring_items(SPLPEToolContext *lc); diff --git a/src/main-cmdlineact.cpp b/src/main-cmdlineact.cpp index dc59e1a93..6ab192095 100644 --- a/src/main-cmdlineact.cpp +++ b/src/main-cmdlineact.cpp @@ -55,7 +55,7 @@ CmdLineAction::doIt (Inkscape::UI::View::View * view) { SPDesktop * desktop = dynamic_cast(view); if (desktop == NULL) { return; } - SPDocument * doc = view->doc(); + Document * doc = view->doc(); SPObject * obj = doc->getObjectById(_arg); if (obj == NULL) { printf(_("Unable to find node ID: '%s'\n"), _arg); diff --git a/src/main.cpp b/src/main.cpp index 9c33688ed..64fcb664d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -165,13 +165,13 @@ enum { int sp_main_gui(int argc, char const **argv); int sp_main_console(int argc, char const **argv); -static void sp_do_export_png(SPDocument *doc); -static void do_export_ps_pdf(SPDocument* doc, gchar const* uri, char const *mime); +static void sp_do_export_png(Document *doc); +static void do_export_ps_pdf(Document* doc, gchar const* uri, char const *mime); #ifdef WIN32 -static void do_export_emf(SPDocument* doc, gchar const* uri, char const *mime); +static void do_export_emf(Document* doc, gchar const* uri, char const *mime); #endif //WIN32 -static void do_query_dimension (SPDocument *doc, bool extent, Geom::Dim2 const axis, const gchar *id); -static void do_query_all (SPDocument *doc); +static void do_query_dimension (Document *doc, bool extent, Geom::Dim2 const axis, const gchar *id); +static void do_query_all (Document *doc); static void do_query_all_recurse (SPObject *o); static gchar *sp_global_printer = NULL; @@ -962,7 +962,7 @@ void sp_process_file_list(GSList *fl) { while (fl) { const gchar *filename = (gchar *)fl->data; - SPDocument *doc = Inkscape::Extension::open(NULL, filename); + Document *doc = Inkscape::Extension::open(NULL, filename); if (doc == NULL) { doc = Inkscape::Extension::open(Inkscape::Extension::db.get(SP_MODULE_KEY_INPUT_SVG), filename); } @@ -1127,7 +1127,7 @@ int sp_main_console(int argc, char const **argv) } static void -do_query_dimension (SPDocument *doc, bool extent, Geom::Dim2 const axis, const gchar *id) +do_query_dimension (Document *doc, bool extent, Geom::Dim2 const axis, const gchar *id) { SPObject *o = NULL; @@ -1167,7 +1167,7 @@ do_query_dimension (SPDocument *doc, bool extent, Geom::Dim2 const axis, const g } static void -do_query_all (SPDocument *doc) +do_query_all (Document *doc) { SPObject *o = NULL; @@ -1205,7 +1205,7 @@ do_query_all_recurse (SPObject *o) static void -sp_do_export_png(SPDocument *doc) +sp_do_export_png(Document *doc) { const gchar *filename = NULL; gdouble dpi = 0.0; @@ -1417,7 +1417,7 @@ sp_do_export_png(SPDocument *doc) * \param mime MIME type to export as. */ -static void do_export_ps_pdf(SPDocument* doc, gchar const* uri, char const* mime) +static void do_export_ps_pdf(Document* doc, gchar const* uri, char const* mime) { Inkscape::Extension::DB::OutputList o; Inkscape::Extension::db.get_output_list(o); @@ -1507,7 +1507,7 @@ static void do_export_ps_pdf(SPDocument* doc, gchar const* uri, char const* mime * \param mime MIME type to export as (should be "image/x-emf") */ -static void do_export_emf(SPDocument* doc, gchar const* uri, char const* mime) +static void do_export_emf(Document* doc, gchar const* uri, char const* mime) { Inkscape::Extension::DB::OutputList o; Inkscape::Extension::db.get_output_list(o); diff --git a/src/marker.cpp b/src/marker.cpp index c66acc192..2efcde1b9 100644 --- a/src/marker.cpp +++ b/src/marker.cpp @@ -43,7 +43,7 @@ struct SPMarkerView { static void sp_marker_class_init (SPMarkerClass *klass); static void sp_marker_init (SPMarker *marker); -static void sp_marker_build (SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_marker_build (SPObject *object, Document *document, Inkscape::XML::Node *repr); static void sp_marker_release (SPObject *object); static void sp_marker_set (SPObject *object, unsigned int key, const gchar *value); static void sp_marker_update (SPObject *object, SPCtx *ctx, guint flags); @@ -133,7 +133,7 @@ sp_marker_init (SPMarker *marker) * \see sp_object_build() */ static void -sp_marker_build (SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +sp_marker_build (SPObject *object, Document *document, Inkscape::XML::Node *repr) { SPGroup *group; SPMarker *marker; @@ -723,7 +723,7 @@ sp_marker_view_remove (SPMarker *marker, SPMarkerView *view, unsigned int destro } const gchar * -generate_marker (GSList *reprs, Geom::Rect bounds, SPDocument *document, Geom::Matrix /*transform*/, Geom::Matrix move) +generate_marker (GSList *reprs, Geom::Rect bounds, Document *document, Geom::Matrix /*transform*/, Geom::Matrix move) { Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document); Inkscape::XML::Node *defsrepr = SP_OBJECT_REPR (SP_DOCUMENT_DEFS (document)); diff --git a/src/marker.h b/src/marker.h index f2d74a3a6..5206a9c89 100644 --- a/src/marker.h +++ b/src/marker.h @@ -89,7 +89,7 @@ NRArenaItem *sp_marker_show_instance (SPMarker *marker, NRArenaItem *parent, unsigned int key, unsigned int pos, Geom::Matrix const &base, float linewidth); void sp_marker_hide (SPMarker *marker, unsigned int key); -const gchar *generate_marker (GSList *reprs, Geom::Rect bounds, SPDocument *document, Geom::Matrix transform, Geom::Matrix move); +const gchar *generate_marker (GSList *reprs, Geom::Rect bounds, Document *document, Geom::Matrix transform, Geom::Matrix move); #endif diff --git a/src/nodepath.cpp b/src/nodepath.cpp index f9a615583..e2c4f3fa3 100644 --- a/src/nodepath.cpp +++ b/src/nodepath.cpp @@ -2582,7 +2582,7 @@ void sp_node_delete_preserve(GList *nodes_to_delete) //FIXME: a closed path CAN legally have one node, it's only an open one which must be //at least 2 sp_nodepath_get_node_count(nodepath) < 2) { - SPDocument *document = sp_desktop_document (nodepath->desktop); + Document *document = sp_desktop_document (nodepath->desktop); //FIXME: The following line will be wrong when we have mltiple nodepaths: we only want to //delete this nodepath's object, not the entire selection! (though at this time, this //does not matter) @@ -2621,7 +2621,7 @@ void sp_node_selected_delete(Inkscape::NodePath::Path *nodepath) // if the entire nodepath is removed, delete the selected object. if (nodepath->subpaths == NULL || sp_nodepath_get_node_count(nodepath) < 2) { - SPDocument *document = sp_desktop_document (nodepath->desktop); + Document *document = sp_desktop_document (nodepath->desktop); sp_selection_delete(nodepath->desktop); sp_document_done (document, SP_VERB_CONTEXT_NODE, _("Delete nodes")); diff --git a/src/path-chemistry.cpp b/src/path-chemistry.cpp index 99ee78ade..3b5cd3136 100644 --- a/src/path-chemistry.cpp +++ b/src/path-chemistry.cpp @@ -43,7 +43,7 @@ void sp_selected_path_combine(SPDesktop *desktop) { Inkscape::Selection *selection = sp_desktop_selection(desktop); - SPDocument *doc = sp_desktop_document(desktop); + Document *doc = sp_desktop_document(desktop); if (g_slist_length((GSList *) selection->itemList()) < 1) { sp_desktop_message_stack(desktop)->flash(Inkscape::WARNING_MESSAGE, _("Select object(s) to combine.")); @@ -328,7 +328,7 @@ sp_item_list_to_curves(const GSList *items, GSList **selected, GSList **to_selec items = items->next) { SPItem *item = SP_ITEM(items->data); - SPDocument *document = item->document; + Document *document = item->document; if (SP_IS_PATH(item) && !SP_PATH(item)->original_curve) { continue; // already a path, and no path effect diff --git a/src/persp3d.cpp b/src/persp3d.cpp index 916e9f25f..978a8952c 100644 --- a/src/persp3d.cpp +++ b/src/persp3d.cpp @@ -26,7 +26,7 @@ static void persp3d_class_init(Persp3DClass *klass); static void persp3d_init(Persp3D *stop); -static void persp3d_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void persp3d_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); static void persp3d_release(SPObject *object); static void persp3d_set(SPObject *object, unsigned key, gchar const *value); static void persp3d_update(SPObject *object, SPCtx *ctx, guint flags); @@ -103,7 +103,7 @@ persp3d_init(Persp3D *persp) /** * Virtual build: set persp3d attributes from its associated XML node. */ -static void persp3d_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +static void persp3d_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) persp3d_parent_class)->build) (* ((SPObjectClass *) persp3d_parent_class)->build)(object, document, repr); @@ -201,7 +201,7 @@ persp3d_update(SPObject *object, SPCtx *ctx, guint flags) } Persp3D * -persp3d_create_xml_element (SPDocument *document, Persp3D *dup) {// if dup is given, copy the attributes over +persp3d_create_xml_element (Document *document, Persp3D *dup) {// if dup is given, copy the attributes over SPDefs *defs = (SPDefs *) SP_DOCUMENT_DEFS(document); Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document); Inkscape::XML::Node *repr; @@ -240,7 +240,7 @@ persp3d_create_xml_element (SPDocument *document, Persp3D *dup) {// if dup is gi } Persp3D * -persp3d_document_first_persp (SPDocument *document) { +persp3d_document_first_persp (Document *document) { SPDefs *defs = (SPDefs *) SP_DOCUMENT_DEFS(document); Inkscape::XML::Node *repr; for (SPObject *child = sp_object_first_child(defs); child != NULL; child = SP_OBJECT_NEXT(child) ) { @@ -653,7 +653,7 @@ persp3d_print_debugging_info (Persp3D *persp) { } void -persp3d_print_debugging_info_all(SPDocument *document) { +persp3d_print_debugging_info_all(Document *document) { SPDefs *defs = (SPDefs *) SP_DOCUMENT_DEFS(document); Inkscape::XML::Node *repr; for (SPObject *child = sp_object_first_child(defs); child != NULL; child = SP_OBJECT_NEXT(child) ) { diff --git a/src/persp3d.h b/src/persp3d.h index 79bec0232..cbad0b873 100644 --- a/src/persp3d.h +++ b/src/persp3d.h @@ -35,7 +35,7 @@ struct Persp3D : public SPObject { // Also write the list of boxes into the xml repr and vice versa link boxes to their persp3d? std::vector boxes; std::map* boxes_transformed; // TODO: eventually we should merge this with 'boxes' - SPDocument *document; // should this rather be the SPDesktop? + Document *document; // should this rather be the SPDesktop? // for debugging only int my_counter; @@ -89,15 +89,15 @@ std::list persp3d_list_of_boxes(Persp3D *persp); bool persp3d_perspectives_coincide(const Persp3D *lhs, const Persp3D *rhs); void persp3d_absorb(Persp3D *persp1, Persp3D *persp2); -Persp3D * persp3d_create_xml_element (SPDocument *document, Persp3D *dup = NULL); -Persp3D * persp3d_document_first_persp (SPDocument *document); +Persp3D * persp3d_create_xml_element (Document *document, Persp3D *dup = NULL); +Persp3D * persp3d_document_first_persp (Document *document); bool persp3d_has_all_boxes_in_selection (Persp3D *persp); std::map > persp3d_unselected_boxes(Inkscape::Selection *selection); void persp3d_split_perspectives_according_to_selection(Inkscape::Selection *selection); void persp3d_print_debugging_info (Persp3D *persp); -void persp3d_print_debugging_info_all(SPDocument *doc); +void persp3d_print_debugging_info_all(Document *doc); void persp3d_print_all_selected(); #endif /* __PERSP3D_H__ */ diff --git a/src/print.cpp b/src/print.cpp index 044dffe34..7fbaa53e9 100644 --- a/src/print.cpp +++ b/src/print.cpp @@ -85,7 +85,7 @@ unsigned int sp_print_text(SPPrintContext *ctx, char const *text, Geom::Point p, /* UI */ void -sp_print_preview_document(SPDocument *doc) +sp_print_preview_document(Document *doc) { Inkscape::Extension::Print *mod; unsigned int ret; @@ -122,7 +122,7 @@ sp_print_preview_document(SPDocument *doc) } void -sp_print_document(Gtk::Window& parentWindow, SPDocument *doc) +sp_print_document(Gtk::Window& parentWindow, Document *doc) { sp_document_ensure_up_to_date(doc); @@ -143,7 +143,7 @@ sp_print_document(Gtk::Window& parentWindow, SPDocument *doc) } void -sp_print_document_to_file(SPDocument *doc, gchar const *filename) +sp_print_document_to_file(Document *doc, gchar const *filename) { Inkscape::Extension::Print *mod; SPPrintContext context; diff --git a/src/print.h b/src/print.h index 577a169cf..11efced7b 100644 --- a/src/print.h +++ b/src/print.h @@ -41,9 +41,9 @@ void sp_print_get_param(SPPrintContext *ctx, gchar *name, bool *value); /* UI */ -void sp_print_preview_document(SPDocument *doc); -void sp_print_document(Gtk::Window& parentWindow, SPDocument *doc); -void sp_print_document_to_file(SPDocument *doc, gchar const *filename); +void sp_print_preview_document(Document *doc); +void sp_print_document(Gtk::Window& parentWindow, Document *doc); +void sp_print_document_to_file(Document *doc, gchar const *filename); #endif /* !PRINT_H_INKSCAPE */ diff --git a/src/profile-manager.cpp b/src/profile-manager.cpp index 1cd965e39..75fd12e4b 100644 --- a/src/profile-manager.cpp +++ b/src/profile-manager.cpp @@ -14,7 +14,7 @@ namespace Inkscape { -ProfileManager::ProfileManager(SPDocument *document) : +ProfileManager::ProfileManager(Document *document) : _doc(document), _knownProfiles() { diff --git a/src/profile-manager.h b/src/profile-manager.h index 61e22615f..d72ad3dd8 100644 --- a/src/profile-manager.h +++ b/src/profile-manager.h @@ -13,7 +13,7 @@ #include "gc-finalized.h" #include -class SPDocument; +class Document; namespace Inkscape { @@ -23,7 +23,7 @@ class ProfileManager : public DocumentSubset, public GC::Finalized { public: - ProfileManager(SPDocument *document); + ProfileManager(Document *document); ~ProfileManager(); ColorProfile* find(gchar const* name); @@ -34,7 +34,7 @@ private: void _resourcesChanged(); - SPDocument* _doc; + Document* _doc; sigc::connection _resource_connection; std::vector _knownProfiles; }; diff --git a/src/rdf.cpp b/src/rdf.cpp index f0b174922..5559526f1 100644 --- a/src/rdf.cpp +++ b/src/rdf.cpp @@ -531,7 +531,7 @@ rdf_set_repr_text ( Inkscape::XML::Node * repr, // set document's title element to the RDF title if (!strcmp(entity->name, "title")) { - SPDocument *doc = SP_ACTIVE_DOCUMENT; + Document *doc = SP_ACTIVE_DOCUMENT; if(doc && doc->root) doc->root->setTitle(text); } @@ -644,7 +644,7 @@ rdf_set_repr_text ( Inkscape::XML::Node * repr, } Inkscape::XML::Node * -rdf_get_rdf_root_repr ( SPDocument * doc, bool build ) +rdf_get_rdf_root_repr ( Document * doc, bool build ) { g_return_val_if_fail (doc != NULL, NULL); g_return_val_if_fail (doc->rroot != NULL, NULL); @@ -705,7 +705,7 @@ rdf_get_rdf_root_repr ( SPDocument * doc, bool build ) } Inkscape::XML::Node * -rdf_get_xml_repr( SPDocument * doc, gchar const * name, bool build ) +rdf_get_xml_repr( Document * doc, gchar const * name, bool build ) { g_return_val_if_fail (name != NULL, NULL); g_return_val_if_fail (doc != NULL, NULL); @@ -735,7 +735,7 @@ rdf_get_xml_repr( SPDocument * doc, gchar const * name, bool build ) } Inkscape::XML::Node * -rdf_get_work_repr( SPDocument * doc, gchar const * name, bool build ) +rdf_get_work_repr( Document * doc, gchar const * name, bool build ) { g_return_val_if_fail (name != NULL, NULL); g_return_val_if_fail (doc != NULL, NULL); @@ -771,7 +771,7 @@ rdf_get_work_repr( SPDocument * doc, gchar const * name, bool build ) * */ const gchar * -rdf_get_work_entity(SPDocument * doc, struct rdf_work_entity_t * entity) +rdf_get_work_entity(Document * doc, struct rdf_work_entity_t * entity) { g_return_val_if_fail (doc != NULL, NULL); if ( entity == NULL ) return NULL; @@ -802,7 +802,7 @@ rdf_get_work_entity(SPDocument * doc, struct rdf_work_entity_t * entity) * */ unsigned int -rdf_set_work_entity(SPDocument * doc, struct rdf_work_entity_t * entity, +rdf_set_work_entity(Document * doc, struct rdf_work_entity_t * entity, const gchar * text) { g_return_val_if_fail ( entity != NULL, 0 ); @@ -918,7 +918,7 @@ rdf_match_license(Inkscape::XML::Node const *repr, struct rdf_license_t const *l * */ struct rdf_license_t * -rdf_get_license(SPDocument * document) +rdf_get_license(Document * document) { Inkscape::XML::Node const *repr = rdf_get_xml_repr ( document, XML_TAG_NAME_LICENSE, FALSE ); if (repr) { @@ -942,7 +942,7 @@ rdf_get_license(SPDocument * document) * */ void -rdf_set_license(SPDocument * doc, struct rdf_license_t const * license) +rdf_set_license(Document * doc, struct rdf_license_t const * license) { // drop old license section Inkscape::XML::Node * repr = rdf_get_xml_repr ( doc, XML_TAG_NAME_LICENSE, FALSE ); @@ -981,7 +981,7 @@ struct rdf_entity_default_t rdf_defaults[] = { }; void -rdf_set_defaults ( SPDocument * doc ) +rdf_set_defaults ( Document * doc ) { g_assert ( doc != NULL ); diff --git a/src/rdf.h b/src/rdf.h index a98f5a1e4..57ae79cb8 100644 --- a/src/rdf.h +++ b/src/rdf.h @@ -94,17 +94,17 @@ struct rdf_t { struct rdf_work_entity_t * rdf_find_entity(gchar const * name); -const gchar * rdf_get_work_entity(SPDocument * doc, +const gchar * rdf_get_work_entity(Document * doc, struct rdf_work_entity_t * entity); -unsigned int rdf_set_work_entity(SPDocument * doc, +unsigned int rdf_set_work_entity(Document * doc, struct rdf_work_entity_t * entity, const gchar * text); -struct rdf_license_t * rdf_get_license(SPDocument * doc); -void rdf_set_license(SPDocument * doc, +struct rdf_license_t * rdf_get_license(Document * doc); +void rdf_set_license(Document * doc, struct rdf_license_t const * license); -void rdf_set_defaults ( SPDocument * doc ); +void rdf_set_defaults ( Document * doc ); #endif // _RDF_H_ diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index e55bba2a5..0e2fe43d1 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -139,7 +139,7 @@ void sp_selection_copy_impl(GSList const *items, GSList **clip, Inkscape::XML::D g_slist_free((GSList *) sorted_items); } -GSList *sp_selection_paste_impl(SPDocument *doc, SPObject *parent, GSList **clip) +GSList *sp_selection_paste_impl(Document *doc, SPObject *parent, GSList **clip) { Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc); @@ -240,7 +240,7 @@ void sp_selection_duplicate(SPDesktop *desktop, bool suppressDone) if (desktop == NULL) return; - SPDocument *doc = desktop->doc(); + Document *doc = desktop->doc(); Inkscape::XML::Document* xml_doc = sp_document_repr_doc(doc); Inkscape::Selection *selection = sp_desktop_selection(desktop); @@ -326,7 +326,7 @@ void sp_edit_clear_all(SPDesktop *dt) if (!dt) return; - SPDocument *doc = sp_desktop_document(dt); + Document *doc = sp_desktop_document(dt); sp_desktop_selection(dt)->clear(); g_return_if_fail(SP_IS_GROUP(dt->currentLayer())); @@ -454,7 +454,7 @@ void sp_selection_group(SPDesktop *desktop) if (desktop == NULL) return; - SPDocument *doc = sp_desktop_document(desktop); + Document *doc = sp_desktop_document(desktop); Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc); Inkscape::Selection *selection = sp_desktop_selection(desktop); @@ -741,7 +741,7 @@ void sp_selection_raise_to_top(SPDesktop *desktop) if (desktop == NULL) return; - SPDocument *document = sp_desktop_document(desktop); + Document *document = sp_desktop_document(desktop); Inkscape::Selection *selection = sp_desktop_selection(desktop); if (selection->isEmpty()) { @@ -839,7 +839,7 @@ void sp_selection_lower_to_bottom(SPDesktop *desktop) if (desktop == NULL) return; - SPDocument *document = sp_desktop_document(desktop); + Document *document = sp_desktop_document(desktop); Inkscape::Selection *selection = sp_desktop_selection(desktop); if (selection->isEmpty()) { @@ -882,14 +882,14 @@ void sp_selection_lower_to_bottom(SPDesktop *desktop) } void -sp_undo(SPDesktop *desktop, SPDocument *) +sp_undo(SPDesktop *desktop, Document *) { if (!sp_document_undo(sp_desktop_document(desktop))) desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Nothing to undo.")); } void -sp_redo(SPDesktop *desktop, SPDocument *) +sp_redo(SPDesktop *desktop, Document *) { if (!sp_document_redo(sp_desktop_document(desktop))) desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Nothing to redo.")); @@ -1672,7 +1672,7 @@ sp_selection_item_next(SPDesktop *desktop) void sp_selection_item_prev(SPDesktop *desktop) { - SPDocument *document = sp_desktop_document(desktop); + Document *document = sp_desktop_document(desktop); g_return_if_fail(document != NULL); g_return_if_fail(desktop != NULL); Inkscape::Selection *selection = sp_desktop_selection(desktop); @@ -2114,7 +2114,7 @@ void sp_selection_to_marker(SPDesktop *desktop, bool apply) if (desktop == NULL) return; - SPDocument *doc = sp_desktop_document(desktop); + Document *doc = sp_desktop_document(desktop); Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc); Inkscape::Selection *selection = sp_desktop_selection(desktop); @@ -2211,7 +2211,7 @@ void sp_selection_to_guides(SPDesktop *desktop) if (desktop == NULL) return; - SPDocument *doc = sp_desktop_document(desktop); + Document *doc = sp_desktop_document(desktop); Inkscape::Selection *selection = sp_desktop_selection(desktop); // we need to copy the list because it gets reset when objects are deleted GSList *items = g_slist_copy((GSList *) selection->itemList()); @@ -2238,7 +2238,7 @@ sp_selection_tile(SPDesktop *desktop, bool apply) if (desktop == NULL) return; - SPDocument *doc = sp_desktop_document(desktop); + Document *doc = sp_desktop_document(desktop); Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc); Inkscape::Selection *selection = sp_desktop_selection(desktop); @@ -2342,7 +2342,7 @@ sp_selection_untile(SPDesktop *desktop) if (desktop == NULL) return; - SPDocument *doc = sp_desktop_document(desktop); + Document *doc = sp_desktop_document(desktop); Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc); Inkscape::Selection *selection = sp_desktop_selection(desktop); @@ -2457,7 +2457,7 @@ sp_selection_get_export_hints(Inkscape::Selection *selection, char const **filen } void -sp_document_get_export_hints(SPDocument *doc, char const **filename, float *xdpi, float *ydpi) +sp_document_get_export_hints(Document *doc, char const **filename, float *xdpi, float *ydpi) { Inkscape::XML::Node * repr = sp_document_repr_root(doc); gchar const *dpi_string; @@ -2483,7 +2483,7 @@ sp_selection_create_bitmap_copy(SPDesktop *desktop) if (desktop == NULL) return; - SPDocument *document = sp_desktop_document(desktop); + Document *document = sp_desktop_document(desktop); Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document); Inkscape::Selection *selection = sp_desktop_selection(desktop); @@ -2697,7 +2697,7 @@ sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_to_la if (desktop == NULL) return; - SPDocument *doc = sp_desktop_document(desktop); + Document *doc = sp_desktop_document(desktop); Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc); Inkscape::Selection *selection = sp_desktop_selection(desktop); @@ -2824,7 +2824,7 @@ void sp_selection_unset_mask(SPDesktop *desktop, bool apply_clip_path) { if (desktop == NULL) return; - SPDocument *doc = sp_desktop_document(desktop); + Document *doc = sp_desktop_document(desktop); Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc); Inkscape::Selection *selection = sp_desktop_selection(desktop); @@ -2915,7 +2915,7 @@ bool fit_canvas_to_selection(SPDesktop *desktop) { g_return_val_if_fail(desktop != NULL, false); - SPDocument *doc = sp_desktop_document(desktop); + Document *doc = sp_desktop_document(desktop); g_return_val_if_fail(doc != NULL, false); g_return_val_if_fail(desktop->selection != NULL, false); @@ -2946,7 +2946,7 @@ verb_fit_canvas_to_selection(SPDesktop *const desktop) } bool -fit_canvas_to_drawing(SPDocument *doc) +fit_canvas_to_drawing(Document *doc) { g_return_val_if_fail(doc != NULL, false); @@ -2972,7 +2972,7 @@ verb_fit_canvas_to_drawing(SPDesktop *desktop) void fit_canvas_to_selection_or_drawing(SPDesktop *desktop) { g_return_if_fail(desktop != NULL); - SPDocument *doc = sp_desktop_document(desktop); + Document *doc = sp_desktop_document(desktop); g_return_if_fail(doc != NULL); g_return_if_fail(desktop->selection != NULL); diff --git a/src/selection-chemistry.h b/src/selection-chemistry.h index 67e772a00..4a8c8901e 100644 --- a/src/selection-chemistry.h +++ b/src/selection-chemistry.h @@ -104,11 +104,11 @@ void sp_selection_edit_clip_or_mask(SPDesktop * dt, bool clip); void scroll_to_show_item(SPDesktop *desktop, SPItem *item); -void sp_undo (SPDesktop *desktop, SPDocument *doc); -void sp_redo (SPDesktop *desktop, SPDocument *doc); +void sp_undo (SPDesktop *desktop, Document *doc); +void sp_redo (SPDesktop *desktop, Document *doc); void sp_selection_get_export_hints (Inkscape::Selection *selection, const char **filename, float *xdpi, float *ydpi); -void sp_document_get_export_hints (SPDocument * doc, const char **filename, float *xdpi, float *ydpi); +void sp_document_get_export_hints (Document * doc, const char **filename, float *xdpi, float *ydpi); void sp_selection_create_bitmap_copy (SPDesktop *desktop); @@ -117,7 +117,7 @@ void sp_selection_unset_mask(SPDesktop *desktop, bool apply_clip_path); bool fit_canvas_to_selection(SPDesktop *); void verb_fit_canvas_to_selection(SPDesktop *); -bool fit_canvas_to_drawing(SPDocument *); +bool fit_canvas_to_drawing(Document *); void verb_fit_canvas_to_drawing(SPDesktop *); void fit_canvas_to_selection_or_drawing(SPDesktop *); diff --git a/src/snap.cpp b/src/snap.cpp index f0769e0a1..48f3a8fea 100644 --- a/src/snap.cpp +++ b/src/snap.cpp @@ -1092,7 +1092,7 @@ void SnapManager::setup(SPDesktop const *desktop, _guide_to_ignore = guide_to_ignore; } -SPDocument *SnapManager::getDocument() const +Document *SnapManager::getDocument() const { return _named_view->document; } diff --git a/src/snap.h b/src/snap.h index e621bdb60..18820f78e 100644 --- a/src/snap.h +++ b/src/snap.h @@ -162,7 +162,7 @@ public: SPDesktop const *getDesktop() const {return _desktop;} SPNamedView const *getNamedView() const {return _named_view;} - SPDocument *getDocument() const; + Document *getDocument() const; SPGuide const *getGuideToIgnore() const {return _guide_to_ignore;} bool getSnapIndicator() const {return _snapindicator;} diff --git a/src/sp-anchor.cpp b/src/sp-anchor.cpp index aabefdfdb..ec1b4e53f 100644 --- a/src/sp-anchor.cpp +++ b/src/sp-anchor.cpp @@ -29,7 +29,7 @@ static void sp_anchor_class_init(SPAnchorClass *ac); static void sp_anchor_init(SPAnchor *anchor); -static void sp_anchor_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_anchor_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); static void sp_anchor_release(SPObject *object); static void sp_anchor_set(SPObject *object, unsigned int key, const gchar *value); static Inkscape::XML::Node *sp_anchor_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); @@ -83,7 +83,7 @@ static void sp_anchor_init(SPAnchor *anchor) anchor->href = NULL; } -static void sp_anchor_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +static void sp_anchor_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) (parent_class))->build) { ((SPObjectClass *) (parent_class))->build(object, document, repr); diff --git a/src/sp-animation.cpp b/src/sp-animation.cpp index 2d9f2e941..b5f0e8605 100644 --- a/src/sp-animation.cpp +++ b/src/sp-animation.cpp @@ -37,7 +37,7 @@ log_set_attr(char const *const classname, unsigned int const key, char const *co static void sp_animation_class_init(SPAnimationClass *klass); static void sp_animation_init(SPAnimation *animation); -static void sp_animation_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_animation_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); static void sp_animation_release(SPObject *object); static void sp_animation_set(SPObject *object, unsigned int key, gchar const *value); @@ -84,7 +84,7 @@ sp_animation_init(SPAnimation */*animation*/) static void -sp_animation_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +sp_animation_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) animation_parent_class)->build) ((SPObjectClass *) animation_parent_class)->build(object, document, repr); @@ -124,7 +124,7 @@ sp_animation_set(SPObject *object, unsigned int key, gchar const *value) static void sp_ianimation_class_init(SPIAnimationClass *klass); static void sp_ianimation_init(SPIAnimation *animation); -static void sp_ianimation_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_ianimation_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); static void sp_ianimation_release(SPObject *object); static void sp_ianimation_set(SPObject *object, unsigned int key, gchar const *value); @@ -171,7 +171,7 @@ sp_ianimation_init(SPIAnimation */*animation*/) static void -sp_ianimation_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +sp_ianimation_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) ianimation_parent_class)->build) ((SPObjectClass *) ianimation_parent_class)->build(object, document, repr); @@ -208,7 +208,7 @@ sp_ianimation_set(SPObject *object, unsigned int key, gchar const *value) static void sp_animate_class_init(SPAnimateClass *klass); static void sp_animate_init(SPAnimate *animate); -static void sp_animate_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_animate_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); static void sp_animate_release(SPObject *object); static void sp_animate_set(SPObject *object, unsigned int key, gchar const *value); @@ -255,7 +255,7 @@ sp_animate_init(SPAnimate */*animate*/) static void -sp_animate_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +sp_animate_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) animate_parent_class)->build) ((SPObjectClass *) animate_parent_class)->build(object, document, repr); diff --git a/src/sp-clippath.cpp b/src/sp-clippath.cpp index 4bbabc965..1dab31e34 100644 --- a/src/sp-clippath.cpp +++ b/src/sp-clippath.cpp @@ -40,7 +40,7 @@ struct SPClipPathView { static void sp_clippath_class_init(SPClipPathClass *klass); static void sp_clippath_init(SPClipPath *clippath); -static void sp_clippath_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_clippath_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); static void sp_clippath_release(SPObject * object); static void sp_clippath_set(SPObject *object, unsigned int key, gchar const *value); static void sp_clippath_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref); @@ -99,7 +99,7 @@ sp_clippath_init(SPClipPath *cp) } static void -sp_clippath_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +sp_clippath_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) parent_class)->build) ((SPObjectClass *) parent_class)->build(object, document, repr); @@ -381,7 +381,7 @@ sp_clippath_view_list_remove(SPClipPathView *list, SPClipPathView *view) // Create a mask element (using passed elements), add it to const gchar * -sp_clippath_create (GSList *reprs, SPDocument *document, Geom::Matrix const* applyTransform) +sp_clippath_create (GSList *reprs, Document *document, Geom::Matrix const* applyTransform) { Inkscape::XML::Node *defsrepr = SP_OBJECT_REPR (SP_DOCUMENT_DEFS (document)); diff --git a/src/sp-clippath.h b/src/sp-clippath.h index 199b29f3b..d6a4e6f0b 100644 --- a/src/sp-clippath.h +++ b/src/sp-clippath.h @@ -59,6 +59,6 @@ void sp_clippath_hide(SPClipPath *cp, unsigned int key); void sp_clippath_set_bbox(SPClipPath *cp, unsigned int key, NRRect *bbox); void sp_clippath_get_bbox(SPClipPath *cp, NRRect *bbox, Geom::Matrix const &transform, unsigned const flags); -const gchar *sp_clippath_create (GSList *reprs, SPDocument *document, Geom::Matrix const* applyTransform); +const gchar *sp_clippath_create (GSList *reprs, Document *document, Geom::Matrix const* applyTransform); #endif diff --git a/src/sp-ellipse.cpp b/src/sp-ellipse.cpp index ff2e39044..2847d23e9 100644 --- a/src/sp-ellipse.cpp +++ b/src/sp-ellipse.cpp @@ -366,7 +366,7 @@ static Inkscape::XML::Node *sp_genericellipse_write(SPObject *object, Inkscape:: static void sp_ellipse_class_init(SPEllipseClass *klass); static void sp_ellipse_init(SPEllipse *ellipse); -static void sp_ellipse_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_ellipse_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); static Inkscape::XML::Node *sp_ellipse_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void sp_ellipse_set(SPObject *object, unsigned int key, gchar const *value); static gchar *sp_ellipse_description(SPItem *item); @@ -416,7 +416,7 @@ sp_ellipse_init(SPEllipse */*ellipse*/) } static void -sp_ellipse_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +sp_ellipse_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) ellipse_parent_class)->build) (* ((SPObjectClass *) ellipse_parent_class)->build) (object, document, repr); @@ -513,7 +513,7 @@ sp_ellipse_position_set(SPEllipse *ellipse, gdouble x, gdouble y, gdouble rx, gd static void sp_circle_class_init(SPCircleClass *klass); static void sp_circle_init(SPCircle *circle); -static void sp_circle_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_circle_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); static Inkscape::XML::Node *sp_circle_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void sp_circle_set(SPObject *object, unsigned int key, gchar const *value); static gchar *sp_circle_description(SPItem *item); @@ -564,7 +564,7 @@ sp_circle_init(SPCircle */*circle*/) } static void -sp_circle_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +sp_circle_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) circle_parent_class)->build) (* ((SPObjectClass *) circle_parent_class)->build)(object, document, repr); @@ -635,7 +635,7 @@ static gchar *sp_circle_description(SPItem */*item*/) static void sp_arc_class_init(SPArcClass *klass); static void sp_arc_init(SPArc *arc); -static void sp_arc_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_arc_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); static Inkscape::XML::Node *sp_arc_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void sp_arc_set(SPObject *object, unsigned int key, gchar const *value); static void sp_arc_modified(SPObject *object, guint flags); @@ -689,7 +689,7 @@ sp_arc_init(SPArc */*arc*/) } static void -sp_arc_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +sp_arc_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) arc_parent_class)->build) (* ((SPObjectClass *) arc_parent_class)->build) (object, document, repr); diff --git a/src/sp-filter-primitive.cpp b/src/sp-filter-primitive.cpp index 77325c4b1..e090a27b2 100644 --- a/src/sp-filter-primitive.cpp +++ b/src/sp-filter-primitive.cpp @@ -32,7 +32,7 @@ static void sp_filter_primitive_class_init(SPFilterPrimitiveClass *klass); static void sp_filter_primitive_init(SPFilterPrimitive *filter_primitive); -static void sp_filter_primitive_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_filter_primitive_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); static void sp_filter_primitive_release(SPObject *object); static void sp_filter_primitive_set(SPObject *object, unsigned int key, gchar const *value); static void sp_filter_primitive_update(SPObject *object, SPCtx *ctx, guint flags); @@ -93,7 +93,7 @@ sp_filter_primitive_init(SPFilterPrimitive *filter_primitive) * sp-object-repr.cpp's repr_name_entries array. */ static void -sp_filter_primitive_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +sp_filter_primitive_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) filter_primitive_parent_class)->build) { ((SPObjectClass *) filter_primitive_parent_class)->build(object, document, repr); diff --git a/src/sp-filter-reference.h b/src/sp-filter-reference.h index 216ff1d6f..31ef5ef11 100644 --- a/src/sp-filter-reference.h +++ b/src/sp-filter-reference.h @@ -8,7 +8,7 @@ class SPObject; class SPFilterReference : public Inkscape::URIReference { public: SPFilterReference(SPObject *obj) : URIReference(obj) {} - SPFilterReference(SPDocument *doc) : URIReference(doc) {} + SPFilterReference(Document *doc) : URIReference(doc) {} SPFilter *getObject() const { return (SPFilter *)URIReference::getObject(); diff --git a/src/sp-filter.cpp b/src/sp-filter.cpp index 7197c1ec9..7c819af1f 100644 --- a/src/sp-filter.cpp +++ b/src/sp-filter.cpp @@ -43,7 +43,7 @@ using std::pair; static void sp_filter_class_init(SPFilterClass *klass); static void sp_filter_init(SPFilter *filter); -static void sp_filter_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_filter_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); static void sp_filter_release(SPObject *object); static void sp_filter_set(SPObject *object, unsigned int key, gchar const *value); static void sp_filter_update(SPObject *object, SPCtx *ctx, guint flags); @@ -129,7 +129,7 @@ sp_filter_init(SPFilter *filter) * sp-object-repr.cpp's repr_name_entries array. */ static void -sp_filter_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +sp_filter_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) filter_parent_class)->build) { ((SPObjectClass *) filter_parent_class)->build(object, document, repr); diff --git a/src/sp-flowdiv.cpp b/src/sp-flowdiv.cpp index 6d679701f..78aab7cb3 100644 --- a/src/sp-flowdiv.cpp +++ b/src/sp-flowdiv.cpp @@ -23,7 +23,7 @@ static void sp_flowdiv_release (SPObject *object); static Inkscape::XML::Node *sp_flowdiv_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void sp_flowdiv_update (SPObject *object, SPCtx *ctx, unsigned int flags); static void sp_flowdiv_modified (SPObject *object, guint flags); -static void sp_flowdiv_build (SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr); +static void sp_flowdiv_build (SPObject *object, Document *doc, Inkscape::XML::Node *repr); static void sp_flowdiv_set (SPObject *object, unsigned int key, const gchar *value); static void sp_flowtspan_class_init (SPFlowtspanClass *klass); @@ -32,7 +32,7 @@ static void sp_flowtspan_release (SPObject *object); static Inkscape::XML::Node *sp_flowtspan_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void sp_flowtspan_update (SPObject *object, SPCtx *ctx, unsigned int flags); static void sp_flowtspan_modified (SPObject *object, guint flags); -static void sp_flowtspan_build (SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr); +static void sp_flowtspan_build (SPObject *object, Document *doc, Inkscape::XML::Node *repr); static void sp_flowtspan_set (SPObject *object, unsigned int key, const gchar *value); static void sp_flowpara_class_init (SPFlowparaClass *klass); @@ -41,7 +41,7 @@ static void sp_flowpara_release (SPObject *object); static Inkscape::XML::Node *sp_flowpara_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void sp_flowpara_update (SPObject *object, SPCtx *ctx, unsigned int flags); static void sp_flowpara_modified (SPObject *object, guint flags); -static void sp_flowpara_build (SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr); +static void sp_flowpara_build (SPObject *object, Document *doc, Inkscape::XML::Node *repr); static void sp_flowpara_set (SPObject *object, unsigned int key, const gchar *value); static void sp_flowline_class_init (SPFlowlineClass *klass); @@ -177,7 +177,7 @@ sp_flowdiv_modified (SPObject *object, guint flags) } static void -sp_flowdiv_build (SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr) +sp_flowdiv_build (SPObject *object, Document *doc, Inkscape::XML::Node *repr) { object->_requireSVGVersion(Inkscape::Version(1, 2)); @@ -354,7 +354,7 @@ sp_flowtspan_modified (SPObject *object, guint flags) } } static void -sp_flowtspan_build (SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr) +sp_flowtspan_build (SPObject *object, Document *doc, Inkscape::XML::Node *repr) { if (((SPObjectClass *) flowtspan_parent_class)->build) ((SPObjectClass *) flowtspan_parent_class)->build (object, doc, repr); @@ -525,7 +525,7 @@ sp_flowpara_modified (SPObject *object, guint flags) } } static void -sp_flowpara_build (SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr) +sp_flowpara_build (SPObject *object, Document *doc, Inkscape::XML::Node *repr) { if (((SPObjectClass *) flowpara_parent_class)->build) ((SPObjectClass *) flowpara_parent_class)->build (object, doc, repr); diff --git a/src/sp-flowtext.cpp b/src/sp-flowtext.cpp index 6af2f7169..ff4a2fda5 100644 --- a/src/sp-flowtext.cpp +++ b/src/sp-flowtext.cpp @@ -43,7 +43,7 @@ static void sp_flowtext_remove_child(SPObject *object, Inkscape::XML::Node *chil static void sp_flowtext_update(SPObject *object, SPCtx *ctx, guint flags); static void sp_flowtext_modified(SPObject *object, guint flags); static Inkscape::XML::Node *sp_flowtext_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); -static void sp_flowtext_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_flowtext_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); static void sp_flowtext_set(SPObject *object, unsigned key, gchar const *value); static void sp_flowtext_bbox(SPItem const *item, NRRect *bbox, Geom::Matrix const &transform, unsigned const flags); @@ -220,7 +220,7 @@ sp_flowtext_modified(SPObject *object, guint flags) } static void -sp_flowtext_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +sp_flowtext_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { object->_requireSVGVersion(Inkscape::Version(1, 2)); @@ -677,7 +677,7 @@ bool SPFlowtext::has_internal_frame() SPItem *create_flowtext_with_internal_frame (SPDesktop *desktop, Geom::Point p0, Geom::Point p1) { - SPDocument *doc = sp_desktop_document (desktop); + Document *doc = sp_desktop_document (desktop); Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc); Inkscape::XML::Node *root_repr = xml_doc->createElement("svg:flowRoot"); diff --git a/src/sp-font-face.cpp b/src/sp-font-face.cpp index 1ec6f4601..166262bc9 100644 --- a/src/sp-font-face.cpp +++ b/src/sp-font-face.cpp @@ -295,7 +295,7 @@ static std::vector sp_read_fontFaceStretchType(gchar const static void sp_fontface_class_init(SPFontFaceClass *fc); static void sp_fontface_init(SPFontFace *font); -static void sp_fontface_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_fontface_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); static void sp_fontface_release(SPObject *object); static void sp_fontface_set(SPObject *object, unsigned int key, const gchar *value); static Inkscape::XML::Node *sp_fontface_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); @@ -398,7 +398,7 @@ static void sp_fontface_init(SPFontFace *face) */ } -static void sp_fontface_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +static void sp_fontface_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) (parent_class))->build) { ((SPObjectClass *) (parent_class))->build(object, document, repr); diff --git a/src/sp-font.cpp b/src/sp-font.cpp index 75fb18638..c960d0fe9 100644 --- a/src/sp-font.cpp +++ b/src/sp-font.cpp @@ -28,7 +28,7 @@ static void sp_font_class_init(SPFontClass *fc); static void sp_font_init(SPFont *font); -static void sp_font_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_font_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); static void sp_font_release(SPObject *object); static void sp_font_set(SPObject *object, unsigned int key, const gchar *value); static Inkscape::XML::Node *sp_font_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); @@ -90,7 +90,7 @@ static void sp_font_init(SPFont *font) font->vert_adv_y = 0; } -static void sp_font_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +static void sp_font_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) (parent_class))->build) { ((SPObjectClass *) (parent_class))->build(object, document, repr); diff --git a/src/sp-gaussian-blur.cpp b/src/sp-gaussian-blur.cpp index e6eab5032..8544e03fe 100644 --- a/src/sp-gaussian-blur.cpp +++ b/src/sp-gaussian-blur.cpp @@ -36,7 +36,7 @@ static void sp_gaussianBlur_class_init(SPGaussianBlurClass *klass); static void sp_gaussianBlur_init(SPGaussianBlur *gaussianBlur); -static void sp_gaussianBlur_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_gaussianBlur_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); static void sp_gaussianBlur_release(SPObject *object); static void sp_gaussianBlur_set(SPObject *object, unsigned int key, gchar const *value); static void sp_gaussianBlur_update(SPObject *object, SPCtx *ctx, guint flags); @@ -94,7 +94,7 @@ sp_gaussianBlur_init(SPGaussianBlur */*gaussianBlur*/) * sp-object-repr.cpp's repr_name_entries array. */ static void -sp_gaussianBlur_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +sp_gaussianBlur_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) gaussianBlur_parent_class)->build) { ((SPObjectClass *) gaussianBlur_parent_class)->build(object, document, repr); diff --git a/src/sp-glyph-kerning.cpp b/src/sp-glyph-kerning.cpp index 6d08f212c..7b61f1c3d 100644 --- a/src/sp-glyph-kerning.cpp +++ b/src/sp-glyph-kerning.cpp @@ -28,7 +28,7 @@ static void sp_glyph_kerning_class_init(SPGlyphKerningClass *gc); static void sp_glyph_kerning_init(SPGlyphKerning *glyph); -static void sp_glyph_kerning_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_glyph_kerning_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); static void sp_glyph_kerning_release(SPObject *object); static void sp_glyph_kerning_set(SPObject *object, unsigned int key, const gchar *value); static Inkscape::XML::Node *sp_glyph_kerning_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); @@ -105,7 +105,7 @@ static void sp_glyph_kerning_init(SPGlyphKerning *glyph) glyph->k = 0; } -static void sp_glyph_kerning_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +static void sp_glyph_kerning_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) (parent_class))->build) { ((SPObjectClass *) (parent_class))->build(object, document, repr); diff --git a/src/sp-glyph.cpp b/src/sp-glyph.cpp index 8af78a0aa..6102954f2 100644 --- a/src/sp-glyph.cpp +++ b/src/sp-glyph.cpp @@ -25,7 +25,7 @@ static void sp_glyph_class_init(SPGlyphClass *gc); static void sp_glyph_init(SPGlyph *glyph); -static void sp_glyph_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_glyph_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); static void sp_glyph_release(SPObject *object); static void sp_glyph_set(SPObject *object, unsigned int key, const gchar *value); static Inkscape::XML::Node *sp_glyph_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); @@ -85,7 +85,7 @@ static void sp_glyph_init(SPGlyph *glyph) glyph->vert_adv_y = 0; } -static void sp_glyph_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +static void sp_glyph_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) (parent_class))->build) { ((SPObjectClass *) (parent_class))->build(object, document, repr); diff --git a/src/sp-gradient-test.h b/src/sp-gradient-test.h index bc188401b..1771b7c3e 100644 --- a/src/sp-gradient-test.h +++ b/src/sp-gradient-test.h @@ -14,7 +14,7 @@ class SPGradientTest : public DocumentUsingTest { public: - SPDocument* _doc; + Document* _doc; SPGradientTest() : _doc(0) diff --git a/src/sp-gradient.cpp b/src/sp-gradient.cpp index 84a0a9870..c9ceeabf0 100644 --- a/src/sp-gradient.cpp +++ b/src/sp-gradient.cpp @@ -56,7 +56,7 @@ static void sp_stop_class_init(SPStopClass *klass); static void sp_stop_init(SPStop *stop); -static void sp_stop_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_stop_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); static void sp_stop_set(SPObject *object, unsigned key, gchar const *value); static Inkscape::XML::Node *sp_stop_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); @@ -114,7 +114,7 @@ sp_stop_init(SPStop *stop) /** * Virtual build: set stop attributes from its associated XML node. */ -static void sp_stop_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +static void sp_stop_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) stop_parent_class)->build) (* ((SPObjectClass *) stop_parent_class)->build)(object, document, repr); @@ -294,7 +294,7 @@ sp_stop_get_color(SPStop const *const stop) static void sp_gradient_class_init(SPGradientClass *klass); static void sp_gradient_init(SPGradient *gr); -static void sp_gradient_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_gradient_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); static void sp_gradient_release(SPObject *object); static void sp_gradient_set(SPObject *object, unsigned key, gchar const *value); static void sp_gradient_child_added(SPObject *object, @@ -398,7 +398,7 @@ sp_gradient_init(SPGradient *gr) * Virtual build: set gradient attributes from its associated repr. */ static void -sp_gradient_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +sp_gradient_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { SPGradient *gradient = SP_GRADIENT(object); @@ -1402,7 +1402,7 @@ static void sp_lineargradient_class_init(SPLinearGradientClass *klass); static void sp_lineargradient_init(SPLinearGradient *lg); static void sp_lineargradient_build(SPObject *object, - SPDocument *document, + Document *document, Inkscape::XML::Node *repr); static void sp_lineargradient_set(SPObject *object, unsigned key, gchar const *value); static Inkscape::XML::Node *sp_lineargradient_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, @@ -1474,7 +1474,7 @@ static void sp_lineargradient_init(SPLinearGradient *lg) * Callback: set attributes from associated repr. */ static void sp_lineargradient_build(SPObject *object, - SPDocument *document, + Document *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) lg_parent_class)->build) @@ -1677,7 +1677,7 @@ static void sp_radialgradient_class_init(SPRadialGradientClass *klass); static void sp_radialgradient_init(SPRadialGradient *rg); static void sp_radialgradient_build(SPObject *object, - SPDocument *document, + Document *document, Inkscape::XML::Node *repr); static void sp_radialgradient_set(SPObject *object, unsigned key, gchar const *value); static Inkscape::XML::Node *sp_radialgradient_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, @@ -1751,7 +1751,7 @@ sp_radialgradient_init(SPRadialGradient *rg) * Set radial gradient attributes from associated repr. */ static void -sp_radialgradient_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +sp_radialgradient_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) rg_parent_class)->build) (* ((SPObjectClass *) rg_parent_class)->build)(object, document, repr); diff --git a/src/sp-guide.cpp b/src/sp-guide.cpp index f5edf7d97..170dfa375 100644 --- a/src/sp-guide.cpp +++ b/src/sp-guide.cpp @@ -54,7 +54,7 @@ static void sp_guide_init(SPGuide *guide); static void sp_guide_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); static void sp_guide_get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); -static void sp_guide_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_guide_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); static void sp_guide_release(SPObject *object); static void sp_guide_set(SPObject *object, unsigned int key, const gchar *value); @@ -152,7 +152,7 @@ static void sp_guide_get_property(GObject *object, guint prop_id, GValue *value, } } -static void sp_guide_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +static void sp_guide_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) (parent_class))->build) { (* ((SPObjectClass *) (parent_class))->build)(object, document, repr); @@ -243,7 +243,7 @@ static void sp_guide_set(SPObject *object, unsigned int key, const gchar *value) SPGuide * sp_guide_create(SPDesktop *desktop, Geom::Point const &pt1, Geom::Point const &pt2) { - SPDocument *doc=sp_desktop_document(desktop); + Document *doc=sp_desktop_document(desktop); Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc); Inkscape::XML::Node *repr = xml_doc->createElement("sodipodi:guide"); @@ -269,7 +269,7 @@ sp_guide_pt_pairs_to_guides(SPDesktop *dt, std::list > pts; Geom::Point A(0, 0); diff --git a/src/sp-image.cpp b/src/sp-image.cpp index 65aad1e2d..5284bb923 100644 --- a/src/sp-image.cpp +++ b/src/sp-image.cpp @@ -69,7 +69,7 @@ static void sp_image_class_init (SPImageClass * klass); static void sp_image_init (SPImage * image); -static void sp_image_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr); +static void sp_image_build (SPObject * object, Document * document, Inkscape::XML::Node * repr); static void sp_image_release (SPObject * object); static void sp_image_set (SPObject *object, unsigned int key, const gchar *value); static void sp_image_update (SPObject *object, SPCtx *ctx, unsigned int flags); @@ -625,7 +625,7 @@ static void sp_image_init( SPImage *image ) } static void -sp_image_build (SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +sp_image_build (SPObject *object, Document *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) parent_class)->build) { ((SPObjectClass *) parent_class)->build (object, document, repr); @@ -811,7 +811,7 @@ static void sp_image_update (SPObject *object, SPCtx *ctx, unsigned int flags) { SPImage *image = SP_IMAGE(object); - SPDocument *doc = SP_OBJECT_DOCUMENT(object); + Document *doc = SP_OBJECT_DOCUMENT(object); if (((SPObjectClass *) (parent_class))->update) { ((SPObjectClass *) (parent_class))->update (object, ctx, flags); diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp index 9c19ce75a..f9570a885 100644 --- a/src/sp-item-group.cpp +++ b/src/sp-item-group.cpp @@ -51,7 +51,7 @@ static void sp_group_class_init (SPGroupClass *klass); static void sp_group_init (SPGroup *group); -static void sp_group_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_group_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); static void sp_group_release(SPObject *object); static void sp_group_dispose(GObject *object); @@ -144,7 +144,7 @@ sp_group_init (SPGroup *group) new (&group->_display_modes) std::map(); } -static void sp_group_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +static void sp_group_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { sp_object_read_attr(object, "inkscape:groupmode"); @@ -358,7 +358,7 @@ sp_item_group_ungroup (SPGroup *group, GSList **children, bool do_done) g_return_if_fail (group != NULL); g_return_if_fail (SP_IS_GROUP (group)); - SPDocument *doc = SP_OBJECT_DOCUMENT (group); + Document *doc = SP_OBJECT_DOCUMENT (group); SPObject *root = SP_DOCUMENT_ROOT (doc); SPObject *defs = SP_OBJECT (SP_ROOT (root)->defs); diff --git a/src/sp-item.cpp b/src/sp-item.cpp index 662dc1cac..16efe677f 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -83,7 +83,7 @@ static void sp_item_class_init(SPItemClass *klass); static void sp_item_init(SPItem *item); -static void sp_item_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_item_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); static void sp_item_release(SPObject *object); static void sp_item_set(SPObject *object, unsigned key, gchar const *value); static void sp_item_update(SPObject *object, SPCtx *ctx, guint flags); @@ -401,7 +401,7 @@ void SPItem::lowerToBottom() { } static void -sp_item_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +sp_item_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { sp_object_read_attr(object, "style"); sp_object_read_attr(object, "transform"); diff --git a/src/sp-line.cpp b/src/sp-line.cpp index d0ce32397..36ac643ec 100644 --- a/src/sp-line.cpp +++ b/src/sp-line.cpp @@ -28,7 +28,7 @@ static void sp_line_class_init (SPLineClass *klass); static void sp_line_init (SPLine *line); -static void sp_line_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr); +static void sp_line_build (SPObject * object, Document * document, Inkscape::XML::Node * repr); static void sp_line_set (SPObject *object, unsigned int key, const gchar *value); static Inkscape::XML::Node *sp_line_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); @@ -96,7 +96,7 @@ sp_line_init (SPLine * line) static void -sp_line_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr) +sp_line_build (SPObject * object, Document * document, Inkscape::XML::Node * repr) { if (((SPObjectClass *) parent_class)->build) { ((SPObjectClass *) parent_class)->build (object, document, repr); diff --git a/src/sp-lpe-item.cpp b/src/sp-lpe-item.cpp index 90e9b2d6d..fdf348b78 100644 --- a/src/sp-lpe-item.cpp +++ b/src/sp-lpe-item.cpp @@ -44,7 +44,7 @@ static void sp_lpe_item_class_init(SPLPEItemClass *klass); static void sp_lpe_item_init(SPLPEItem *lpe_item); static void sp_lpe_item_finalize(GObject *object); -static void sp_lpe_item_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_lpe_item_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); static void sp_lpe_item_release(SPObject *object); static void sp_lpe_item_set(SPObject *object, unsigned int key, gchar const *value); static void sp_lpe_item_update(SPObject *object, SPCtx *ctx, guint flags); @@ -137,7 +137,7 @@ sp_lpe_item_finalize(GObject *object) * sp-object-repr.cpp's repr_name_entries array. */ static void -sp_lpe_item_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +sp_lpe_item_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { sp_object_read_attr(object, "inkscape:path-effect"); diff --git a/src/sp-mask.cpp b/src/sp-mask.cpp index 20cb38297..12876d69a 100644 --- a/src/sp-mask.cpp +++ b/src/sp-mask.cpp @@ -37,7 +37,7 @@ struct SPMaskView { static void sp_mask_class_init (SPMaskClass *klass); static void sp_mask_init (SPMask *mask); -static void sp_mask_build (SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_mask_build (SPObject *object, Document *document, Inkscape::XML::Node *repr); static void sp_mask_release (SPObject * object); static void sp_mask_set (SPObject *object, unsigned int key, const gchar *value); static void sp_mask_child_added (SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref); @@ -98,7 +98,7 @@ sp_mask_init (SPMask *mask) } static void -sp_mask_build (SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +sp_mask_build (SPObject *object, Document *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) parent_class)->build) { ((SPObjectClass *) parent_class)->build (object, document, repr); @@ -270,7 +270,7 @@ sp_mask_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML // Create a mask element (using passed elements), add it to const gchar * -sp_mask_create (GSList *reprs, SPDocument *document, Geom::Matrix const* applyTransform) +sp_mask_create (GSList *reprs, Document *document, Geom::Matrix const* applyTransform) { Inkscape::XML::Node *defsrepr = SP_OBJECT_REPR (SP_DOCUMENT_DEFS (document)); diff --git a/src/sp-mask.h b/src/sp-mask.h index d5bddd332..293be8cee 100644 --- a/src/sp-mask.h +++ b/src/sp-mask.h @@ -60,6 +60,6 @@ void sp_mask_hide (SPMask *mask, unsigned int key); void sp_mask_set_bbox (SPMask *mask, unsigned int key, NRRect *bbox); -const gchar *sp_mask_create (GSList *reprs, SPDocument *document, Geom::Matrix const* applyTransform); +const gchar *sp_mask_create (GSList *reprs, Document *document, Geom::Matrix const* applyTransform); #endif diff --git a/src/sp-metadata.cpp b/src/sp-metadata.cpp index 920b7d64d..1b9be0188 100644 --- a/src/sp-metadata.cpp +++ b/src/sp-metadata.cpp @@ -37,7 +37,7 @@ static void sp_metadata_class_init (SPMetadataClass *klass); static void sp_metadata_init (SPMetadata *metadata); -static void sp_metadata_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr); +static void sp_metadata_build (SPObject * object, Document * document, Inkscape::XML::Node * repr); static void sp_metadata_release (SPObject *object); static void sp_metadata_set (SPObject *object, unsigned int key, const gchar *value); static void sp_metadata_update(SPObject *object, SPCtx *ctx, guint flags); @@ -109,7 +109,7 @@ void strip_ids_recursively(Inkscape::XML::Node *node) { * sp-object-repr.cpp's repr_name_entries array. */ static void -sp_metadata_build (SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +sp_metadata_build (SPObject *object, Document *document, Inkscape::XML::Node *repr) { using Inkscape::XML::NodeSiblingIterator; @@ -207,7 +207,7 @@ sp_metadata_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML: * \brief Retrieves the metadata object associated with a document */ SPMetadata * -sp_document_metadata (SPDocument *document) +sp_document_metadata (Document *document) { SPObject *nv; diff --git a/src/sp-metadata.h b/src/sp-metadata.h index 82b7c4fc5..1de463479 100644 --- a/src/sp-metadata.h +++ b/src/sp-metadata.h @@ -33,7 +33,7 @@ struct SPMetadataClass { GType sp_metadata_get_type (void); -SPMetadata * sp_document_metadata (SPDocument *document); +SPMetadata * sp_document_metadata (Document *document); #endif // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : diff --git a/src/sp-missing-glyph.cpp b/src/sp-missing-glyph.cpp index ffc29a71e..4b120717a 100644 --- a/src/sp-missing-glyph.cpp +++ b/src/sp-missing-glyph.cpp @@ -25,7 +25,7 @@ static void sp_missing_glyph_class_init(SPMissingGlyphClass *gc); static void sp_missing_glyph_init(SPMissingGlyph *glyph); -static void sp_missing_glyph_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_missing_glyph_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); static void sp_missing_glyph_release(SPObject *object); static void sp_missing_glyph_set(SPObject *object, unsigned int key, const gchar *value); static Inkscape::XML::Node *sp_missing_glyph_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); @@ -77,7 +77,7 @@ static void sp_missing_glyph_init(SPMissingGlyph *glyph) glyph->vert_adv_y = 0; } -static void sp_missing_glyph_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +static void sp_missing_glyph_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) (parent_class))->build) { ((SPObjectClass *) (parent_class))->build(object, document, repr); diff --git a/src/sp-namedview.cpp b/src/sp-namedview.cpp index 47720c5d6..4def33f75 100644 --- a/src/sp-namedview.cpp +++ b/src/sp-namedview.cpp @@ -46,7 +46,7 @@ static void sp_namedview_class_init(SPNamedViewClass *klass); static void sp_namedview_init(SPNamedView *namedview); -static void sp_namedview_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_namedview_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); static void sp_namedview_release(SPObject *object); static void sp_namedview_set(SPObject *object, unsigned int key, const gchar *value); static void sp_namedview_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref); @@ -120,7 +120,7 @@ static void sp_namedview_init(SPNamedView *nv) new (&nv->snap_manager) SnapManager(nv); } -static void sp_namedview_generate_old_grid(SPNamedView * /*nv*/, SPDocument *document, Inkscape::XML::Node *repr) { +static void sp_namedview_generate_old_grid(SPNamedView * /*nv*/, Document *document, Inkscape::XML::Node *repr) { bool old_grid_settings_present = false; // set old settings @@ -208,7 +208,7 @@ static void sp_namedview_generate_old_grid(SPNamedView * /*nv*/, SPDocument *doc } } -static void sp_namedview_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +static void sp_namedview_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { SPNamedView *nv = (SPNamedView *) object; SPObjectGroup *og = (SPObjectGroup *) object; @@ -777,7 +777,7 @@ void sp_namedview_window_from_document(SPDesktop *desktop) void sp_namedview_update_layers_from_document (SPDesktop *desktop) { SPObject *layer = NULL; - SPDocument *document = desktop->doc(); + Document *document = desktop->doc(); SPNamedView *nv = desktop->namedview; if ( nv->default_layer_id != 0 ) { layer = document->getObjectById(g_quark_to_string(nv->default_layer_id)); @@ -878,7 +878,7 @@ static void sp_namedview_show_single_guide(SPGuide* guide, bool show) } } -void sp_namedview_toggle_guides(SPDocument *doc, Inkscape::XML::Node *repr) +void sp_namedview_toggle_guides(Document *doc, Inkscape::XML::Node *repr) { unsigned int v; unsigned int set = sp_repr_get_boolean(repr, "showguides", &v); @@ -900,7 +900,7 @@ void sp_namedview_show_grids(SPNamedView * namedview, bool show, bool dirty_docu { namedview->grids_visible = show; - SPDocument *doc = SP_OBJECT_DOCUMENT (namedview); + Document *doc = SP_OBJECT_DOCUMENT (namedview); Inkscape::XML::Node *repr = SP_OBJECT_REPR(namedview); bool saved = sp_document_get_undo_sensitive(doc); @@ -966,7 +966,7 @@ static gboolean sp_nv_read_opacity(const gchar *str, guint32 *color) return TRUE; } -SPNamedView *sp_document_namedview(SPDocument *document, const gchar *id) +SPNamedView *sp_document_namedview(Document *document, const gchar *id) { g_return_val_if_fail(document != NULL, NULL); diff --git a/src/sp-namedview.h b/src/sp-namedview.h index 048096d8c..450e80d47 100644 --- a/src/sp-namedview.h +++ b/src/sp-namedview.h @@ -88,13 +88,13 @@ struct SPNamedViewClass { GType sp_namedview_get_type(); -SPNamedView *sp_document_namedview(SPDocument *document, gchar const *name); +SPNamedView *sp_document_namedview(Document *document, gchar const *name); void sp_namedview_window_from_document(SPDesktop *desktop); void sp_namedview_document_from_window(SPDesktop *desktop); void sp_namedview_update_layers_from_document (SPDesktop *desktop); -void sp_namedview_toggle_guides(SPDocument *doc, Inkscape::XML::Node *repr); +void sp_namedview_toggle_guides(Document *doc, Inkscape::XML::Node *repr); void sp_namedview_show_grids(SPNamedView *namedview, bool show, bool dirty_document); Inkscape::CanvasGrid * sp_namedview_get_first_enabled_grid(SPNamedView *namedview); diff --git a/src/sp-object-repr.cpp b/src/sp-object-repr.cpp index 4c3d5196e..7583049dc 100644 --- a/src/sp-object-repr.cpp +++ b/src/sp-object-repr.cpp @@ -94,7 +94,7 @@ static GType name_to_gtype(NameType name_type, gchar const *name); * Construct an SPRoot and all its descendents from the given repr. */ SPObject * -sp_object_repr_build_tree(SPDocument *document, Inkscape::XML::Node *repr) +sp_object_repr_build_tree(Document *document, Inkscape::XML::Node *repr) { g_assert(document != NULL); g_assert(repr != NULL); diff --git a/src/sp-object-repr.h b/src/sp-object-repr.h index f3a80f83c..0dec20fe0 100644 --- a/src/sp-object-repr.h +++ b/src/sp-object-repr.h @@ -21,7 +21,7 @@ class Node; } -SPObject *sp_object_repr_build_tree (SPDocument *document, Inkscape::XML::Node *repr); +SPObject *sp_object_repr_build_tree (ocument *document, Inkscape::XML::Node *repr); GType sp_repr_type_lookup (Inkscape::XML::Node *repr); diff --git a/src/sp-object.cpp b/src/sp-object.cpp index 85e8a4e9a..fade379bd 100644 --- a/src/sp-object.cpp +++ b/src/sp-object.cpp @@ -27,7 +27,7 @@ * propagate to the SPRepr layer. This is important for implementation of * the undo stack, animations and other features. * - * SPObjects are bound to the higher-level container SPDocument, which + * SPObjects are bound to the higher-level container Document, which * provides document level functionality such as the undo stack, * dictionary and so on. Source: doc/architecture.txt */ @@ -84,7 +84,7 @@ static void sp_object_remove_child(SPObject *object, Inkscape::XML::Node *child) static void sp_object_order_changed(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *old_ref, Inkscape::XML::Node *new_ref); static void sp_object_release(SPObject *object); -static void sp_object_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_object_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); static void sp_object_private_set(SPObject *object, unsigned int key, gchar const *value); static Inkscape::XML::Node *sp_object_private_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); @@ -783,11 +783,11 @@ static void sp_object_order_changed(SPObject *object, Inkscape::XML::Node *child * the document and repr; implementation then will parse all of the attributes, * generate the children objects and so on. Invoking build on the SPRoot * object results in creation of the whole document tree (this is, what - * SPDocument does after the creation of the XML tree). + * Document does after the creation of the XML tree). * \see sp_object_release() */ static void -sp_object_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +sp_object_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { /* Nothing specific here */ debug("id=%x, typename=%s", object, g_type_name_from_instance((GTypeInstance*)object)); @@ -809,7 +809,7 @@ sp_object_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *rep } void -sp_object_invoke_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr, unsigned int cloned) +sp_object_invoke_build(SPObject *object, Document *document, Inkscape::XML::Node *repr, unsigned int cloned) { debug("id=%x, typename=%s", object, g_type_name_from_instance((GTypeInstance*)object)); @@ -960,7 +960,7 @@ sp_object_private_set(SPObject *object, unsigned int key, gchar const *value) switch (key) { case SP_ATTR_ID: if ( !SP_OBJECT_IS_CLONED(object) && object->repr->type() == Inkscape::XML::ELEMENT_NODE ) { - SPDocument *document=object->document; + Document *document=object->document; SPObject *conflict=NULL; gchar const *new_id = value; diff --git a/src/sp-object.h b/src/sp-object.h index bbb8ecbd0..2932da728 100644 --- a/src/sp-object.h +++ b/src/sp-object.h @@ -149,7 +149,7 @@ struct SPObject : public GObject { SPIXmlSpace xml_space; unsigned int hrefcount; /* number of xlink:href references */ unsigned int _total_hrefcount; /* our hrefcount + total descendants */ - SPDocument *document; /* Document we are part of */ + Document *document; /* Document we are part of */ SPObject *parent; /* Our parent (only one allowed) */ SPObject *children; /* Our children */ SPObject *_last_child; /* Remembered last child */ @@ -429,7 +429,7 @@ struct SPObject : public GObject { /** @brief Updates the object's display immediately * - * This method is called during the idle loop by SPDocument in order to update the object's + * This method is called during the idle loop by Document in order to update the object's * display. * * One additional flag is legal here: @@ -501,7 +501,7 @@ private: struct SPObjectClass { GObjectClass parent_class; - void (* build) (SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr); + void (* build) (SPObject *object, Document *doc, Inkscape::XML::Node *repr); void (* release) (SPObject *object); /* Virtual handlers of repr signals */ @@ -536,7 +536,7 @@ inline SPObject *sp_object_first_child(SPObject *parent) { } SPObject *sp_object_get_child_by_repr(SPObject *object, Inkscape::XML::Node *repr); -void sp_object_invoke_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr, unsigned int cloned); +void sp_object_invoke_build(SPObject *object, Document *document, Inkscape::XML::Node *repr, unsigned int cloned); void sp_object_set(SPObject *object, unsigned int key, gchar const *value); diff --git a/src/sp-offset.cpp b/src/sp-offset.cpp index ae0f7bf19..12e98d5ef 100644 --- a/src/sp-offset.cpp +++ b/src/sp-offset.cpp @@ -42,7 +42,7 @@ #include "xml/repr.h" -class SPDocument; +class Document; #define noOFFSET_VERBOSE @@ -73,7 +73,7 @@ static void sp_offset_class_init (SPOffsetClass * klass); static void sp_offset_init (SPOffset * offset); static void sp_offset_finalize(GObject *obj); -static void sp_offset_build (SPObject * object, SPDocument * document, +static void sp_offset_build (SPObject * object, Document * document, Inkscape::XML::Node * repr); static Inkscape::XML::Node *sp_offset_write (SPObject * object, Inkscape::XML::Document *doc, Inkscape::XML::Node * repr, guint flags); @@ -212,7 +212,7 @@ sp_offset_finalize(GObject *obj) * Virtual build: set offset attributes from corresponding repr. */ static void -sp_offset_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +sp_offset_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) parent_class)->build) ((SPObjectClass *) parent_class)->build (object, document, repr); diff --git a/src/sp-paint-server.h b/src/sp-paint-server.h index 998f1556b..0402ac3ce 100644 --- a/src/sp-paint-server.h +++ b/src/sp-paint-server.h @@ -63,7 +63,7 @@ SPPainter *sp_painter_free (SPPainter *painter); class SPPaintServerReference : public Inkscape::URIReference { public: SPPaintServerReference (SPObject *obj) : URIReference(obj) {} - SPPaintServerReference (SPDocument *doc) : URIReference(doc) {} + SPPaintServerReference (Document *doc) : URIReference(doc) {} SPPaintServer *getObject() const { return (SPPaintServer *)URIReference::getObject(); } diff --git a/src/sp-path.cpp b/src/sp-path.cpp index 04ad386d9..b6637e9d1 100644 --- a/src/sp-path.cpp +++ b/src/sp-path.cpp @@ -56,7 +56,7 @@ static void sp_path_init(SPPath *path); static void sp_path_finalize(GObject *obj); static void sp_path_release(SPObject *object); -static void sp_path_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_path_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); static void sp_path_set(SPObject *object, unsigned key, gchar const *value); static Inkscape::XML::Node *sp_path_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); @@ -211,7 +211,7 @@ sp_path_finalize(GObject *obj) * fill & style attributes, markers, and CSS properties. */ static void -sp_path_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +sp_path_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { /* Are these calls actually necessary? */ sp_object_read_attr(object, "marker"); diff --git a/src/sp-pattern.cpp b/src/sp-pattern.cpp index 90af65b97..60d2254f7 100644 --- a/src/sp-pattern.cpp +++ b/src/sp-pattern.cpp @@ -64,7 +64,7 @@ struct SPPatPainter { static void sp_pattern_class_init (SPPatternClass *klass); static void sp_pattern_init (SPPattern *gr); -static void sp_pattern_build (SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_pattern_build (SPObject *object, Document *document, Inkscape::XML::Node *repr); static void sp_pattern_release (SPObject *object); static void sp_pattern_set (SPObject *object, unsigned int key, const gchar *value); static void sp_pattern_child_added (SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref); @@ -151,7 +151,7 @@ sp_pattern_init (SPPattern *pat) } static void -sp_pattern_build (SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +sp_pattern_build (SPObject *object, Document *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) pattern_parent_class)->build) (* ((SPObjectClass *) pattern_parent_class)->build) (object, document, repr); @@ -443,7 +443,7 @@ pattern_users (SPPattern *pattern) SPPattern * pattern_chain (SPPattern *pattern) { - SPDocument *document = SP_OBJECT_DOCUMENT (pattern); + Document *document = SP_OBJECT_DOCUMENT (pattern); Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document); Inkscape::XML::Node *defsrepr = SP_OBJECT_REPR (SP_DOCUMENT_DEFS (document)); @@ -496,7 +496,7 @@ sp_pattern_transform_multiply (SPPattern *pattern, Geom::Matrix postmul, bool se } const gchar * -pattern_tile (GSList *reprs, Geom::Rect bounds, SPDocument *document, Geom::Matrix transform, Geom::Matrix move) +pattern_tile (GSList *reprs, Geom::Rect bounds, Document *document, Geom::Matrix transform, Geom::Matrix move) { Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document); Inkscape::XML::Node *defsrepr = SP_OBJECT_REPR (SP_DOCUMENT_DEFS (document)); diff --git a/src/sp-pattern.h b/src/sp-pattern.h index f15285e27..48c450425 100644 --- a/src/sp-pattern.h +++ b/src/sp-pattern.h @@ -86,7 +86,7 @@ SPPattern *pattern_chain (SPPattern *pattern); SPPattern *sp_pattern_clone_if_necessary (SPItem *item, SPPattern *pattern, const gchar *property); void sp_pattern_transform_multiply (SPPattern *pattern, Geom::Matrix postmul, bool set); -const gchar *pattern_tile (GSList *reprs, Geom::Rect bounds, SPDocument *document, Geom::Matrix transform, Geom::Matrix move); +const gchar *pattern_tile (GSList *reprs, Geom::Rect bounds, Document *document, Geom::Matrix transform, Geom::Matrix move); SPPattern *pattern_getroot (SPPattern *pat); diff --git a/src/sp-polygon.cpp b/src/sp-polygon.cpp index 014c68c9b..0f9003f34 100644 --- a/src/sp-polygon.cpp +++ b/src/sp-polygon.cpp @@ -29,7 +29,7 @@ static void sp_polygon_class_init(SPPolygonClass *pc); static void sp_polygon_init(SPPolygon *polygon); -static void sp_polygon_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_polygon_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); static Inkscape::XML::Node *sp_polygon_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static gchar *sp_polygon_description(SPItem *item); @@ -78,7 +78,7 @@ static void sp_polygon_init(SPPolygon */*polygon*/) /* Nothing here */ } -static void sp_polygon_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +static void sp_polygon_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) parent_class)->build) { ((SPObjectClass *) parent_class)->build(object, document, repr); diff --git a/src/sp-polyline.cpp b/src/sp-polyline.cpp index 08f446d61..ff7951992 100644 --- a/src/sp-polyline.cpp +++ b/src/sp-polyline.cpp @@ -23,7 +23,7 @@ static void sp_polyline_class_init (SPPolyLineClass *klass); static void sp_polyline_init (SPPolyLine *polyline); -static void sp_polyline_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr); +static void sp_polyline_build (SPObject * object, Document * document, Inkscape::XML::Node * repr); static void sp_polyline_set (SPObject *object, unsigned int key, const gchar *value); static Inkscape::XML::Node *sp_polyline_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); @@ -81,7 +81,7 @@ sp_polyline_init (SPPolyLine * /*polyline*/) } static void -sp_polyline_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr) +sp_polyline_build (SPObject * object, Document * document, Inkscape::XML::Node * repr) { if (((SPObjectClass *) parent_class)->build) diff --git a/src/sp-rect.cpp b/src/sp-rect.cpp index aa026abb3..6e4b515c0 100644 --- a/src/sp-rect.cpp +++ b/src/sp-rect.cpp @@ -36,7 +36,7 @@ static void sp_rect_class_init(SPRectClass *klass); static void sp_rect_init(SPRect *rect); -static void sp_rect_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_rect_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); static void sp_rect_set(SPObject *object, unsigned key, gchar const *value); static void sp_rect_update(SPObject *object, SPCtx *ctx, guint flags); static Inkscape::XML::Node *sp_rect_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); @@ -108,7 +108,7 @@ sp_rect_init(SPRect */*rect*/) } static void -sp_rect_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +sp_rect_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) parent_class)->build) ((SPObjectClass *) parent_class)->build(object, document, repr); diff --git a/src/sp-root.cpp b/src/sp-root.cpp index bd935074d..e06405df5 100644 --- a/src/sp-root.cpp +++ b/src/sp-root.cpp @@ -41,7 +41,7 @@ class SPDesktop; static void sp_root_class_init(SPRootClass *klass); static void sp_root_init(SPRoot *root); -static void sp_root_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_root_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); static void sp_root_release(SPObject *object); static void sp_root_set(SPObject *object, unsigned int key, gchar const *value); static void sp_root_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref); @@ -141,7 +141,7 @@ sp_root_init(SPRoot *root) * It then calls the object's parent class object's build function. */ static void -sp_root_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +sp_root_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { SPGroup *group = (SPGroup *) object; SPRoot *root = (SPRoot *) object; diff --git a/src/sp-script.cpp b/src/sp-script.cpp index a40132450..d495ac51f 100644 --- a/src/sp-script.cpp +++ b/src/sp-script.cpp @@ -23,7 +23,7 @@ static void sp_script_release(SPObject *object); static void sp_script_update(SPObject *object, SPCtx *ctx, guint flags); static void sp_script_modified(SPObject *object, guint flags); static void sp_script_set(SPObject *object, unsigned int key, gchar const *value); -static void sp_script_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_script_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); static Inkscape::XML::Node *sp_script_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static SPObjectClass *parent_class; @@ -76,7 +76,7 @@ static void sp_script_init(SPScript */*script*/) * sp-object-repr.cpp's repr_name_entries array. */ static void -sp_script_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +sp_script_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) parent_class)->build) { ((SPObjectClass *) parent_class)->build(object, document, repr); diff --git a/src/sp-shape.cpp b/src/sp-shape.cpp index e7ded6303..638d2b040 100644 --- a/src/sp-shape.cpp +++ b/src/sp-shape.cpp @@ -56,7 +56,7 @@ static void sp_shape_class_init (SPShapeClass *klass); static void sp_shape_init (SPShape *shape); static void sp_shape_finalize (GObject *object); -static void sp_shape_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr); +static void sp_shape_build (SPObject * object, Document * document, Inkscape::XML::Node * repr); static void sp_shape_release (SPObject *object); static void sp_shape_set(SPObject *object, unsigned key, gchar const *value); @@ -169,7 +169,7 @@ sp_shape_finalize (GObject *object) * \see sp_object_build() */ static void -sp_shape_build (SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +sp_shape_build (SPObject *object, Document *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) (parent_class))->build) { (*((SPObjectClass *) (parent_class))->build) (object, document, repr); diff --git a/src/sp-skeleton.cpp b/src/sp-skeleton.cpp index ec6c9b437..b92f738db 100644 --- a/src/sp-skeleton.cpp +++ b/src/sp-skeleton.cpp @@ -44,7 +44,7 @@ static void sp_skeleton_class_init(SPSkeletonClass *klass); static void sp_skeleton_init(SPSkeleton *skeleton); -static void sp_skeleton_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_skeleton_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); static void sp_skeleton_release(SPObject *object); static void sp_skeleton_set(SPObject *object, unsigned int key, gchar const *value); static void sp_skeleton_update(SPObject *object, SPCtx *ctx, guint flags); @@ -100,7 +100,7 @@ sp_skeleton_init(SPSkeleton *skeleton) * sp-object-repr.cpp's repr_name_entries array. */ static void -sp_skeleton_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +sp_skeleton_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { debug("0x%p",object); if (((SPObjectClass *) skeleton_parent_class)->build) { diff --git a/src/sp-spiral.cpp b/src/sp-spiral.cpp index 71906fcc0..f0f95fb9c 100644 --- a/src/sp-spiral.cpp +++ b/src/sp-spiral.cpp @@ -30,7 +30,7 @@ static void sp_spiral_class_init (SPSpiralClass *klass); static void sp_spiral_init (SPSpiral *spiral); -static void sp_spiral_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr); +static void sp_spiral_build (SPObject * object, Document * document, Inkscape::XML::Node * repr); static Inkscape::XML::Node *sp_spiral_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void sp_spiral_set (SPObject *object, unsigned int key, const gchar *value); static void sp_spiral_update (SPObject *object, SPCtx *ctx, guint flags); @@ -123,7 +123,7 @@ sp_spiral_init (SPSpiral * spiral) * Virtual build: set spiral properties from corresponding repr. */ static void -sp_spiral_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr) +sp_spiral_build (SPObject * object, Document * document, Inkscape::XML::Node * repr) { if (((SPObjectClass *) parent_class)->build) ((SPObjectClass *) parent_class)->build (object, document, repr); diff --git a/src/sp-star.cpp b/src/sp-star.cpp index 71c9ad1c7..88b24aa77 100644 --- a/src/sp-star.cpp +++ b/src/sp-star.cpp @@ -33,7 +33,7 @@ static void sp_star_class_init (SPStarClass *klass); static void sp_star_init (SPStar *star); -static void sp_star_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr); +static void sp_star_build (SPObject * object, Document * document, Inkscape::XML::Node * repr); static Inkscape::XML::Node *sp_star_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void sp_star_set (SPObject *object, unsigned int key, const gchar *value); static void sp_star_update (SPObject *object, SPCtx *ctx, guint flags); @@ -111,7 +111,7 @@ sp_star_init (SPStar * star) } static void -sp_star_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr) +sp_star_build (SPObject * object, Document * document, Inkscape::XML::Node * repr) { if (((SPObjectClass *) parent_class)->build) ((SPObjectClass *) parent_class)->build (object, document, repr); diff --git a/src/sp-string.cpp b/src/sp-string.cpp index 871338ad5..a1a974310 100644 --- a/src/sp-string.cpp +++ b/src/sp-string.cpp @@ -40,7 +40,7 @@ static void sp_string_class_init(SPStringClass *classname); static void sp_string_init(SPString *string); -static void sp_string_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_string_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); static void sp_string_release(SPObject *object); static void sp_string_read_content(SPObject *object); static void sp_string_update(SPObject *object, SPCtx *ctx, unsigned flags); @@ -91,7 +91,7 @@ sp_string_init(SPString *string) } static void -sp_string_build(SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr) +sp_string_build(SPObject *object, Document *doc, Inkscape::XML::Node *repr) { sp_string_read_content(object); diff --git a/src/sp-style-elem-test.h b/src/sp-style-elem-test.h index 6e24ee28c..75e2d450c 100644 --- a/src/sp-style-elem-test.h +++ b/src/sp-style-elem-test.h @@ -12,7 +12,7 @@ class SPStyleElemTest : public CxxTest::TestSuite { public: - SPDocument* _doc; + Document* _doc; SPStyleElemTest() : _doc(0) diff --git a/src/sp-style-elem.cpp b/src/sp-style-elem.cpp index 46c311920..1becc4221 100644 --- a/src/sp-style-elem.cpp +++ b/src/sp-style-elem.cpp @@ -9,7 +9,7 @@ using Inkscape::XML::TEXT_NODE; static void sp_style_elem_init(SPStyleElem *style_elem); static void sp_style_elem_class_init(SPStyleElemClass *klass); -static void sp_style_elem_build(SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr); +static void sp_style_elem_build(SPObject *object, Document *doc, Inkscape::XML::Node *repr); static void sp_style_elem_set(SPObject *object, unsigned const key, gchar const *const value); static void sp_style_elem_read_content(SPObject *); static Inkscape::XML::Node *sp_style_elem_write(SPObject *, Inkscape::XML::Document *, Inkscape::XML::Node *, guint flags); @@ -385,7 +385,7 @@ rec_add_listener(Inkscape::XML::Node &repr, } static void -sp_style_elem_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +sp_style_elem_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { sp_style_elem_read_content(object); diff --git a/src/sp-symbol.cpp b/src/sp-symbol.cpp index 41004db6e..8b176fb0a 100644 --- a/src/sp-symbol.cpp +++ b/src/sp-symbol.cpp @@ -31,7 +31,7 @@ static void sp_symbol_class_init (SPSymbolClass *klass); static void sp_symbol_init (SPSymbol *symbol); -static void sp_symbol_build (SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_symbol_build (SPObject *object, Document *document, Inkscape::XML::Node *repr); static void sp_symbol_release (SPObject *object); static void sp_symbol_set (SPObject *object, unsigned int key, const gchar *value); static void sp_symbol_child_added (SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref); @@ -102,7 +102,7 @@ sp_symbol_init (SPSymbol *symbol) } static void -sp_symbol_build (SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +sp_symbol_build (SPObject *object, Document *document, Inkscape::XML::Node *repr) { SPGroup *group; SPSymbol *symbol; diff --git a/src/sp-text.cpp b/src/sp-text.cpp index 61947311c..325b3b381 100644 --- a/src/sp-text.cpp +++ b/src/sp-text.cpp @@ -62,7 +62,7 @@ static void sp_text_class_init (SPTextClass *classname); static void sp_text_init (SPText *text); static void sp_text_release (SPObject *object); -static void sp_text_build (SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_text_build (SPObject *object, Document *document, Inkscape::XML::Node *repr); static void sp_text_set (SPObject *object, unsigned key, gchar const *value); static void sp_text_child_added (SPObject *object, Inkscape::XML::Node *rch, Inkscape::XML::Node *ref); static void sp_text_remove_child (SPObject *object, Inkscape::XML::Node *rch); @@ -147,7 +147,7 @@ sp_text_release (SPObject *object) } static void -sp_text_build (SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr) +sp_text_build (SPObject *object, Document *doc, Inkscape::XML::Node *repr) { sp_object_read_attr(object, "x"); sp_object_read_attr(object, "y"); diff --git a/src/sp-tref.cpp b/src/sp-tref.cpp index 83f9ecfa6..5323cde84 100644 --- a/src/sp-tref.cpp +++ b/src/sp-tref.cpp @@ -58,7 +58,7 @@ static void sp_tref_class_init(SPTRefClass *tref_class); static void sp_tref_init(SPTRef *tref); static void sp_tref_finalize(GObject *obj); -static void sp_tref_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_tref_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); static void sp_tref_release(SPObject *object); static void sp_tref_set(SPObject *object, unsigned int key, gchar const *value); static void sp_tref_update(SPObject *object, SPCtx *ctx, guint flags); @@ -148,7 +148,7 @@ sp_tref_finalize(GObject *obj) * Reads the Inkscape::XML::Node, and initializes SPTRef variables. */ static void -sp_tref_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +sp_tref_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) tref_parent_class)->build) { ((SPObjectClass *) tref_parent_class)->build(object, document, repr); @@ -585,7 +585,7 @@ sp_tref_convert_to_tspan(SPObject *obj) Inkscape::XML::Node *tref_repr = SP_OBJECT_REPR(tref); Inkscape::XML::Node *tref_parent = sp_repr_parent(tref_repr); - SPDocument *document = SP_OBJECT(tref)->document; + Document *document = SP_OBJECT(tref)->document; Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document); Inkscape::XML::Node *new_tspan_repr = xml_doc->createElement("svg:tspan"); diff --git a/src/sp-tspan.cpp b/src/sp-tspan.cpp index 89a86218e..a35ceae72 100644 --- a/src/sp-tspan.cpp +++ b/src/sp-tspan.cpp @@ -52,7 +52,7 @@ static void sp_tspan_class_init(SPTSpanClass *classname); static void sp_tspan_init(SPTSpan *tspan); -static void sp_tspan_build(SPObject * object, SPDocument * document, Inkscape::XML::Node * repr); +static void sp_tspan_build(SPObject * object, Document * document, Inkscape::XML::Node * repr); static void sp_tspan_release(SPObject *object); static void sp_tspan_set(SPObject *object, unsigned key, gchar const *value); static void sp_tspan_update(SPObject *object, SPCtx *ctx, guint flags); @@ -129,7 +129,7 @@ sp_tspan_release(SPObject *object) } static void -sp_tspan_build(SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr) +sp_tspan_build(SPObject *object, Document *doc, Inkscape::XML::Node *repr) { //SPTSpan *tspan = SP_TSPAN(object); @@ -293,7 +293,7 @@ static void sp_textpath_class_init(SPTextPathClass *classname); static void sp_textpath_init(SPTextPath *textpath); static void sp_textpath_finalize(GObject *obj); -static void sp_textpath_build(SPObject * object, SPDocument * document, Inkscape::XML::Node * repr); +static void sp_textpath_build(SPObject * object, Document * document, Inkscape::XML::Node * repr); static void sp_textpath_release(SPObject *object); static void sp_textpath_set(SPObject *object, unsigned key, gchar const *value); static void sp_textpath_update(SPObject *object, SPCtx *ctx, guint flags); @@ -388,7 +388,7 @@ sp_textpath_release(SPObject *object) } static void -sp_textpath_build(SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr) +sp_textpath_build(SPObject *object, Document *doc, Inkscape::XML::Node *repr) { //SPTextPath *textpath = SP_TEXTPATH(object); diff --git a/src/sp-use.cpp b/src/sp-use.cpp index 76930086c..5e3c7ee10 100644 --- a/src/sp-use.cpp +++ b/src/sp-use.cpp @@ -44,7 +44,7 @@ static void sp_use_class_init(SPUseClass *classname); static void sp_use_init(SPUse *use); static void sp_use_finalize(GObject *obj); -static void sp_use_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_use_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); static void sp_use_release(SPObject *object); static void sp_use_set(SPObject *object, unsigned key, gchar const *value); static Inkscape::XML::Node *sp_use_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); @@ -154,7 +154,7 @@ sp_use_finalize(GObject *obj) } static void -sp_use_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +sp_use_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) parent_class)->build) { (* ((SPObjectClass *) parent_class)->build)(object, document, repr); @@ -666,7 +666,7 @@ sp_use_unlink(SPUse *use) if (!repr) return NULL; Inkscape::XML::Node *parent = sp_repr_parent(repr); - SPDocument *document = SP_OBJECT(use)->document; + Document *document = SP_OBJECT(use)->document; Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document); // Track the ultimate source of a chain of uses. diff --git a/src/splivarot.cpp b/src/splivarot.cpp index feba2cab6..87f3dd890 100644 --- a/src/splivarot.cpp +++ b/src/splivarot.cpp @@ -602,7 +602,7 @@ sp_selected_path_boolop(SPDesktop *desktop, bool_op bop, const unsigned int verb static void sp_selected_path_outline_add_marker( SPObject *marker_object, Geom::Matrix marker_transform, Geom::Scale stroke_scale, Geom::Matrix transform, - Inkscape::XML::Node *g_repr, Inkscape::XML::Document *xml_doc, SPDocument * doc ) + Inkscape::XML::Node *g_repr, Inkscape::XML::Document *xml_doc, Document * doc ) { SPMarker* marker = SP_MARKER (marker_object); SPItem* marker_item = sp_item_first_item_child (SP_OBJECT (marker_object)); @@ -813,7 +813,7 @@ sp_selected_path_outline(SPDesktop *desktop) if (res->descr_cmd.size() > 1) { // if there's 0 or 1 node left, drop this path altogether - SPDocument * doc = sp_desktop_document(desktop); + Document * doc = sp_desktop_document(desktop); Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc); Inkscape::XML::Node *repr = xml_doc->createElement("svg:path"); diff --git a/src/style-test.h b/src/style-test.h index a2d5fcf24..7ebbf08be 100644 --- a/src/style-test.h +++ b/src/style-test.h @@ -11,7 +11,7 @@ class StyleTest : public CxxTest::TestSuite { public: - SPDocument* _doc; + Document* _doc; StyleTest() : _doc(0) diff --git a/src/style.cpp b/src/style.cpp index dd8169282..e564aa60b 100644 --- a/src/style.cpp +++ b/src/style.cpp @@ -84,10 +84,10 @@ static void sp_style_read_istring(SPIString *val, gchar const *str); static void sp_style_read_ilength(SPILength *val, gchar const *str); static void sp_style_read_ilengthornormal(SPILengthOrNormal *val, gchar const *str); static void sp_style_read_itextdecoration(SPITextDecoration *val, gchar const *str); -static void sp_style_read_icolor(SPIPaint *paint, gchar const *str, SPStyle *style, SPDocument *document); -static void sp_style_read_ipaint(SPIPaint *paint, gchar const *str, SPStyle *style, SPDocument *document); +static void sp_style_read_icolor(SPIPaint *paint, gchar const *str, SPStyle *style, Document *document); +static void sp_style_read_ipaint(SPIPaint *paint, gchar const *str, SPStyle *style, Document *document); static void sp_style_read_ifontsize(SPIFontSize *val, gchar const *str); -static void sp_style_read_ifilter(gchar const *str, SPStyle *style, SPDocument *document); +static void sp_style_read_ifilter(gchar const *str, SPStyle *style, Document *document); static void sp_style_read_penum(SPIEnum *val, Inkscape::XML::Node *repr, gchar const *key, SPStyleEnum const *dict, bool can_explicitly_inherit); static void sp_style_read_plength(SPILength *val, Inkscape::XML::Node *repr, gchar const *key); @@ -443,7 +443,7 @@ sp_style_stroke_paint_server_ref_changed(SPObject *old_ref, SPObject *ref, SPSty * Returns a new SPStyle object with settings as per sp_style_clear(). */ SPStyle * -sp_style_new(SPDocument *document) +sp_style_new(Document *document) { SPStyle *const style = g_new0(SPStyle, 1); @@ -1086,7 +1086,7 @@ sp_style_merge_property(SPStyle *style, gint id, gchar const *val) break; } case SP_PROP_MARKER: - /* TODO: Call sp_uri_reference_resolve(SPDocument *document, guchar const *uri) */ + /* TODO: Call sp_uri_reference_resolve(Document *document, guchar const *uri) */ /* style->marker[SP_MARKER_LOC] = g_quark_from_string(val); */ if (!style->marker[SP_MARKER_LOC].set) { g_free(style->marker[SP_MARKER_LOC].value); @@ -1097,7 +1097,7 @@ sp_style_merge_property(SPStyle *style, gint id, gchar const *val) break; case SP_PROP_MARKER_START: - /* TODO: Call sp_uri_reference_resolve(SPDocument *document, guchar const *uri) */ + /* TODO: Call sp_uri_reference_resolve(Document *document, guchar const *uri) */ if (!style->marker[SP_MARKER_LOC_START].set) { g_free(style->marker[SP_MARKER_LOC_START].value); style->marker[SP_MARKER_LOC_START].value = g_strdup(val); @@ -1106,7 +1106,7 @@ sp_style_merge_property(SPStyle *style, gint id, gchar const *val) } break; case SP_PROP_MARKER_MID: - /* TODO: Call sp_uri_reference_resolve(SPDocument *document, guchar const *uri) */ + /* TODO: Call sp_uri_reference_resolve(Document *document, guchar const *uri) */ if (!style->marker[SP_MARKER_LOC_MID].set) { g_free(style->marker[SP_MARKER_LOC_MID].value); style->marker[SP_MARKER_LOC_MID].value = g_strdup(val); @@ -1115,7 +1115,7 @@ sp_style_merge_property(SPStyle *style, gint id, gchar const *val) } break; case SP_PROP_MARKER_END: - /* TODO: Call sp_uri_reference_resolve(SPDocument *document, guchar const *uri) */ + /* TODO: Call sp_uri_reference_resolve(Document *document, guchar const *uri) */ if (!style->marker[SP_MARKER_LOC_END].set) { g_free(style->marker[SP_MARKER_LOC_END].value); style->marker[SP_MARKER_LOC_END].value = g_strdup(val); @@ -2111,7 +2111,7 @@ sp_style_merge_from_dying_parent(SPStyle *const style, SPStyle const *const pare static void -sp_style_set_ipaint_to_uri(SPStyle *style, SPIPaint *paint, const Inkscape::URI *uri, SPDocument *document) +sp_style_set_ipaint_to_uri(SPStyle *style, SPIPaint *paint, const Inkscape::URI *uri, Document *document) { // it may be that this style's SPIPaint has not yet created its URIReference; // now that we have a document, we can create it here @@ -2561,7 +2561,7 @@ sp_style_clear(SPStyle *style) /** \todo fixme: Do that text manipulation via parents */ SPObject *object = style->object; - SPDocument *document = style->document; + Document *document = style->document; gint const refcount = style->refcount; SPTextStyle *text = style->text; unsigned const text_private = style->text_private; @@ -3089,7 +3089,7 @@ sp_style_read_itextdecoration(SPITextDecoration *val, gchar const *str) * \param document Ignored */ static void -sp_style_read_icolor(SPIPaint *paint, gchar const *str, SPStyle *style, SPDocument *document) +sp_style_read_icolor(SPIPaint *paint, gchar const *str, SPStyle *style, Document *document) { (void)style; // TODO (void)document; // TODO @@ -3114,7 +3114,7 @@ sp_style_read_icolor(SPIPaint *paint, gchar const *str, SPStyle *style, SPDocume * \pre paint == \&style.fill || paint == \&style.stroke. */ static void -sp_style_read_ipaint(SPIPaint *paint, gchar const *str, SPStyle *style, SPDocument *document) +sp_style_read_ipaint(SPIPaint *paint, gchar const *str, SPStyle *style, Document *document) { while (g_ascii_isspace(*str)) { ++str; @@ -3248,7 +3248,7 @@ sp_style_read_ifontsize(SPIFontSize *val, gchar const *str) * Set SPIFilter object from string. */ static void -sp_style_read_ifilter(gchar const *str, SPStyle * style, SPDocument *document) +sp_style_read_ifilter(gchar const *str, SPStyle * style, Document *document) { SPIFilter *f = &(style->filter); /* Try all possible values: inherit, none, uri */ diff --git a/src/style.h b/src/style.h index d5ccc4901..87d427547 100644 --- a/src/style.h +++ b/src/style.h @@ -243,7 +243,7 @@ struct SPStyle { /** Object we are attached to */ SPObject *object; /** Document we are associated with */ - SPDocument *document; + Document *document; /** Our text style component */ SPTextStyle *text; @@ -372,7 +372,7 @@ struct SPStyle { const gchar *getStrokeURI() {if (stroke.value.href) return stroke.value.href->getURI()->toString(); else return NULL;} }; -SPStyle *sp_style_new(SPDocument *document); +SPStyle *sp_style_new(Document *document); SPStyle *sp_style_new_from_object(SPObject *object); diff --git a/src/svg-view-widget.cpp b/src/svg-view-widget.cpp index 10d997656..5c33075c9 100644 --- a/src/svg-view-widget.cpp +++ b/src/svg-view-widget.cpp @@ -205,7 +205,7 @@ sp_svg_view_widget_view_resized (SPViewWidget *vw, Inkscape::UI::View::View */*v * Constructs new SPSVGSPViewWidget object and returns pointer to it. */ GtkWidget * -sp_svg_view_widget_new (SPDocument *doc) +sp_svg_view_widget_new (Document *doc) { GtkWidget *widget; diff --git a/src/svg-view-widget.h b/src/svg-view-widget.h index cd609b07a..9f6410f67 100644 --- a/src/svg-view-widget.h +++ b/src/svg-view-widget.h @@ -16,7 +16,7 @@ #include "display/display-forward.h" #include "ui/view/view-widget.h" -class SPDocument; +class Document; class SPSVGSPViewWidget; class SPSVGSPViewWidgetClass; @@ -28,7 +28,7 @@ class SPSVGSPViewWidgetClass; GtkType sp_svg_view_widget_get_type (void); -GtkWidget *sp_svg_view_widget_new (SPDocument *doc); +GtkWidget *sp_svg_view_widget_new (Document *doc); void sp_svg_view_widget_set_resize (SPSVGSPViewWidget *vw, bool resize, gdouble width, gdouble height); diff --git a/src/svg-view.cpp b/src/svg-view.cpp index bd46dd17a..35a51cfcd 100644 --- a/src/svg-view.cpp +++ b/src/svg-view.cpp @@ -188,7 +188,7 @@ arena_handler (SPCanvasArena */*arena*/, NRArenaItem *ai, GdkEvent *event, SPSVG * Callback connected with set_document signal. */ void -SPSVGView::setDocument (SPDocument *document) +SPSVGView::setDocument (Document *document) { if (doc()) { sp_item_invoke_hide (SP_ITEM (sp_document_root (doc())), _dkey); diff --git a/src/svg-view.h b/src/svg-view.h index 838a95b03..ab59ca417 100644 --- a/src/svg-view.h +++ b/src/svg-view.h @@ -47,7 +47,7 @@ public: void doRescale (bool event); - virtual void setDocument (SPDocument*); + virtual void setDocument (Document*); virtual void mouseover(); virtual void mouseout(); virtual bool shutdown() { return true; } diff --git a/src/test-helpers.h b/src/test-helpers.h index 8dba0c942..3eacb7d13 100644 --- a/src/test-helpers.h +++ b/src/test-helpers.h @@ -32,7 +32,7 @@ T* createSuiteAndDocument( void (*fun)(T*&) ) static_cast(g_object_new(inkscape_get_type(), NULL)); } - SPDocument* tmp = sp_document_new( NULL, TRUE, true ); + Document* tmp = sp_document_new( NULL, TRUE, true ); if ( tmp ) { fun( suite ); if ( suite ) diff --git a/src/text-chemistry.cpp b/src/text-chemistry.cpp index f574b69fb..61960086a 100644 --- a/src/text-chemistry.cpp +++ b/src/text-chemistry.cpp @@ -301,7 +301,7 @@ text_flow_into_shape() if (!desktop) return; - SPDocument *doc = sp_desktop_document (desktop); + Document *doc = sp_desktop_document (desktop); Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc); Inkscape::Selection *selection = sp_desktop_selection(desktop); @@ -393,7 +393,7 @@ text_unflow () if (!desktop) return; - SPDocument *doc = sp_desktop_document (desktop); + Document *doc = sp_desktop_document (desktop); Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc); Inkscape::Selection *selection = sp_desktop_selection(desktop); diff --git a/src/tweak-context.cpp b/src/tweak-context.cpp index 3f55d040b..692e22112 100644 --- a/src/tweak-context.cpp +++ b/src/tweak-context.cpp @@ -415,7 +415,7 @@ sp_tweak_dilate_recursive (Inkscape::Selection *selection, SPItem *item, Geom::P GSList *items = g_slist_prepend (NULL, item); GSList *selected = NULL; GSList *to_select = NULL; - SPDocument *doc = SP_OBJECT_DOCUMENT(item); + Document *doc = SP_OBJECT_DOCUMENT(item); sp_item_list_to_curves (items, &selected, &to_select); g_slist_free (items); SPObject* newObj = doc->getObjectByRepr((Inkscape::XML::Node *) to_select->data); @@ -524,7 +524,7 @@ sp_tweak_dilate_recursive (Inkscape::Selection *selection, SPItem *item, Geom::P SP_OBJECT(item)->deleteObject(true, true); sp_object_unref(SP_OBJECT(item), NULL); } else { // duplicate - SPDocument *doc = SP_OBJECT_DOCUMENT(item); + Document *doc = SP_OBJECT_DOCUMENT(item); Inkscape::XML::Document* xml_doc = sp_document_repr_doc(doc); Inkscape::XML::Node *old_repr = SP_OBJECT_REPR(item); SPObject *old_obj = doc->getObjectByRepr(old_repr); diff --git a/src/uri-references.cpp b/src/uri-references.cpp index d979fe292..33d599180 100644 --- a/src/uri-references.cpp +++ b/src/uri-references.cpp @@ -32,7 +32,7 @@ URIReference::URIReference(SPObject *owner) /* FIXME !!! attach to owner's destroy signal to clean up in case */ } -URIReference::URIReference(SPDocument *owner_document) +URIReference::URIReference(Document *owner_document) : _owner(NULL), _owner_document(owner_document), _obj(NULL), _uri(NULL) { g_assert(_owner_document != NULL); @@ -45,7 +45,7 @@ URIReference::~URIReference() void URIReference::attach(const URI &uri) throw(BadURIException) { - SPDocument *document; + Document *document; if (_owner) { document = SP_OBJECT_DOCUMENT(_owner); } else if (_owner_document) { @@ -142,7 +142,7 @@ void URIReference::_release(SPObject *obj) -SPObject* sp_css_uri_reference_resolve( SPDocument *document, const gchar *uri ) +SPObject* sp_css_uri_reference_resolve( Document *document, const gchar *uri ) { SPObject* ref = 0; @@ -158,7 +158,7 @@ SPObject* sp_css_uri_reference_resolve( SPDocument *document, const gchar *uri ) } SPObject * -sp_uri_reference_resolve (SPDocument *document, const gchar *uri) +sp_uri_reference_resolve (Document *document, const gchar *uri) { SPObject* ref = 0; diff --git a/src/uri-references.h b/src/uri-references.h index a98c84153..0f7a724ba 100644 --- a/src/uri-references.h +++ b/src/uri-references.h @@ -41,7 +41,7 @@ public: * is holding a reference to the target object. */ URIReference(SPObject *owner); - URIReference(SPDocument *owner_document); + URIReference(Document *owner_document); /** * Destructor. Calls shutdown() if the reference has not been @@ -114,7 +114,7 @@ public: return (bool)_uri; } - SPDocument *getOwnerDocument() { return _owner_document; } + Document *getOwnerDocument() { return _owner_document; } SPObject *getOwnerObject() { return _owner; } protected: @@ -125,7 +125,7 @@ protected: private: SPObject *_owner; - SPDocument *_owner_document; + Document *_owner_document; sigc::connection _connection; sigc::connection _release_connection; SPObject *_obj; @@ -145,8 +145,8 @@ private: /** * Resolves an item referenced by a URI in CSS form contained in "url(...)" */ -SPObject* sp_css_uri_reference_resolve( SPDocument *document, const gchar *uri ); +SPObject* sp_css_uri_reference_resolve( Document *document, const gchar *uri ); -SPObject *sp_uri_reference_resolve (SPDocument *document, const gchar *uri); +SPObject *sp_uri_reference_resolve (Document *document, const gchar *uri); #endif diff --git a/src/vanishing-point.cpp b/src/vanishing-point.cpp index ab46b21a6..133311625 100644 --- a/src/vanishing-point.cpp +++ b/src/vanishing-point.cpp @@ -462,7 +462,7 @@ VPDragger::printVPs() { } } -VPDrag::VPDrag (SPDocument *document) +VPDrag::VPDrag (Document *document) { this->document = document; this->selection = sp_desktop_selection(inkscape_active_desktop()); diff --git a/src/vanishing-point.h b/src/vanishing-point.h index 9fcb6bb46..311315404 100644 --- a/src/vanishing-point.h +++ b/src/vanishing-point.h @@ -158,14 +158,14 @@ public: struct VPDrag { public: - VPDrag(SPDocument *document); + VPDrag(Document *document); ~VPDrag(); VPDragger *getDraggerFor (VanishingPoint const &vp); bool dragging; - SPDocument *document; + Document *document; GList *draggers; GSList *lines; diff --git a/src/verbs.cpp b/src/verbs.cpp index 43ddc1459..10f4f3acc 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -607,7 +607,7 @@ Verb::get_action(Inkscape::UI::View::View *view) } void -Verb::sensitive(SPDocument *in_doc, bool in_sensitive) +Verb::sensitive(Document *in_doc, bool in_sensitive) { // printf("Setting sensitivity of \"%s\" to %d\n", _name, in_sensitive); if (_actions != NULL) { @@ -635,7 +635,7 @@ Verb::get_tip (void) } void -Verb::name(SPDocument *in_doc, Glib::ustring in_name) +Verb::name(Document *in_doc, Glib::ustring in_name) { if (_actions != NULL) { for (ActionTable::iterator cur_action = _actions->begin(); @@ -759,7 +759,7 @@ FileVerb::perform(SPAction *action, void *data, void */*pdata*/) /* These aren't used, but are here to remind people not to use the CURRENT_DOCUMENT macros unless they really have to. */ Inkscape::UI::View::View *current_view = sp_action_get_view(action); - SPDocument *current_document = current_view->doc(); + Document *current_document = current_view->doc(); #endif SPDesktop *desktop = dynamic_cast(sp_action_get_view(action)); @@ -1605,7 +1605,7 @@ TextVerb::perform(SPAction *action, void */*data*/, void */*pdata*/) if (!dt) return; - SPDocument *doc = sp_desktop_document(dt); + Document *doc = sp_desktop_document(dt); (void)doc; Inkscape::XML::Node *repr = SP_OBJECT_REPR(dt->namedview); (void)repr; @@ -1620,7 +1620,7 @@ ZoomVerb::perform(SPAction *action, void *data, void */*pdata*/) return; SPEventContext *ec = dt->event_context; - SPDocument *doc = sp_desktop_document(dt); + Document *doc = sp_desktop_document(dt); Inkscape::XML::Node *repr = SP_OBJECT_REPR(dt->namedview); @@ -2066,7 +2066,7 @@ EffectLastVerb::perform(SPAction *action, void *data, void */*pdata*/) /* These aren't used, but are here to remind people not to use the CURRENT_DOCUMENT macros unless they really have to. */ Inkscape::UI::View::View *current_view = sp_action_get_view(action); - // SPDocument *current_document = SP_VIEW_DOCUMENT(current_view); + // Document *current_document = SP_VIEW_DOCUMENT(current_view); Inkscape::Extension::Effect *effect = Inkscape::Extension::Effect::get_last_effect(); if (effect == NULL) return; @@ -2134,7 +2134,7 @@ FitCanvasVerb::perform(SPAction *action, void *data, void */*pdata*/) { SPDesktop *dt = static_cast(sp_action_get_view(action)); if (!dt) return; - SPDocument *doc = sp_desktop_document(dt); + Document *doc = sp_desktop_document(dt); if (!doc) return; switch ((long) data) { @@ -2203,7 +2203,7 @@ LockAndHideVerb::perform(SPAction *action, void *data, void */*pdata*/) { SPDesktop *dt = static_cast(sp_action_get_view(action)); if (!dt) return; - SPDocument *doc = sp_desktop_document(dt); + Document *doc = sp_desktop_document(dt); if (!doc) return; switch ((long) data) { diff --git a/src/verbs.h b/src/verbs.h index c3b88918b..51bf0e34b 100644 --- a/src/verbs.h +++ b/src/verbs.h @@ -437,8 +437,8 @@ public: static void delete_all_view (Inkscape::UI::View::View * view); void delete_view (Inkscape::UI::View::View * view); - void sensitive (SPDocument * in_doc = NULL, bool in_sensitive = true); - void name (SPDocument * in_doc = NULL, Glib::ustring in_name = ""); + void sensitive (Document * in_doc = NULL, bool in_sensitive = true); + void name (Document * in_doc = NULL, Glib::ustring in_name = ""); // Yes, multiple public, protected and private sections are bad. We'll clean that up later protected: diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index a2f88c16d..fc2e82722 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -820,7 +820,7 @@ SPDesktopWidget::shutdown() g_assert(desktop != NULL); if (inkscape_is_sole_desktop_for_document(*desktop)) { - SPDocument *doc = desktop->doc(); + Document *doc = desktop->doc(); if (doc->isModifiedSinceSave()) { GtkWidget *dialog; @@ -1721,7 +1721,7 @@ sp_desktop_widget_update_scrollbars (SPDesktopWidget *dtw, double scale) dtw->update = 1; /* The desktop region we always show unconditionally */ - SPDocument *doc = dtw->desktop->doc(); + Document *doc = dtw->desktop->doc(); Geom::Rect darea ( Geom::Point(-sp_document_width(doc), -sp_document_height(doc)), Geom::Point(2 * sp_document_width(doc), 2 * sp_document_height(doc)) ); SPObject* root = doc->root; diff --git a/src/widgets/fill-style.cpp b/src/widgets/fill-style.cpp index 5e9d30bcd..683b041b0 100644 --- a/src/widgets/fill-style.cpp +++ b/src/widgets/fill-style.cpp @@ -355,7 +355,7 @@ sp_fill_style_widget_paint_changed ( SPPaintSelector *psel, if (!desktop) { return; } - SPDocument *document = sp_desktop_document (desktop); + Document *document = sp_desktop_document (desktop); Inkscape::Selection *selection = sp_desktop_selection (desktop); GSList const *items = selection->itemList(); diff --git a/src/widgets/gradient-selector.cpp b/src/widgets/gradient-selector.cpp index f24a6781b..15b65c239 100644 --- a/src/widgets/gradient-selector.cpp +++ b/src/widgets/gradient-selector.cpp @@ -248,7 +248,7 @@ sp_gradient_selector_get_spread (SPGradientSelector *sel) } void -sp_gradient_selector_set_vector (SPGradientSelector *sel, SPDocument *doc, SPGradient *vector) +sp_gradient_selector_set_vector (SPGradientSelector *sel, Document *doc, SPGradient *vector) { g_return_if_fail (sel != NULL); g_return_if_fail (SP_IS_GRADIENT_SELECTOR (sel)); @@ -307,7 +307,7 @@ sp_gradient_selector_edit_vector_clicked (GtkWidget */*w*/, SPGradientSelector * static void sp_gradient_selector_add_vector_clicked (GtkWidget */*w*/, SPGradientSelector *sel) { - SPDocument *doc = sp_gradient_vector_selector_get_document ( + Document *doc = sp_gradient_vector_selector_get_document ( SP_GRADIENT_VECTOR_SELECTOR (sel->vectors)); if (!doc) diff --git a/src/widgets/gradient-selector.h b/src/widgets/gradient-selector.h index e68dfecfc..63e18554d 100644 --- a/src/widgets/gradient-selector.h +++ b/src/widgets/gradient-selector.h @@ -68,7 +68,7 @@ GtkWidget *sp_gradient_selector_new (void); void sp_gradient_selector_set_mode (SPGradientSelector *sel, guint mode); void sp_gradient_selector_set_units (SPGradientSelector *sel, guint units); void sp_gradient_selector_set_spread (SPGradientSelector *sel, guint spread); -void sp_gradient_selector_set_vector (SPGradientSelector *sel, SPDocument *doc, SPGradient *vector); +void sp_gradient_selector_set_vector (SPGradientSelector *sel, Document *doc, SPGradient *vector); void sp_gradient_selector_set_bbox (SPGradientSelector *sel, gdouble x0, gdouble y0, gdouble x1, gdouble y1); SPGradientUnits sp_gradient_selector_get_units (SPGradientSelector *sel); diff --git a/src/widgets/gradient-toolbar.cpp b/src/widgets/gradient-toolbar.cpp index ddd9fd96a..f64dc7bd8 100644 --- a/src/widgets/gradient-toolbar.cpp +++ b/src/widgets/gradient-toolbar.cpp @@ -167,7 +167,7 @@ gr_prepare_label (SPObject *obj) GtkWidget * gr_vector_list (SPDesktop *desktop, bool selection_empty, SPGradient *gr_selected, bool gr_multi) { - SPDocument *document = sp_desktop_document (desktop); + Document *document = sp_desktop_document (desktop); GtkWidget *om = gtk_option_menu_new (); GtkWidget *m = gtk_menu_new (); @@ -435,7 +435,7 @@ GtkWidget * gr_change_widget (SPDesktop *desktop) { Inkscape::Selection *selection = sp_desktop_selection (desktop); - SPDocument *document = sp_desktop_document (desktop); + Document *document = sp_desktop_document (desktop); SPEventContext *ev = sp_desktop_event_context (desktop); SPGradient *gr_selected = NULL; diff --git a/src/widgets/gradient-vector.cpp b/src/widgets/gradient-vector.cpp index 1f0c07754..c6a7b37f4 100644 --- a/src/widgets/gradient-vector.cpp +++ b/src/widgets/gradient-vector.cpp @@ -155,7 +155,7 @@ sp_gradient_vector_selector_destroy (GtkObject *object) } GtkWidget * -sp_gradient_vector_selector_new (SPDocument *doc, SPGradient *gr) +sp_gradient_vector_selector_new (Document *doc, SPGradient *gr) { GtkWidget *gvs; @@ -174,7 +174,7 @@ sp_gradient_vector_selector_new (SPDocument *doc, SPGradient *gr) } void -sp_gradient_vector_selector_set_gradient (SPGradientVectorSelector *gvs, SPDocument *doc, SPGradient *gr) +sp_gradient_vector_selector_set_gradient (SPGradientVectorSelector *gvs, Document *doc, SPGradient *gr) { static gboolean suppress = FALSE; @@ -220,7 +220,7 @@ sp_gradient_vector_selector_set_gradient (SPGradientVectorSelector *gvs, SPDocum /* The case of setting NULL -> NULL is not very interesting */ } -SPDocument * +Document * sp_gradient_vector_selector_get_document (SPGradientVectorSelector *gvs) { g_return_val_if_fail (gvs != NULL, NULL); @@ -1037,7 +1037,7 @@ sp_gradient_vector_widget_load_gradient (GtkWidget *widget, SPGradient *gradient // Once the user edits a gradient, it stops being auto-collectable if (SP_OBJECT_REPR(gradient)->attribute("inkscape:collect")) { - SPDocument *document = SP_OBJECT_DOCUMENT (gradient); + Document *document = SP_OBJECT_DOCUMENT (gradient); bool saved = sp_document_get_undo_sensitive(document); sp_document_set_undo_sensitive (document, false); SP_OBJECT_REPR(gradient)->setAttribute("inkscape:collect", NULL); diff --git a/src/widgets/gradient-vector.h b/src/widgets/gradient-vector.h index ea1f5159f..aa5444755 100644 --- a/src/widgets/gradient-vector.h +++ b/src/widgets/gradient-vector.h @@ -31,7 +31,7 @@ struct SPGradientVectorSelector { guint idlabel : 1; - SPDocument *doc; + Document *doc; SPGradient *gr; /* Vector menu */ @@ -50,11 +50,11 @@ struct SPGradientVectorSelectorClass { GType sp_gradient_vector_selector_get_type(void); -GtkWidget *sp_gradient_vector_selector_new (SPDocument *doc, SPGradient *gradient); +GtkWidget *sp_gradient_vector_selector_new (Document *doc, SPGradient *gradient); -void sp_gradient_vector_selector_set_gradient (SPGradientVectorSelector *gvs, SPDocument *doc, SPGradient *gr); +void sp_gradient_vector_selector_set_gradient (SPGradientVectorSelector *gvs, Document *doc, SPGradient *gr); -SPDocument *sp_gradient_vector_selector_get_document (SPGradientVectorSelector *gvs); +Document *sp_gradient_vector_selector_get_document (SPGradientVectorSelector *gvs); SPGradient *sp_gradient_vector_selector_get_gradient (SPGradientVectorSelector *gvs); /* fixme: rethink this (Lauris) */ diff --git a/src/widgets/icon.cpp b/src/widgets/icon.cpp index 6be4b49b3..5e47bd8e4 100644 --- a/src/widgets/icon.cpp +++ b/src/widgets/icon.cpp @@ -908,7 +908,7 @@ GdkPixbuf *sp_icon_image_load_pixmap(gchar const *name, unsigned /*lsize*/, unsi // takes doc, root, icon, and icon name to produce pixels extern "C" guchar * -sp_icon_doc_icon( SPDocument *doc, NRArenaItem *root, +sp_icon_doc_icon( Document *doc, NRArenaItem *root, gchar const *name, unsigned psize ) { bool const dump = Inkscape::Preferences::get()->getBool("/debug/icons/dumpSvg"); @@ -1038,7 +1038,7 @@ sp_icon_doc_icon( SPDocument *doc, NRArenaItem *root, struct svg_doc_cache_t { - SPDocument *doc; + Document *doc; NRArenaItem *root; }; @@ -1081,7 +1081,7 @@ static std::list &icons_svg_paths() static guchar *load_svg_pixels(gchar const *name, unsigned /*lsize*/, unsigned psize) { - SPDocument *doc = NULL; + Document *doc = NULL; NRArenaItem *root = NULL; svg_doc_cache_t *info = NULL; diff --git a/src/widgets/paint-selector.cpp b/src/widgets/paint-selector.cpp index a101b9eeb..d203e094f 100644 --- a/src/widgets/paint-selector.cpp +++ b/src/widgets/paint-selector.cpp @@ -747,7 +747,7 @@ sp_psel_pattern_change(GtkWidget *widget, SPPaintSelector *psel) * Returns NULL if there are no patterns in the document. */ GSList * -ink_pattern_list_get (SPDocument *source) +ink_pattern_list_get (Document *source) { if (source == NULL) return NULL; @@ -768,7 +768,7 @@ ink_pattern_list_get (SPDocument *source) * Adds menu items for pattern list - derived from marker code, left hb etc in to make addition of previews easier at some point. */ static void -sp_pattern_menu_build (GtkWidget *m, GSList *pattern_list, SPDocument */*source*/) +sp_pattern_menu_build (GtkWidget *m, GSList *pattern_list, Document */*source*/) { for (; pattern_list != NULL; pattern_list = pattern_list->next) { @@ -813,7 +813,7 @@ sp_pattern_menu_build (GtkWidget *m, GSList *pattern_list, SPDocument */*source* * */ static void -sp_pattern_list_from_doc (GtkWidget *m, SPDocument *current_doc, SPDocument *source, SPDocument *pattern_doc) +sp_pattern_list_from_doc (GtkWidget *m, Document *current_doc, Document *source, Document *pattern_doc) { (void)current_doc; (void)pattern_doc; @@ -838,9 +838,9 @@ sp_pattern_list_from_doc (GtkWidget *m, SPDocument *current_doc, SPDocument *sou static void -ink_pattern_menu_populate_menu(GtkWidget *m, SPDocument *doc) +ink_pattern_menu_populate_menu(GtkWidget *m, Document *doc) { - static SPDocument *patterns_doc = NULL; + static Document *patterns_doc = NULL; // find and load patterns.svg if (patterns_doc == NULL) { @@ -878,7 +878,7 @@ ink_pattern_menu(GtkWidget *mnu) /* Create new menu widget */ GtkWidget *m = gtk_menu_new(); gtk_widget_show(m); - SPDocument *doc = SP_ACTIVE_DOCUMENT; + Document *doc = SP_ACTIVE_DOCUMENT; if (!doc) { GtkWidget *i; diff --git a/src/widgets/select-toolbar.cpp b/src/widgets/select-toolbar.cpp index f168cedeb..6d28f80e5 100644 --- a/src/widgets/select-toolbar.cpp +++ b/src/widgets/select-toolbar.cpp @@ -153,7 +153,7 @@ sp_object_layout_any_value_changed(GtkAdjustment *adj, SPWidget *spw) SPDesktop *desktop = SP_ACTIVE_DESKTOP; Inkscape::Selection *selection = sp_desktop_selection(desktop); - SPDocument *document = sp_desktop_document(desktop); + Document *document = sp_desktop_document(desktop); sp_document_ensure_up_to_date (document); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); diff --git a/src/widgets/stroke-style.cpp b/src/widgets/stroke-style.cpp index f502f87d3..e0002e5c2 100644 --- a/src/widgets/stroke-style.cpp +++ b/src/widgets/stroke-style.cpp @@ -81,7 +81,7 @@ sigc::connection marker_start_menu_connection; sigc::connection marker_mid_menu_connection; sigc::connection marker_end_menu_connection; -static SPObject *ink_extract_marker_name(gchar const *n, SPDocument *doc); +static SPObject *ink_extract_marker_name(gchar const *n, Document *doc); static void ink_markers_menu_update(Gtk::Container* spw, SPMarkerLoc const which); static Inkscape::UI::Cache::SvgPreview svg_preview_cache; @@ -307,7 +307,7 @@ sp_stroke_style_paint_changed(SPPaintSelector *psel, SPWidget *spw) g_object_set_data (G_OBJECT (spw), "update", GINT_TO_POINTER (TRUE)); SPDesktop *desktop = SP_ACTIVE_DESKTOP; - SPDocument *document = sp_desktop_document (desktop); + Document *document = sp_desktop_document (desktop); Inkscape::Selection *selection = sp_desktop_selection (desktop); GSList const *items = selection->itemList(); @@ -550,7 +550,7 @@ sp_stroke_style_widget_transientize_callback(Inkscape::Application */*inkscape*/ */ static Gtk::Image * sp_marker_prev_new(unsigned psize, gchar const *mname, - SPDocument *source, SPDocument *sandbox, + Document *source, Document *sandbox, gchar const *menu_id, NRArena const */*arena*/, unsigned /*visionkey*/, NRArenaItem *root) { // Retrieve the marker named 'mname' from the source SVG document @@ -617,7 +617,7 @@ sp_marker_prev_new(unsigned psize, gchar const *mname, * Returns NULL if there are no markers in the document. */ GSList * -ink_marker_list_get (SPDocument *source) +ink_marker_list_get (Document *source) { if (source == NULL) return NULL; @@ -641,7 +641,7 @@ ink_marker_list_get (SPDocument *source) * Adds previews of markers in marker_list to the given menu widget */ static void -sp_marker_menu_build (Gtk::Menu *m, GSList *marker_list, SPDocument *source, SPDocument *sandbox, gchar const *menu_id) +sp_marker_menu_build (Gtk::Menu *m, GSList *marker_list, Document *source, Document *sandbox, gchar const *menu_id) { // Do this here, outside of loop, to speed up preview generation: NRArena const *arena = NRArena::create(); @@ -695,7 +695,7 @@ sp_marker_menu_build (Gtk::Menu *m, GSList *marker_list, SPDocument *source, SPD * */ static void -sp_marker_list_from_doc (Gtk::Menu *m, SPDocument */*current_doc*/, SPDocument *source, SPDocument */*markers_doc*/, SPDocument *sandbox, gchar const *menu_id) +sp_marker_list_from_doc (Gtk::Menu *m, Document */*current_doc*/, Document *source, Document */*markers_doc*/, Document *sandbox, gchar const *menu_id) { GSList *ml = ink_marker_list_get(source); GSList *clean_ml = NULL; @@ -716,7 +716,7 @@ sp_marker_list_from_doc (Gtk::Menu *m, SPDocument */*current_doc*/, SPDocument * /** * Returns a new document containing default start, mid, and end markers. */ -SPDocument * +Document * ink_markers_preview_doc () { gchar const *buffer = "" @@ -749,9 +749,9 @@ gchar const *buffer = "(spw->get_data("miterlimit")); SPDesktop *desktop = SP_ACTIVE_DESKTOP; - SPDocument *document = sp_desktop_document (desktop); + Document *document = sp_desktop_document (desktop); Inkscape::Selection *selection = sp_desktop_selection (desktop); GSList const *items = selection->itemList(); @@ -1833,7 +1833,7 @@ sp_stroke_style_update_marker_menus(Gtk::Container *spw, GSList const *objects) * the caller should free the buffer when they no longer need it. */ static SPObject* -ink_extract_marker_name(gchar const *n, SPDocument *doc) +ink_extract_marker_name(gchar const *n, Document *doc) { gchar const *p = n; while (*p != '\0' && *p != '#') { diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index 8bb15ae6f..c13ad9ba6 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -1886,7 +1886,7 @@ void toggle_snap_callback (GtkToggleAction *act, gpointer data) { //data points SPDesktop *dt = reinterpret_cast(ptr); SPNamedView *nv = sp_desktop_namedview(dt); - SPDocument *doc = SP_OBJECT_DOCUMENT(nv); + Document *doc = SP_OBJECT_DOCUMENT(nv); if (dt == NULL || nv == NULL) { g_warning("No desktop or namedview specified (in toggle_snap_callback)!"); @@ -3327,7 +3327,7 @@ static void box3d_angle_value_changed(GtkAdjustment *adj, GObject *dataKludge, Proj::Axis axis) { SPDesktop *desktop = (SPDesktop *) g_object_get_data( dataKludge, "desktop" ); - SPDocument *document = sp_desktop_document(desktop); + Document *document = sp_desktop_document(desktop); // quit if run by the attr_changed or selection changed listener if (g_object_get_data( dataKludge, "freeze" )) { @@ -3407,7 +3407,7 @@ static void box3d_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); EgeAdjustmentAction* eact = 0; - SPDocument *document = sp_desktop_document (desktop); + Document *document = sp_desktop_document (desktop); Persp3D *persp = document->current_persp3d; EgeAdjustmentAction* box3d_angle_x = 0; @@ -6845,7 +6845,7 @@ static void sp_connector_path_set_ignore(void) static void connector_spacing_changed(GtkAdjustment *adj, GObject* tbl) { SPDesktop *desktop = (SPDesktop *) g_object_get_data( tbl, "desktop" ); - SPDocument *doc = sp_desktop_document(desktop); + Document *doc = sp_desktop_document(desktop); if (!sp_document_get_undo_sensitive(doc)) { diff --git a/src/xml/rebase-hrefs.h b/src/xml/rebase-hrefs.h index b4f288c4d..2f82a5587 100644 --- a/src/xml/rebase-hrefs.h +++ b/src/xml/rebase-hrefs.h @@ -4,14 +4,14 @@ #include #include "util/list.h" #include "xml/attribute-record.h" -struct SPDocument; +struct Document; namespace Inkscape { namespace XML { gchar *calc_abs_doc_base(gchar const *doc_base); -void rebase_hrefs(SPDocument *doc, gchar const *new_base, bool spns); +void rebase_hrefs(Document *doc, gchar const *new_base, bool spns); Inkscape::Util::List rebase_href_attrs( gchar const *old_abs_base, -- cgit v1.2.3 From a6fa3b454bdcef9b23e0a3107b6de6b4c6a477a0 Mon Sep 17 00:00:00 2001 From: johnce Date: Wed, 5 Aug 2009 05:56:35 +0000 Subject: SPDocument->Document (bzr r8405) --- src/application/editor.cpp | 16 ++++++------- src/bind/javabind.cpp | 2 +- src/dialogs/clonetiler.cpp | 4 ++-- src/dialogs/export.cpp | 16 ++++++------- src/dialogs/xml-tree.cpp | 14 +++++------ src/display/canvas-axonomgrid.cpp | 2 +- src/display/canvas-grid.cpp | 8 +++---- src/display/nr-filter-image.cpp | 2 +- src/extension/effect.cpp | 2 +- src/extension/execution-env.cpp | 2 +- src/extension/extension.cpp | 24 +++++++++---------- src/extension/input.cpp | 4 ++-- src/extension/output.cpp | 2 +- src/extension/patheffect.cpp | 4 ++-- src/extension/print.cpp | 2 +- src/extension/system.cpp | 6 ++--- src/filters/blend.cpp | 4 ++-- src/filters/colormatrix.cpp | 4 ++-- src/filters/componenttransfer-funcnode.cpp | 4 ++-- src/filters/componenttransfer.cpp | 4 ++-- src/filters/composite.cpp | 4 ++-- src/filters/convolvematrix.cpp | 4 ++-- src/filters/diffuselighting.cpp | 4 ++-- src/filters/displacementmap.cpp | 4 ++-- src/filters/distantlight.cpp | 4 ++-- src/filters/flood.cpp | 4 ++-- src/filters/image.cpp | 4 ++-- src/filters/merge.cpp | 4 ++-- src/filters/mergenode.cpp | 4 ++-- src/filters/morphology.cpp | 4 ++-- src/filters/offset.cpp | 4 ++-- src/filters/pointlight.cpp | 4 ++-- src/filters/specularlighting.cpp | 4 ++-- src/filters/spotlight.cpp | 4 ++-- src/filters/tile.cpp | 4 ++-- src/filters/turbulence.cpp | 4 ++-- src/helper/action.cpp | 2 +- src/helper/pixbuf-ops.cpp | 4 ++-- src/helper/png-write.cpp | 6 ++--- src/helper/stock-items.cpp | 22 ++++++++--------- src/jabber_whiteboard/session-manager.cpp | 10 ++++---- src/live_effects/effect.cpp | 6 ++--- src/live_effects/lpeobject.cpp | 4 ++-- src/trace/trace.cpp | 2 +- src/ui/clipboard.cpp | 38 +++++++++++++++--------------- src/xml/rebase-hrefs.cpp | 2 +- 46 files changed, 143 insertions(+), 143 deletions(-) (limited to 'src') diff --git a/src/application/editor.cpp b/src/application/editor.cpp index 49010efdc..730188bdd 100644 --- a/src/application/editor.cpp +++ b/src/application/editor.cpp @@ -18,7 +18,7 @@ #endif /* - TODO: Replace SPDocument with the new Inkscape::Document + TODO: Replace Document with the new Inkscape::Document TODO: Change 'desktop's to 'view*'s TODO: Add derivation from Inkscape::Application::RunMode */ @@ -76,7 +76,7 @@ Editor::init() // gchar const *tmpl = g_build_filename ((INKSCAPE_TEMPLATESDIR), "default.svg", NULL); bool have_default = Inkscape::IO::file_test (tmpl, G_FILE_TEST_IS_REGULAR); - SPDocument *doc = sp_document_new (have_default? tmpl:0, true, true); + Document *doc = sp_document_new (have_default? tmpl:0, true, true); g_return_val_if_fail (doc != 0, false); Inkscape::UI::View::EditWidget *ew = new Inkscape::UI::View::EditWidget (doc); sp_document_unref (doc); @@ -96,7 +96,7 @@ Editor::getWindow() } /// Returns the active document -SPDocument* +Document* Editor::getActiveDocument() { if (getActiveDesktop()) { @@ -107,7 +107,7 @@ Editor::getActiveDocument() } void -Editor::addDocument (SPDocument *doc) +Editor::addDocument (Document *doc) { if ( _instance->_document_set.find(doc) == _instance->_document_set.end() ) { _instance->_documents = g_slist_append (_instance->_documents, doc); @@ -116,7 +116,7 @@ Editor::addDocument (SPDocument *doc) } void -Editor::removeDocument (SPDocument *doc) +Editor::removeDocument (Document *doc) { _instance->_document_set.erase(doc); if ( _instance->_document_set.find(doc) == _instance->_document_set.end() ) { @@ -125,7 +125,7 @@ Editor::removeDocument (SPDocument *doc) } SPDesktop* -Editor::createDesktop (SPDocument* doc) +Editor::createDesktop (Document* doc) { g_assert (doc != 0); (new Inkscape::UI::View::EditWidget (doc))->present(); @@ -227,13 +227,13 @@ Editor::reactivateDesktop (SPDesktop* dt) bool Editor::isDuplicatedView (SPDesktop* dt) { - SPDocument const* document = dt->doc(); + Document const* document = dt->doc(); if (!document) { return false; } for ( GSList *iter = _instance->_desktops ; iter ; iter = iter->next ) { SPDesktop *other_desktop=(SPDesktop *)iter->data; - SPDocument *other_document=other_desktop->doc(); + Document *other_document=other_desktop->doc(); if ( other_document == document && other_desktop != dt ) { return true; } diff --git a/src/bind/javabind.cpp b/src/bind/javabind.cpp index aedd72e13..026486948 100644 --- a/src/bind/javabind.cpp +++ b/src/bind/javabind.cpp @@ -742,7 +742,7 @@ jboolean JNICALL documentSet(JNIEnv */*env*/, jobject /*obj*/, jlong /*ptr*/, js /* JavaBinderyImpl *bind = (JavaBinderyImpl *)ptr; String s = getString(env, jstr); - SPDocument *doc = sp_document_new_from_mem(s.c_str(), s.size(), true); + Document *doc = sp_document_new_from_mem(s.c_str(), s.size(), true); */ return JNI_TRUE; } diff --git a/src/dialogs/clonetiler.cpp b/src/dialogs/clonetiler.cpp index 55884fe4a..cd690a0d4 100644 --- a/src/dialogs/clonetiler.cpp +++ b/src/dialogs/clonetiler.cpp @@ -841,7 +841,7 @@ static NRArena const *trace_arena = NULL; static unsigned trace_visionkey; static NRArenaItem *trace_root; static gdouble trace_zoom; -static SPDocument *trace_doc; +static Document *trace_doc; static void clonetiler_trace_hide_tiled_clones_recursively (SPObject *from) @@ -857,7 +857,7 @@ clonetiler_trace_hide_tiled_clones_recursively (SPObject *from) } static void -clonetiler_trace_setup (SPDocument *doc, gdouble zoom, SPItem *original) +clonetiler_trace_setup (Document *doc, gdouble zoom, SPItem *original) { trace_arena = NRArena::create(); /* Create ArenaItem and set transform */ diff --git a/src/dialogs/export.cpp b/src/dialogs/export.cpp index 0cde76657..56d50596c 100644 --- a/src/dialogs/export.cpp +++ b/src/dialogs/export.cpp @@ -538,7 +538,7 @@ sp_export_dialog (void) if (SP_ACTIVE_DOCUMENT && SP_DOCUMENT_URI (SP_ACTIVE_DOCUMENT)) { gchar *name; - SPDocument * doc = SP_ACTIVE_DOCUMENT; + Document * doc = SP_ACTIVE_DOCUMENT; const gchar *uri = SP_DOCUMENT_URI (doc); Inkscape::XML::Node * repr = sp_document_repr_root(doc); const gchar * text_extension = repr->attribute("inkscape:output_extension"); @@ -779,7 +779,7 @@ sp_export_selection_modified ( Inkscape::Application */*inkscape*/, switch (current_key) { case SELECTION_DRAWING: if ( SP_ACTIVE_DESKTOP ) { - SPDocument *doc; + Document *doc; doc = sp_desktop_document (SP_ACTIVE_DESKTOP); Geom::OptRect bbox = sp_item_bbox_desktop (SP_ITEM (SP_DOCUMENT_ROOT (doc))); if (bbox) { @@ -839,7 +839,7 @@ sp_export_area_toggled (GtkToggleButton *tb, GtkObject *base) if ( SP_ACTIVE_DESKTOP ) { - SPDocument *doc; + Document *doc; Geom::OptRect bbox; doc = sp_desktop_document (SP_ACTIVE_DESKTOP); @@ -906,7 +906,7 @@ sp_export_area_toggled (GtkToggleButton *tb, GtkObject *base) switch (key) { case SELECTION_PAGE: case SELECTION_DRAWING: { - SPDocument * doc = SP_ACTIVE_DOCUMENT; + Document * doc = SP_ACTIVE_DOCUMENT; sp_document_get_export_hints (doc, &filename, &xdpi, &ydpi); if (filename == NULL) { @@ -1213,7 +1213,7 @@ sp_export_export_clicked (GtkButton */*button*/, GtkObject *base) switch ((selection_type)(GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(base), "selection-type")))) { case SELECTION_PAGE: case SELECTION_DRAWING: { - SPDocument * doc = SP_ACTIVE_DOCUMENT; + Document * doc = SP_ACTIVE_DOCUMENT; Inkscape::XML::Node * repr = sp_document_repr_root(doc); bool modified = false; const gchar * temp_string; @@ -1245,7 +1245,7 @@ sp_export_export_clicked (GtkButton */*button*/, GtkObject *base) } case SELECTION_SELECTION: { const GSList * reprlst; - SPDocument * doc = SP_ACTIVE_DOCUMENT; + Document * doc = SP_ACTIVE_DOCUMENT; bool modified = false; bool saved = sp_document_get_undo_sensitive(doc); @@ -1466,7 +1466,7 @@ sp_export_detect_size(GtkObject * base) { } break; case SELECTION_DRAWING: { - SPDocument *doc = sp_desktop_document (SP_ACTIVE_DESKTOP); + Document *doc = sp_desktop_document (SP_ACTIVE_DESKTOP); Geom::OptRect bbox = sp_item_bbox_desktop (SP_ITEM (SP_DOCUMENT_ROOT (doc))); @@ -1478,7 +1478,7 @@ sp_export_detect_size(GtkObject * base) { } case SELECTION_PAGE: { - SPDocument *doc; + Document *doc; doc = sp_desktop_document (SP_ACTIVE_DESKTOP); diff --git a/src/dialogs/xml-tree.cpp b/src/dialogs/xml-tree.cpp index c8644fef9..32dee453a 100644 --- a/src/dialogs/xml-tree.cpp +++ b/src/dialogs/xml-tree.cpp @@ -69,7 +69,7 @@ static SPXMLViewContent *content = NULL; static gint blocked = 0; static SPDesktop *current_desktop = NULL; -static SPDocument *current_document = NULL; +static Document *current_document = NULL; static gint selected_attr = 0; static Inkscape::XML::Node *selected_repr = NULL; @@ -77,7 +77,7 @@ static void sp_xmltree_desktop_activate( Inkscape::Application *inkscape, SPDes static void sp_xmltree_desktop_deactivate( Inkscape::Application *inkscape, SPDesktop *desktop, GtkWidget *dialog ); static void set_tree_desktop(SPDesktop *desktop); -static void set_tree_document(SPDocument *document); +static void set_tree_document(Document *document); static void set_tree_repr(Inkscape::XML::Node *repr); static void set_tree_select(Inkscape::XML::Node *repr); @@ -119,8 +119,8 @@ static void on_attr_unselect_row_clear_text(GtkCList *list, gint row, gint colum static void on_editable_changed_enable_if_valid_xml_name(GtkEditable *editable, gpointer data); static void on_desktop_selection_changed(Inkscape::Selection *selection); -static void on_document_replaced(SPDesktop *dt, SPDocument *document); -static void on_document_uri_set(gchar const *uri, SPDocument *document); +static void on_document_replaced(SPDesktop *dt, Document *document); +static void on_document_uri_set(gchar const *uri, Document *document); static void on_clicked_get_editable_text(GtkWidget *widget, gpointer data); @@ -666,7 +666,7 @@ void set_tree_desktop(SPDesktop *desktop) -void set_tree_document(SPDocument *document) +void set_tree_document(Document *document) { if (document == current_document) { return; @@ -1262,7 +1262,7 @@ void on_desktop_selection_changed(Inkscape::Selection */*selection*/) blocked--; } -static void on_document_replaced(SPDesktop *dt, SPDocument *doc) +static void on_document_replaced(SPDesktop *dt, Document *doc) { if (current_desktop) sel_changed_connection.disconnect(); @@ -1271,7 +1271,7 @@ static void on_document_replaced(SPDesktop *dt, SPDocument *doc) set_tree_document(doc); } -void on_document_uri_set(gchar const */*uri*/, SPDocument *document) +void on_document_uri_set(gchar const */*uri*/, Document *document) { gchar title[500]; sp_ui_dialog_title_string(Inkscape::Verb::get(SP_VERB_DIALOG_XML_EDITOR), title); diff --git a/src/display/canvas-axonomgrid.cpp b/src/display/canvas-axonomgrid.cpp index a92e7cf5b..90bac6053 100644 --- a/src/display/canvas-axonomgrid.cpp +++ b/src/display/canvas-axonomgrid.cpp @@ -190,7 +190,7 @@ attach_all(Gtk::Table &table, Gtk::Widget const *const arr[], unsigned size, int } } -CanvasAxonomGrid::CanvasAxonomGrid (SPNamedView * nv, Inkscape::XML::Node * in_repr, SPDocument * in_doc) +CanvasAxonomGrid::CanvasAxonomGrid (SPNamedView * nv, Inkscape::XML::Node * in_repr, Document * in_doc) : CanvasGrid(nv, in_repr, in_doc, GRID_AXONOMETRIC) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); diff --git a/src/display/canvas-grid.cpp b/src/display/canvas-grid.cpp index 5037c0375..710074a97 100644 --- a/src/display/canvas-grid.cpp +++ b/src/display/canvas-grid.cpp @@ -155,7 +155,7 @@ grid_canvasitem_update (SPCanvasItem *item, Geom::Matrix const &affine, unsigned NULL /* order_changed */ }; -CanvasGrid::CanvasGrid(SPNamedView * nv, Inkscape::XML::Node * in_repr, SPDocument *in_doc, GridType type) +CanvasGrid::CanvasGrid(SPNamedView * nv, Inkscape::XML::Node * in_repr, Document *in_doc, GridType type) : visible(true), gridtype(type) { repr = in_repr; @@ -240,7 +240,7 @@ CanvasGrid::getGridTypeFromName(char const *typestr) * writes an child to repr. */ void -CanvasGrid::writeNewGridToRepr(Inkscape::XML::Node * repr, SPDocument * doc, GridType gridtype) +CanvasGrid::writeNewGridToRepr(Inkscape::XML::Node * repr, Document * doc, GridType gridtype) { if (!repr) return; if (gridtype > GRID_MAXTYPENR) return; @@ -262,7 +262,7 @@ CanvasGrid::writeNewGridToRepr(Inkscape::XML::Node * repr, SPDocument * doc, Gri * Creates a new CanvasGrid object of type gridtype */ CanvasGrid* -CanvasGrid::NewGrid(SPNamedView * nv, Inkscape::XML::Node * repr, SPDocument * doc, GridType gridtype) +CanvasGrid::NewGrid(SPNamedView * nv, Inkscape::XML::Node * repr, Document * doc, GridType gridtype) { if (!repr) return NULL; if (!doc) { @@ -420,7 +420,7 @@ attach_all(Gtk::Table &table, Gtk::Widget const *const arr[], unsigned size, int } } -CanvasXYGrid::CanvasXYGrid (SPNamedView * nv, Inkscape::XML::Node * in_repr, SPDocument * in_doc) +CanvasXYGrid::CanvasXYGrid (SPNamedView * nv, Inkscape::XML::Node * in_repr, Document * in_doc) : CanvasGrid(nv, in_repr, in_doc, GRID_RECTANGULAR) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); diff --git a/src/display/nr-filter-image.cpp b/src/display/nr-filter-image.cpp index 2b799f8d2..4430907da 100644 --- a/src/display/nr-filter-image.cpp +++ b/src/display/nr-filter-image.cpp @@ -225,7 +225,7 @@ void FilterImage::set_href(const gchar *href){ feImageHref = (href) ? g_strdup (href) : NULL; } -void FilterImage::set_document(SPDocument *doc){ +void FilterImage::set_document(Document *doc){ document = doc; } diff --git a/src/extension/effect.cpp b/src/extension/effect.cpp index afc0668a9..c6b731a84 100644 --- a/src/extension/effect.cpp +++ b/src/extension/effect.cpp @@ -358,7 +358,7 @@ void Effect::EffectVerb::perform( SPAction *action, void * data, void */*pdata*/ ) { Inkscape::UI::View::View * current_view = sp_action_get_view(action); -// SPDocument * current_document = current_view->doc; +// Document * current_document = current_view->doc; Effect::EffectVerb * ev = reinterpret_cast(data); Effect * effect = ev->_effect; diff --git a/src/extension/execution-env.cpp b/src/extension/execution-env.cpp index 4a13890d7..a87cc6b64 100644 --- a/src/extension/execution-env.cpp +++ b/src/extension/execution-env.cpp @@ -179,7 +179,7 @@ ExecutionEnv::commit (void) { void ExecutionEnv::reselect (void) { if (_doc == NULL) { return; } - SPDocument * doc = _doc->doc(); + Document * doc = _doc->doc(); if (doc == NULL) { return; } SPDesktop *desktop = (SPDesktop *)_doc; diff --git a/src/extension/extension.cpp b/src/extension/extension.cpp index 52d5f5148..c8dc30d8b 100644 --- a/src/extension/extension.cpp +++ b/src/extension/extension.cpp @@ -423,7 +423,7 @@ param_shared (const gchar * name, GSList * list) found parameter. */ const gchar * -Extension::get_param_string (const gchar * name, const SPDocument * doc, const Inkscape::XML::Node * node) +Extension::get_param_string (const gchar * name, const Document * doc, const Inkscape::XML::Node * node) { Parameter * param; @@ -432,7 +432,7 @@ Extension::get_param_string (const gchar * name, const SPDocument * doc, const I } const gchar * -Extension::get_param_enum (const gchar * name, const SPDocument * doc, const Inkscape::XML::Node * node) +Extension::get_param_enum (const gchar * name, const Document * doc, const Inkscape::XML::Node * node) { Parameter* param = param_shared(name, parameters); return param->get_enum(doc, node); @@ -450,7 +450,7 @@ Extension::get_param_enum (const gchar * name, const SPDocument * doc, const Ink found parameter. */ bool -Extension::get_param_bool (const gchar * name, const SPDocument * doc, const Inkscape::XML::Node * node) +Extension::get_param_bool (const gchar * name, const Document * doc, const Inkscape::XML::Node * node) { Parameter * param; @@ -470,7 +470,7 @@ Extension::get_param_bool (const gchar * name, const SPDocument * doc, const Ink found parameter. */ int -Extension::get_param_int (const gchar * name, const SPDocument * doc, const Inkscape::XML::Node * node) +Extension::get_param_int (const gchar * name, const Document * doc, const Inkscape::XML::Node * node) { Parameter * param; @@ -490,7 +490,7 @@ Extension::get_param_int (const gchar * name, const SPDocument * doc, const Inks found parameter. */ float -Extension::get_param_float (const gchar * name, const SPDocument * doc, const Inkscape::XML::Node * node) +Extension::get_param_float (const gchar * name, const Document * doc, const Inkscape::XML::Node * node) { Parameter * param; param = param_shared(name, parameters); @@ -509,7 +509,7 @@ Extension::get_param_float (const gchar * name, const SPDocument * doc, const In found parameter. */ guint32 -Extension::get_param_color (const gchar * name, const SPDocument * doc, const Inkscape::XML::Node * node) +Extension::get_param_color (const gchar * name, const Document * doc, const Inkscape::XML::Node * node) { Parameter* param = param_shared(name, parameters); return param->get_color(doc, node); @@ -528,7 +528,7 @@ Extension::get_param_color (const gchar * name, const SPDocument * doc, const In found parameter. */ bool -Extension::set_param_bool (const gchar * name, bool value, SPDocument * doc, Inkscape::XML::Node * node) +Extension::set_param_bool (const gchar * name, bool value, Document * doc, Inkscape::XML::Node * node) { Parameter * param; param = param_shared(name, parameters); @@ -548,7 +548,7 @@ Extension::set_param_bool (const gchar * name, bool value, SPDocument * doc, Ink found parameter. */ int -Extension::set_param_int (const gchar * name, int value, SPDocument * doc, Inkscape::XML::Node * node) +Extension::set_param_int (const gchar * name, int value, Document * doc, Inkscape::XML::Node * node) { Parameter * param; param = param_shared(name, parameters); @@ -568,7 +568,7 @@ Extension::set_param_int (const gchar * name, int value, SPDocument * doc, Inksc found parameter. */ float -Extension::set_param_float (const gchar * name, float value, SPDocument * doc, Inkscape::XML::Node * node) +Extension::set_param_float (const gchar * name, float value, Document * doc, Inkscape::XML::Node * node) { Parameter * param; param = param_shared(name, parameters); @@ -588,7 +588,7 @@ Extension::set_param_float (const gchar * name, float value, SPDocument * doc, I found parameter. */ const gchar * -Extension::set_param_string (const gchar * name, const gchar * value, SPDocument * doc, Inkscape::XML::Node * node) +Extension::set_param_string (const gchar * name, const gchar * value, Document * doc, Inkscape::XML::Node * node) { Parameter * param; param = param_shared(name, parameters); @@ -608,7 +608,7 @@ Extension::set_param_string (const gchar * name, const gchar * value, SPDocument found parameter. */ guint32 -Extension::set_param_color (const gchar * name, guint32 color, SPDocument * doc, Inkscape::XML::Node * node) +Extension::set_param_color (const gchar * name, guint32 color, Document * doc, Inkscape::XML::Node * node) { Parameter* param = param_shared(name, parameters); return param->set_color(color, doc, node); @@ -671,7 +671,7 @@ public: If all parameters are gui_visible = false NULL is returned as well. */ Gtk::Widget * -Extension::autogui (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) +Extension::autogui (Document * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) { if (param_visible_count() == 0) return NULL; diff --git a/src/extension/input.cpp b/src/extension/input.cpp index 689c1286f..ca5fdc29f 100644 --- a/src/extension/input.cpp +++ b/src/extension/input.cpp @@ -145,7 +145,7 @@ Input::check (void) Adobe Illustrator file can be transparent (not recommended, but transparent). This is all done with undo being turned off. */ -SPDocument * +Document * Input::open (const gchar *uri) { if (!loaded()) { @@ -156,7 +156,7 @@ Input::open (const gchar *uri) } timer->touch(); - SPDocument *const doc = imp->open(this, uri); + Document *const doc = imp->open(this, uri); if (doc != NULL) { Inkscape::XML::Node * repr = sp_document_repr_root(doc); bool saved = sp_document_get_undo_sensitive(doc); diff --git a/src/extension/output.cpp b/src/extension/output.cpp index 742e938de..8e2fa5486 100644 --- a/src/extension/output.cpp +++ b/src/extension/output.cpp @@ -212,7 +212,7 @@ Output::prefs (void) could be changed, and old files will still work properly. */ void -Output::save(SPDocument *doc, gchar const *filename) +Output::save(Document *doc, gchar const *filename) { try { imp->save(this, doc, filename); diff --git a/src/extension/patheffect.cpp b/src/extension/patheffect.cpp index 8e3fc13f1..f6fa84f5b 100644 --- a/src/extension/patheffect.cpp +++ b/src/extension/patheffect.cpp @@ -28,14 +28,14 @@ PathEffect::~PathEffect (void) } void -PathEffect::processPath (SPDocument * /*doc*/, Inkscape::XML::Node * /*path*/, Inkscape::XML::Node * /*def*/) +PathEffect::processPath (Document * /*doc*/, Inkscape::XML::Node * /*path*/, Inkscape::XML::Node * /*def*/) { } void -PathEffect::processPathEffects (SPDocument * doc, Inkscape::XML::Node * path) +PathEffect::processPathEffects (Document * doc, Inkscape::XML::Node * path) { gchar const * patheffectlist = path->attribute("inkscape:path-effects"); if (patheffectlist == NULL) diff --git a/src/extension/print.cpp b/src/extension/print.cpp index 2d4177d60..f6f6bb1e5 100644 --- a/src/extension/print.cpp +++ b/src/extension/print.cpp @@ -49,7 +49,7 @@ Print::set_preview (void) } unsigned int -Print::begin (SPDocument *doc) +Print::begin (Document *doc) { return imp->begin(this, doc); } diff --git a/src/extension/system.cpp b/src/extension/system.cpp index d7e0eebf3..ad49c3d2a 100644 --- a/src/extension/system.cpp +++ b/src/extension/system.cpp @@ -59,7 +59,7 @@ static Extension *build_from_reprdoc(Inkscape::XML::Document *doc, Implementatio * * Lastly, the open function is called in the module itself. */ -SPDocument * +Document * open(Extension *key, gchar const *filename) { Input *imod = NULL; @@ -91,7 +91,7 @@ open(Extension *key, gchar const *filename) if (!imod->prefs(filename)) return NULL; - SPDocument *doc = imod->open(filename); + Document *doc = imod->open(filename); if (!doc) { throw Input::open_failed(); } @@ -184,7 +184,7 @@ open_internal(Extension *in_plug, gpointer in_data) * Lastly, the save function is called in the module itself. */ void -save(Extension *key, SPDocument *doc, gchar const *filename, bool setextension, bool check_overwrite, bool official) +save(Extension *key, Document *doc, gchar const *filename, bool setextension, bool check_overwrite, bool official) { Output *omod; if (key == NULL) { diff --git a/src/filters/blend.cpp b/src/filters/blend.cpp index 5998d7be3..26db781a0 100644 --- a/src/filters/blend.cpp +++ b/src/filters/blend.cpp @@ -35,7 +35,7 @@ static void sp_feBlend_class_init(SPFeBlendClass *klass); static void sp_feBlend_init(SPFeBlend *feBlend); -static void sp_feBlend_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_feBlend_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); static void sp_feBlend_release(SPObject *object); static void sp_feBlend_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feBlend_update(SPObject *object, SPCtx *ctx, guint flags); @@ -94,7 +94,7 @@ sp_feBlend_init(SPFeBlend *feBlend) * sp-object-repr.cpp's repr_name_entries array. */ static void -sp_feBlend_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +sp_feBlend_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { SPFeBlend *blend = SP_FEBLEND(object); diff --git a/src/filters/colormatrix.cpp b/src/filters/colormatrix.cpp index 55cfcbeb7..f3c336d71 100644 --- a/src/filters/colormatrix.cpp +++ b/src/filters/colormatrix.cpp @@ -34,7 +34,7 @@ static void sp_feColorMatrix_class_init(SPFeColorMatrixClass *klass); static void sp_feColorMatrix_init(SPFeColorMatrix *feColorMatrix); -static void sp_feColorMatrix_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_feColorMatrix_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); static void sp_feColorMatrix_release(SPObject *object); static void sp_feColorMatrix_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feColorMatrix_update(SPObject *object, SPCtx *ctx, guint flags); @@ -91,7 +91,7 @@ sp_feColorMatrix_init(SPFeColorMatrix */*feColorMatrix*/) * sp-object-repr.cpp's repr_name_entries array. */ static void -sp_feColorMatrix_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +sp_feColorMatrix_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) feColorMatrix_parent_class)->build) { ((SPObjectClass *) feColorMatrix_parent_class)->build(object, document, repr); diff --git a/src/filters/componenttransfer-funcnode.cpp b/src/filters/componenttransfer-funcnode.cpp index e66f85e70..f74da8154 100644 --- a/src/filters/componenttransfer-funcnode.cpp +++ b/src/filters/componenttransfer-funcnode.cpp @@ -36,7 +36,7 @@ static void sp_fefuncnode_class_init(SPFeFuncNodeClass *klass); static void sp_fefuncnode_init(SPFeFuncNode *fefuncnode); -static void sp_fefuncnode_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_fefuncnode_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); static void sp_fefuncnode_release(SPObject *object); static void sp_fefuncnode_set(SPObject *object, unsigned int key, gchar const *value); static void sp_fefuncnode_update(SPObject *object, SPCtx *ctx, guint flags); @@ -161,7 +161,7 @@ sp_fefuncnode_init(SPFeFuncNode *fefuncnode) * sp-object-repr.cpp's repr_name_entries array. */ static void -sp_fefuncnode_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +sp_fefuncnode_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) feFuncNode_parent_class)->build) { ((SPObjectClass *) feFuncNode_parent_class)->build(object, document, repr); diff --git a/src/filters/componenttransfer.cpp b/src/filters/componenttransfer.cpp index 557d884e0..fbfca3a35 100644 --- a/src/filters/componenttransfer.cpp +++ b/src/filters/componenttransfer.cpp @@ -32,7 +32,7 @@ static void sp_feComponentTransfer_class_init(SPFeComponentTransferClass *klass); static void sp_feComponentTransfer_init(SPFeComponentTransfer *feComponentTransfer); -static void sp_feComponentTransfer_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_feComponentTransfer_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); static void sp_feComponentTransfer_release(SPObject *object); static void sp_feComponentTransfer_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feComponentTransfer_update(SPObject *object, SPCtx *ctx, guint flags); @@ -91,7 +91,7 @@ sp_feComponentTransfer_init(SPFeComponentTransfer */*feComponentTransfer*/) * sp-object-repr.cpp's repr_name_entries array. */ static void -sp_feComponentTransfer_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +sp_feComponentTransfer_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) feComponentTransfer_parent_class)->build) { ((SPObjectClass *) feComponentTransfer_parent_class)->build(object, document, repr); diff --git a/src/filters/composite.cpp b/src/filters/composite.cpp index 93c692f94..8265a611c 100644 --- a/src/filters/composite.cpp +++ b/src/filters/composite.cpp @@ -29,7 +29,7 @@ static void sp_feComposite_class_init(SPFeCompositeClass *klass); static void sp_feComposite_init(SPFeComposite *feComposite); -static void sp_feComposite_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_feComposite_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); static void sp_feComposite_release(SPObject *object); static void sp_feComposite_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feComposite_update(SPObject *object, SPCtx *ctx, guint flags); @@ -93,7 +93,7 @@ sp_feComposite_init(SPFeComposite *feComposite) * sp-object-repr.cpp's repr_name_entries array. */ static void -sp_feComposite_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +sp_feComposite_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) feComposite_parent_class)->build) { ((SPObjectClass *) feComposite_parent_class)->build(object, document, repr); diff --git a/src/filters/convolvematrix.cpp b/src/filters/convolvematrix.cpp index 3e1c36f0a..cc9d62f8f 100644 --- a/src/filters/convolvematrix.cpp +++ b/src/filters/convolvematrix.cpp @@ -34,7 +34,7 @@ static void sp_feConvolveMatrix_class_init(SPFeConvolveMatrixClass *klass); static void sp_feConvolveMatrix_init(SPFeConvolveMatrix *feConvolveMatrix); -static void sp_feConvolveMatrix_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_feConvolveMatrix_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); static void sp_feConvolveMatrix_release(SPObject *object); static void sp_feConvolveMatrix_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feConvolveMatrix_update(SPObject *object, SPCtx *ctx, guint flags); @@ -103,7 +103,7 @@ sp_feConvolveMatrix_init(SPFeConvolveMatrix *feConvolveMatrix) * sp-object-repr.cpp's repr_name_entries array. */ static void -sp_feConvolveMatrix_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +sp_feConvolveMatrix_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) feConvolveMatrix_parent_class)->build) { ((SPObjectClass *) feConvolveMatrix_parent_class)->build(object, document, repr); diff --git a/src/filters/diffuselighting.cpp b/src/filters/diffuselighting.cpp index bdc569083..e494e8ccd 100644 --- a/src/filters/diffuselighting.cpp +++ b/src/filters/diffuselighting.cpp @@ -32,7 +32,7 @@ static void sp_feDiffuseLighting_class_init(SPFeDiffuseLightingClass *klass); static void sp_feDiffuseLighting_init(SPFeDiffuseLighting *feDiffuseLighting); -static void sp_feDiffuseLighting_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_feDiffuseLighting_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); static void sp_feDiffuseLighting_release(SPObject *object); static void sp_feDiffuseLighting_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feDiffuseLighting_update(SPObject *object, SPCtx *ctx, guint flags); @@ -111,7 +111,7 @@ sp_feDiffuseLighting_init(SPFeDiffuseLighting *feDiffuseLighting) * sp-object-repr.cpp's repr_name_entries array. */ static void -sp_feDiffuseLighting_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +sp_feDiffuseLighting_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) feDiffuseLighting_parent_class)->build) { ((SPObjectClass *) feDiffuseLighting_parent_class)->build(object, document, repr); diff --git a/src/filters/displacementmap.cpp b/src/filters/displacementmap.cpp index baa17d785..b05ee4db1 100644 --- a/src/filters/displacementmap.cpp +++ b/src/filters/displacementmap.cpp @@ -29,7 +29,7 @@ static void sp_feDisplacementMap_class_init(SPFeDisplacementMapClass *klass); static void sp_feDisplacementMap_init(SPFeDisplacementMap *feDisplacementMap); -static void sp_feDisplacementMap_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_feDisplacementMap_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); static void sp_feDisplacementMap_release(SPObject *object); static void sp_feDisplacementMap_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feDisplacementMap_update(SPObject *object, SPCtx *ctx, guint flags); @@ -90,7 +90,7 @@ sp_feDisplacementMap_init(SPFeDisplacementMap *feDisplacementMap) * sp-object-repr.cpp's repr_name_entries array. */ static void -sp_feDisplacementMap_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +sp_feDisplacementMap_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) feDisplacementMap_parent_class)->build) { ((SPObjectClass *) feDisplacementMap_parent_class)->build(object, document, repr); diff --git a/src/filters/distantlight.cpp b/src/filters/distantlight.cpp index 41584c4a4..f25094798 100644 --- a/src/filters/distantlight.cpp +++ b/src/filters/distantlight.cpp @@ -35,7 +35,7 @@ static void sp_fedistantlight_class_init(SPFeDistantLightClass *klass); static void sp_fedistantlight_init(SPFeDistantLight *fedistantlight); -static void sp_fedistantlight_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_fedistantlight_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); static void sp_fedistantlight_release(SPObject *object); static void sp_fedistantlight_set(SPObject *object, unsigned int key, gchar const *value); static void sp_fedistantlight_update(SPObject *object, SPCtx *ctx, guint flags); @@ -94,7 +94,7 @@ sp_fedistantlight_init(SPFeDistantLight *fedistantlight) * sp-object-repr.cpp's repr_name_entries array. */ static void -sp_fedistantlight_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +sp_fedistantlight_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) feDistantLight_parent_class)->build) { ((SPObjectClass *) feDistantLight_parent_class)->build(object, document, repr); diff --git a/src/filters/flood.cpp b/src/filters/flood.cpp index 625e35d42..941f36113 100644 --- a/src/filters/flood.cpp +++ b/src/filters/flood.cpp @@ -29,7 +29,7 @@ static void sp_feFlood_class_init(SPFeFloodClass *klass); static void sp_feFlood_init(SPFeFlood *feFlood); -static void sp_feFlood_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_feFlood_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); static void sp_feFlood_release(SPObject *object); static void sp_feFlood_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feFlood_update(SPObject *object, SPCtx *ctx, guint flags); @@ -87,7 +87,7 @@ sp_feFlood_init(SPFeFlood *feFlood) * sp-object-repr.cpp's repr_name_entries array. */ static void -sp_feFlood_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +sp_feFlood_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) feFlood_parent_class)->build) { ((SPObjectClass *) feFlood_parent_class)->build(object, document, repr); diff --git a/src/filters/image.cpp b/src/filters/image.cpp index 0002ef94c..bdfbadee0 100644 --- a/src/filters/image.cpp +++ b/src/filters/image.cpp @@ -34,7 +34,7 @@ static void sp_feImage_class_init(SPFeImageClass *klass); static void sp_feImage_init(SPFeImage *feImage); -static void sp_feImage_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_feImage_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); static void sp_feImage_release(SPObject *object); static void sp_feImage_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feImage_update(SPObject *object, SPCtx *ctx, guint flags); @@ -92,7 +92,7 @@ sp_feImage_init(SPFeImage */*feImage*/) * sp-object-repr.cpp's repr_name_entries array. */ static void -sp_feImage_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +sp_feImage_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { // Save document reference so we can load images with relative paths. SPFeImage *feImage = SP_FEIMAGE(object); diff --git a/src/filters/merge.cpp b/src/filters/merge.cpp index 437cb4b55..9d82da7ae 100644 --- a/src/filters/merge.cpp +++ b/src/filters/merge.cpp @@ -30,7 +30,7 @@ static void sp_feMerge_class_init(SPFeMergeClass *klass); static void sp_feMerge_init(SPFeMerge *feMerge); -static void sp_feMerge_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_feMerge_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); static void sp_feMerge_release(SPObject *object); static void sp_feMerge_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feMerge_update(SPObject *object, SPCtx *ctx, guint flags); @@ -88,7 +88,7 @@ sp_feMerge_init(SPFeMerge */*feMerge*/) * sp-object-repr.cpp's repr_name_entries array. */ static void -sp_feMerge_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +sp_feMerge_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) feMerge_parent_class)->build) { ((SPObjectClass *) feMerge_parent_class)->build(object, document, repr); diff --git a/src/filters/mergenode.cpp b/src/filters/mergenode.cpp index 8a4e0dd0a..42b4bc8db 100644 --- a/src/filters/mergenode.cpp +++ b/src/filters/mergenode.cpp @@ -26,7 +26,7 @@ static void sp_feMergeNode_class_init(SPFeMergeNodeClass *klass); static void sp_feMergeNode_init(SPFeMergeNode *skeleton); -static void sp_feMergeNode_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_feMergeNode_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); static void sp_feMergeNode_release(SPObject *object); static void sp_feMergeNode_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feMergeNode_update(SPObject *object, SPCtx *ctx, guint flags); @@ -82,7 +82,7 @@ sp_feMergeNode_init(SPFeMergeNode *feMergeNode) * sp-object-repr.cpp's repr_name_entries array. */ static void -sp_feMergeNode_build(SPObject *object, SPDocument */*document*/, Inkscape::XML::Node */*repr*/) +sp_feMergeNode_build(SPObject *object, Document */*document*/, Inkscape::XML::Node */*repr*/) { sp_object_read_attr(object, "in"); } diff --git a/src/filters/morphology.cpp b/src/filters/morphology.cpp index 9a34bbccb..6d91d9905 100644 --- a/src/filters/morphology.cpp +++ b/src/filters/morphology.cpp @@ -31,7 +31,7 @@ static void sp_feMorphology_class_init(SPFeMorphologyClass *klass); static void sp_feMorphology_init(SPFeMorphology *feMorphology); -static void sp_feMorphology_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_feMorphology_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); static void sp_feMorphology_release(SPObject *object); static void sp_feMorphology_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feMorphology_update(SPObject *object, SPCtx *ctx, guint flags); @@ -90,7 +90,7 @@ sp_feMorphology_init(SPFeMorphology *feMorphology) * sp-object-repr.cpp's repr_name_entries array. */ static void -sp_feMorphology_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +sp_feMorphology_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) feMorphology_parent_class)->build) { ((SPObjectClass *) feMorphology_parent_class)->build(object, document, repr); diff --git a/src/filters/offset.cpp b/src/filters/offset.cpp index 61ea45ff2..3ae6994ce 100644 --- a/src/filters/offset.cpp +++ b/src/filters/offset.cpp @@ -30,7 +30,7 @@ static void sp_feOffset_class_init(SPFeOffsetClass *klass); static void sp_feOffset_init(SPFeOffset *feOffset); -static void sp_feOffset_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_feOffset_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); static void sp_feOffset_release(SPObject *object); static void sp_feOffset_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feOffset_update(SPObject *object, SPCtx *ctx, guint flags); @@ -90,7 +90,7 @@ sp_feOffset_init(SPFeOffset *feOffset) * sp-object-repr.cpp's repr_name_entries array. */ static void -sp_feOffset_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +sp_feOffset_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) feOffset_parent_class)->build) { ((SPObjectClass *) feOffset_parent_class)->build(object, document, repr); diff --git a/src/filters/pointlight.cpp b/src/filters/pointlight.cpp index ce58cf13e..cc56b5f01 100644 --- a/src/filters/pointlight.cpp +++ b/src/filters/pointlight.cpp @@ -35,7 +35,7 @@ static void sp_fepointlight_class_init(SPFePointLightClass *klass); static void sp_fepointlight_init(SPFePointLight *fepointlight); -static void sp_fepointlight_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_fepointlight_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); static void sp_fepointlight_release(SPObject *object); static void sp_fepointlight_set(SPObject *object, unsigned int key, gchar const *value); static void sp_fepointlight_update(SPObject *object, SPCtx *ctx, guint flags); @@ -97,7 +97,7 @@ sp_fepointlight_init(SPFePointLight *fepointlight) * sp-object-repr.cpp's repr_name_entries array. */ static void -sp_fepointlight_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +sp_fepointlight_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) fePointLight_parent_class)->build) { ((SPObjectClass *) fePointLight_parent_class)->build(object, document, repr); diff --git a/src/filters/specularlighting.cpp b/src/filters/specularlighting.cpp index 03a0c7f96..9a3ac6811 100644 --- a/src/filters/specularlighting.cpp +++ b/src/filters/specularlighting.cpp @@ -32,7 +32,7 @@ static void sp_feSpecularLighting_class_init(SPFeSpecularLightingClass *klass); static void sp_feSpecularLighting_init(SPFeSpecularLighting *feSpecularLighting); -static void sp_feSpecularLighting_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_feSpecularLighting_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); static void sp_feSpecularLighting_release(SPObject *object); static void sp_feSpecularLighting_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feSpecularLighting_update(SPObject *object, SPCtx *ctx, guint flags); @@ -113,7 +113,7 @@ sp_feSpecularLighting_init(SPFeSpecularLighting *feSpecularLighting) * sp-object-repr.cpp's repr_name_entries array. */ static void -sp_feSpecularLighting_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +sp_feSpecularLighting_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) feSpecularLighting_parent_class)->build) { ((SPObjectClass *) feSpecularLighting_parent_class)->build(object, document, repr); diff --git a/src/filters/spotlight.cpp b/src/filters/spotlight.cpp index 3b518f0b4..bd5d06f73 100644 --- a/src/filters/spotlight.cpp +++ b/src/filters/spotlight.cpp @@ -35,7 +35,7 @@ static void sp_fespotlight_class_init(SPFeSpotLightClass *klass); static void sp_fespotlight_init(SPFeSpotLight *fespotlight); -static void sp_fespotlight_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_fespotlight_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); static void sp_fespotlight_release(SPObject *object); static void sp_fespotlight_set(SPObject *object, unsigned int key, gchar const *value); static void sp_fespotlight_update(SPObject *object, SPCtx *ctx, guint flags); @@ -107,7 +107,7 @@ sp_fespotlight_init(SPFeSpotLight *fespotlight) * sp-object-repr.cpp's repr_name_entries array. */ static void -sp_fespotlight_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +sp_fespotlight_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) feSpotLight_parent_class)->build) { ((SPObjectClass *) feSpotLight_parent_class)->build(object, document, repr); diff --git a/src/filters/tile.cpp b/src/filters/tile.cpp index 877f70b27..7bf03cde3 100644 --- a/src/filters/tile.cpp +++ b/src/filters/tile.cpp @@ -28,7 +28,7 @@ static void sp_feTile_class_init(SPFeTileClass *klass); static void sp_feTile_init(SPFeTile *feTile); -static void sp_feTile_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_feTile_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); static void sp_feTile_release(SPObject *object); static void sp_feTile_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feTile_update(SPObject *object, SPCtx *ctx, guint flags); @@ -85,7 +85,7 @@ sp_feTile_init(SPFeTile */*feTile*/) * sp-object-repr.cpp's repr_name_entries array. */ static void -sp_feTile_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +sp_feTile_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) feTile_parent_class)->build) { ((SPObjectClass *) feTile_parent_class)->build(object, document, repr); diff --git a/src/filters/turbulence.cpp b/src/filters/turbulence.cpp index f3c143056..e348f796f 100644 --- a/src/filters/turbulence.cpp +++ b/src/filters/turbulence.cpp @@ -34,7 +34,7 @@ static void sp_feTurbulence_class_init(SPFeTurbulenceClass *klass); static void sp_feTurbulence_init(SPFeTurbulence *feTurbulence); -static void sp_feTurbulence_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void sp_feTurbulence_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); static void sp_feTurbulence_release(SPObject *object); static void sp_feTurbulence_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feTurbulence_update(SPObject *object, SPCtx *ctx, guint flags); @@ -93,7 +93,7 @@ sp_feTurbulence_init(SPFeTurbulence *feTurbulence) * sp-object-repr.cpp's repr_name_entries array. */ static void -sp_feTurbulence_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +sp_feTurbulence_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) feTurbulence_parent_class)->build) { ((SPObjectClass *) feTurbulence_parent_class)->build(object, document, repr); diff --git a/src/helper/action.cpp b/src/helper/action.cpp index 84d150615..8c2705e45 100644 --- a/src/helper/action.cpp +++ b/src/helper/action.cpp @@ -132,7 +132,7 @@ public: { _addProperty(share_static_string("timestamp"), timestamp()); if (action->view) { - SPDocument *document = action->view->doc(); + Document *document = action->view->doc(); if (document) { _addProperty(share_static_string("document"), document->serial()); } diff --git a/src/helper/pixbuf-ops.cpp b/src/helper/pixbuf-ops.cpp index f41342e42..1e364a37c 100644 --- a/src/helper/pixbuf-ops.cpp +++ b/src/helper/pixbuf-ops.cpp @@ -66,7 +66,7 @@ hide_other_items_recursively(SPObject *o, GSList *list, unsigned dkey) // to the call for the interface to the png writing. bool -sp_export_jpg_file(SPDocument *doc, gchar const *filename, +sp_export_jpg_file(Document *doc, gchar const *filename, double x0, double y0, double x1, double y1, unsigned width, unsigned height, double xdpi, double ydpi, unsigned long bgcolor, double quality,GSList *items) @@ -90,7 +90,7 @@ sp_export_jpg_file(SPDocument *doc, gchar const *filename, } GdkPixbuf* -sp_generate_internal_bitmap(SPDocument *doc, gchar const */*filename*/, +sp_generate_internal_bitmap(Document *doc, gchar const */*filename*/, double x0, double y0, double x1, double y1, unsigned width, unsigned height, double xdpi, double ydpi, unsigned long bgcolor, diff --git a/src/helper/png-write.cpp b/src/helper/png-write.cpp index 3ac900680..ad1b43c55 100644 --- a/src/helper/png-write.cpp +++ b/src/helper/png-write.cpp @@ -120,7 +120,7 @@ void PngTextList::add(gchar const* key, gchar const* text) } static bool -sp_png_write_rgba_striped(SPDocument *doc, +sp_png_write_rgba_striped(Document *doc, gchar const *filename, unsigned long int width, unsigned long int height, double xdpi, double ydpi, int (* get_rows)(guchar const **rows, int row, int num_rows, void *data), void *data) @@ -388,7 +388,7 @@ hide_other_items_recursively(SPObject *o, GSList *list, unsigned dkey) * * \return true if succeeded (or if no action was taken), false if an error occurred. */ -bool sp_export_png_file (SPDocument *doc, gchar const *filename, +bool sp_export_png_file (Document *doc, gchar const *filename, double x0, double y0, double x1, double y1, unsigned long int width, unsigned long int height, double xdpi, double ydpi, unsigned long bgcolor, @@ -400,7 +400,7 @@ bool sp_export_png_file (SPDocument *doc, gchar const *filename, width, height, xdpi, ydpi, bgcolor, status, data, force_overwrite, items_only); } bool -sp_export_png_file(SPDocument *doc, gchar const *filename, +sp_export_png_file(Document *doc, gchar const *filename, Geom::Rect const &area, unsigned long width, unsigned long height, double xdpi, double ydpi, unsigned long bgcolor, diff --git a/src/helper/stock-items.cpp b/src/helper/stock-items.cpp index 575197fee..936397480 100644 --- a/src/helper/stock-items.cpp +++ b/src/helper/stock-items.cpp @@ -35,9 +35,9 @@ -static SPObject *sp_gradient_load_from_svg(gchar const *name, SPDocument *current_doc); -static SPObject *sp_marker_load_from_svg(gchar const *name, SPDocument *current_doc); -static SPObject *sp_gradient_load_from_svg(gchar const *name, SPDocument *current_doc); +static SPObject *sp_gradient_load_from_svg(gchar const *name, Document *current_doc); +static SPObject *sp_marker_load_from_svg(gchar const *name, Document *current_doc); +static SPObject *sp_gradient_load_from_svg(gchar const *name, Document *current_doc); // FIXME: these should be merged with the icon loading code so they @@ -45,9 +45,9 @@ static SPObject *sp_gradient_load_from_svg(gchar const *name, SPDocument *curren // take the dir to look in, and the file to check for, and cache // against that, rather than the existing copy/paste code seen here. -static SPObject * sp_marker_load_from_svg(gchar const *name, SPDocument *current_doc) +static SPObject * sp_marker_load_from_svg(gchar const *name, Document *current_doc) { - static SPDocument *doc = NULL; + static Document *doc = NULL; static unsigned int edoc = FALSE; if (!current_doc) { return NULL; @@ -83,9 +83,9 @@ static SPObject * sp_marker_load_from_svg(gchar const *name, SPDocument *current static SPObject * -sp_pattern_load_from_svg(gchar const *name, SPDocument *current_doc) +sp_pattern_load_from_svg(gchar const *name, Document *current_doc) { - static SPDocument *doc = NULL; + static Document *doc = NULL; static unsigned int edoc = FALSE; if (!current_doc) { return NULL; @@ -126,9 +126,9 @@ sp_pattern_load_from_svg(gchar const *name, SPDocument *current_doc) static SPObject * -sp_gradient_load_from_svg(gchar const *name, SPDocument *current_doc) +sp_gradient_load_from_svg(gchar const *name, Document *current_doc) { - static SPDocument *doc = NULL; + static Document *doc = NULL; static unsigned int edoc = FALSE; if (!current_doc) { return NULL; @@ -194,7 +194,7 @@ SPObject *get_stock_item(gchar const *urn) gchar * base = g_strndup(e, a); SPDesktop *desktop = inkscape_active_desktop(); - SPDocument *doc = sp_desktop_document(desktop); + Document *doc = sp_desktop_document(desktop); SPDefs *defs= (SPDefs *) SP_DOCUMENT_DEFS(doc); SPObject *object = NULL; @@ -263,7 +263,7 @@ SPObject *get_stock_item(gchar const *urn) else { SPDesktop *desktop = inkscape_active_desktop(); - SPDocument *doc = sp_desktop_document(desktop); + Document *doc = sp_desktop_document(desktop); SPObject *object = doc->getObjectById(urn); return object; diff --git a/src/jabber_whiteboard/session-manager.cpp b/src/jabber_whiteboard/session-manager.cpp index a04ab05f0..b6d236be9 100644 --- a/src/jabber_whiteboard/session-manager.cpp +++ b/src/jabber_whiteboard/session-manager.cpp @@ -95,7 +95,7 @@ void SessionManager::initialiseSession(Glib::ustring const& to, State::SessionType type) { - SPDocument* doc = makeInkboardDocument(g_quark_from_static_string("xml"), "svg:svg", type, to); + Document* doc = makeInkboardDocument(g_quark_from_static_string("xml"), "svg:svg", type, to); InkboardDocument* inkdoc = dynamic_cast< InkboardDocument* >(doc->rdoc); if(inkdoc == NULL) return; @@ -317,7 +317,7 @@ SessionManager::checkInvitationQueue() Dialog::DialogReply reply = static_cast< Dialog::DialogReply >(dialog.run()); - SPDocument* doc = makeInkboardDocument(g_quark_from_static_string("xml"), "svg:svg", State::WHITEBOARD_PEER, from); + Document* doc = makeInkboardDocument(g_quark_from_static_string("xml"), "svg:svg", State::WHITEBOARD_PEER, from); InkboardDocument* inkdoc = dynamic_cast< InkboardDocument* >(doc->rdoc); if(inkdoc == NULL) return true; @@ -350,10 +350,10 @@ SessionManager::checkInvitationQueue() //# HELPER FUNCTIONS //######################################################################### -SPDocument* +Document* makeInkboardDocument(int code, gchar const* rootname, State::SessionType type, Glib::ustring const& to) { - SPDocument* doc; + Document* doc; InkboardDocument* rdoc = new InkboardDocument(g_quark_from_static_string("xml"), type, to); rdoc->setAttribute("version", "1.0"); @@ -382,7 +382,7 @@ makeInkboardDocument(int code, gchar const* rootname, State::SessionType type, G // // \see sp_file_new SPDesktop* -makeInkboardDesktop(SPDocument* doc) +makeInkboardDesktop(Document* doc) { SPDesktop* dt; diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index de0535448..f92f7c2ab 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -246,7 +246,7 @@ Effect::New(EffectType lpenr, LivePathEffectObject *lpeobj) } void -Effect::createAndApply(const char* name, SPDocument *doc, SPItem *item) +Effect::createAndApply(const char* name, Document *doc, SPItem *item) { // Path effect definition Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc); @@ -263,7 +263,7 @@ Effect::createAndApply(const char* name, SPDocument *doc, SPItem *item) } void -Effect::createAndApply(EffectType type, SPDocument *doc, SPItem *item) +Effect::createAndApply(EffectType type, Document *doc, SPItem *item) { createAndApply(LPETypeConverter.get_key(type).c_str(), doc, item); } @@ -576,7 +576,7 @@ Effect::getRepr() return SP_OBJECT_REPR(lpeobj); } -SPDocument * +Document * Effect::getSPDoc() { if (SP_OBJECT_DOCUMENT(lpeobj) == NULL) g_message("Effect::getSPDoc() returns NULL"); diff --git a/src/live_effects/lpeobject.cpp b/src/live_effects/lpeobject.cpp index ec0dee0be..c7ca5e4aa 100644 --- a/src/live_effects/lpeobject.cpp +++ b/src/live_effects/lpeobject.cpp @@ -93,7 +93,7 @@ LivePathEffectObject::livepatheffect_init(LivePathEffectObject *lpeobj) * Virtual build: set livepatheffect attributes from its associated XML node. */ void -LivePathEffectObject::livepatheffect_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +LivePathEffectObject::livepatheffect_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) { #ifdef LIVEPATHEFFECT_VERBOSE g_message("Build livepatheffect"); @@ -250,7 +250,7 @@ LivePathEffectObject * LivePathEffectObject::fork_private_if_necessary(unsigned int nr_of_allowed_users) { if (SP_OBJECT_HREFCOUNT(this) > nr_of_allowed_users) { - SPDocument *doc = SP_OBJECT_DOCUMENT(this); + Document *doc = SP_OBJECT_DOCUMENT(this); Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc); Inkscape::XML::Node *repr = SP_OBJECT_REPR (this)->duplicate(xml_doc); diff --git a/src/trace/trace.cpp b/src/trace/trace.cpp index e2bd0e9f5..9afadbeaf 100644 --- a/src/trace/trace.cpp +++ b/src/trace/trace.cpp @@ -442,7 +442,7 @@ void Tracer::traceThread() engine = NULL; return; } - SPDocument *doc = SP_ACTIVE_DOCUMENT; + Document *doc = SP_ACTIVE_DOCUMENT; sp_document_ensure_up_to_date(doc); diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index 7e41006be..e7e8a29dc 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -126,13 +126,13 @@ private: void _copyTextPath(SPTextPath *); Inkscape::XML::Node *_copyNode(Inkscape::XML::Node *, Inkscape::XML::Document *, Inkscape::XML::Node *); - void _pasteDocument(SPDocument *, bool in_place); - void _pasteDefs(SPDocument *); + void _pasteDocument(Document *, bool in_place); + void _pasteDefs(Document *); bool _pasteImage(); bool _pasteText(); SPCSSAttr *_parseColor(const Glib::ustring &); void _applyPathEffect(SPItem *, gchar const *); - SPDocument *_retrieveClipboard(Glib::ustring = ""); + Document *_retrieveClipboard(Glib::ustring = ""); // clipboard callbacks void _onGet(Gtk::SelectionData &, guint); @@ -149,7 +149,7 @@ private: void _userWarn(SPDesktop *, char const *); // private properites - SPDocument *_clipboardSPDoc; ///< Document that stores the clipboard until someone requests it + Document *_clipboardSPDoc; ///< Document that stores the clipboard until someone requests it Inkscape::XML::Node *_defs; ///< Reference to the clipboard document's defs node Inkscape::XML::Node *_root; ///< Reference to the clipboard's root node Inkscape::XML::Node *_clipnode; ///< The node that holds extra information @@ -311,7 +311,7 @@ bool ClipboardManagerImpl::paste(bool in_place) if ( target == CLIPBOARD_TEXT_TARGET ) return _pasteText(); // otherwise, use the import extensions - SPDocument *tempdoc = _retrieveClipboard(target); + Document *tempdoc = _retrieveClipboard(target); if ( tempdoc == NULL ) { _userWarn(desktop, _("Nothing on the clipboard.")); return false; @@ -328,7 +328,7 @@ bool ClipboardManagerImpl::paste(bool in_place) */ const gchar *ClipboardManagerImpl::getFirstObjectID() { - SPDocument *tempdoc = _retrieveClipboard("image/x-inkscape-svg"); + Document *tempdoc = _retrieveClipboard("image/x-inkscape-svg"); if ( tempdoc == NULL ) { return NULL; } @@ -373,7 +373,7 @@ bool ClipboardManagerImpl::pasteStyle() return false; } - SPDocument *tempdoc = _retrieveClipboard("image/x-inkscape-svg"); + Document *tempdoc = _retrieveClipboard("image/x-inkscape-svg"); if ( tempdoc == NULL ) { // no document, but we can try _text_style if (_text_style) { @@ -425,7 +425,7 @@ bool ClipboardManagerImpl::pasteSize(bool separately, bool apply_x, bool apply_y } // FIXME: actually, this should accept arbitrary documents - SPDocument *tempdoc = _retrieveClipboard("image/x-inkscape-svg"); + Document *tempdoc = _retrieveClipboard("image/x-inkscape-svg"); if ( tempdoc == NULL ) { _userWarn(desktop, _("No size on the clipboard.")); return false; @@ -482,7 +482,7 @@ bool ClipboardManagerImpl::pastePathEffect() return false; } - SPDocument *tempdoc = _retrieveClipboard("image/x-inkscape-svg"); + Document *tempdoc = _retrieveClipboard("image/x-inkscape-svg"); if ( tempdoc ) { Inkscape::XML::Node *root = sp_document_repr_root(tempdoc); Inkscape::XML::Node *clipnode = sp_repr_lookup_name(root, "inkscape:clipboard", 1); @@ -513,7 +513,7 @@ bool ClipboardManagerImpl::pastePathEffect() */ Glib::ustring ClipboardManagerImpl::getPathParameter() { - SPDocument *tempdoc = _retrieveClipboard(); // any target will do here + Document *tempdoc = _retrieveClipboard(); // any target will do here if ( tempdoc == NULL ) { _userWarn(SP_ACTIVE_DESKTOP, _("Nothing on the clipboard.")); return ""; @@ -537,7 +537,7 @@ Glib::ustring ClipboardManagerImpl::getPathParameter() */ Glib::ustring ClipboardManagerImpl::getShapeOrTextObjectId() { - SPDocument *tempdoc = _retrieveClipboard(); // any target will do here + Document *tempdoc = _retrieveClipboard(); // any target will do here if ( tempdoc == NULL ) { _userWarn(SP_ACTIVE_DESKTOP, _("Nothing on the clipboard.")); return ""; @@ -769,10 +769,10 @@ Inkscape::XML::Node *ClipboardManagerImpl::_copyNode(Inkscape::XML::Node *node, * @param in_place Whether to paste the selection where it was when copied * @pre @c clipdoc is not empty and items can be added to the current layer */ -void ClipboardManagerImpl::_pasteDocument(SPDocument *clipdoc, bool in_place) +void ClipboardManagerImpl::_pasteDocument(Document *clipdoc, bool in_place) { SPDesktop *desktop = SP_ACTIVE_DESKTOP; - SPDocument *target_document = sp_desktop_document(desktop); + Document *target_document = sp_desktop_document(desktop); Inkscape::XML::Node *root = sp_document_repr_root(clipdoc), *target_parent = SP_OBJECT_REPR(desktop->currentLayer()); @@ -839,11 +839,11 @@ void ClipboardManagerImpl::_pasteDocument(SPDocument *clipdoc, bool in_place) * @param clipdoc The document to paste * @pre @c clipdoc != NULL and pasting into the active document is possible */ -void ClipboardManagerImpl::_pasteDefs(SPDocument *clipdoc) +void ClipboardManagerImpl::_pasteDefs(Document *clipdoc) { // boilerplate vars copied from _pasteDocument SPDesktop *desktop = SP_ACTIVE_DESKTOP; - SPDocument *target_document = sp_desktop_document(desktop); + Document *target_document = sp_desktop_document(desktop); Inkscape::XML::Node *root = sp_document_repr_root(clipdoc), *defs = sp_repr_lookup_name(root, "svg:defs", 1), @@ -863,7 +863,7 @@ void ClipboardManagerImpl::_pasteDefs(SPDocument *clipdoc) */ bool ClipboardManagerImpl::_pasteImage() { - SPDocument *doc = SP_ACTIVE_DOCUMENT; + Document *doc = SP_ACTIVE_DOCUMENT; if ( doc == NULL ) return false; // retrieve image data @@ -993,9 +993,9 @@ void ClipboardManagerImpl::_applyPathEffect(SPItem *item, gchar const *effect) /** * @brief Retrieve the clipboard contents as a document - * @return Clipboard contents converted to SPDocument, or NULL if no suitable content was present + * @return Clipboard contents converted to Document, or NULL if no suitable content was present */ -SPDocument *ClipboardManagerImpl::_retrieveClipboard(Glib::ustring required_target) +Document *ClipboardManagerImpl::_retrieveClipboard(Glib::ustring required_target) { Glib::ustring best_target; if ( required_target == "" ) @@ -1061,7 +1061,7 @@ SPDocument *ClipboardManagerImpl::_retrieveClipboard(Glib::ustring required_targ if ( in == inlist.end() ) return NULL; // this shouldn't happen unless _getBestTarget returns something bogus - SPDocument *tempdoc = NULL; + Document *tempdoc = NULL; try { tempdoc = (*in)->open(filename); } catch (...) { diff --git a/src/xml/rebase-hrefs.cpp b/src/xml/rebase-hrefs.cpp index ec43bb178..8d771fef2 100644 --- a/src/xml/rebase-hrefs.cpp +++ b/src/xml/rebase-hrefs.cpp @@ -199,7 +199,7 @@ Inkscape::XML::calc_abs_doc_base(gchar const *const doc_base) * * \param spns True iff doc should contain sodipodi:absref attributes. */ -void Inkscape::XML::rebase_hrefs(SPDocument *const doc, gchar const *const new_base, bool const spns) +void Inkscape::XML::rebase_hrefs(Document *const doc, gchar const *const new_base, bool const spns) { gchar *const old_abs_base = calc_abs_doc_base(doc->base); gchar *const new_abs_base = calc_abs_doc_base(new_base); -- cgit v1.2.3 From 56cbd9ce3b1f5116c22250d74ead66a0feb3ffa5 Mon Sep 17 00:00:00 2001 From: johnce Date: Wed, 5 Aug 2009 06:05:12 +0000 Subject: SPDocument->Document (bzr r8406) --- src/application/editor.h | 14 +++++++------- src/display/canvas-axonomgrid.h | 2 +- src/display/canvas-grid.h | 12 ++++++------ src/display/nr-filter-image.h | 4 ++-- src/extension/effect.h | 2 +- src/extension/extension.h | 26 +++++++++++++------------- src/extension/input.h | 2 +- src/extension/output.h | 4 ++-- src/extension/patheffect.h | 4 ++-- src/extension/print.h | 2 +- src/extension/system.h | 4 ++-- src/filters/image.h | 2 +- src/helper/pixbuf-ops.h | 6 +++--- src/helper/png-write.h | 6 +++--- src/live_effects/lpeobject.h | 2 +- src/ui/clipboard.h | 2 +- 16 files changed, 47 insertions(+), 47 deletions(-) (limited to 'src') diff --git a/src/application/editor.h b/src/application/editor.h index 4545022b8..0886555e9 100644 --- a/src/application/editor.h +++ b/src/application/editor.h @@ -22,7 +22,7 @@ #include "app-prototype.h" class SPDesktop; -class SPDocument; +class Document; class SPEventContext; namespace Inkscape { @@ -52,7 +52,7 @@ public: void refreshDisplay(); void exit(); - bool lastViewOfDocument(SPDocument* doc, SPDesktop* view) const; + bool lastViewOfDocument(Document* doc, SPDesktop* view) const; bool addView(SPDesktop* view); bool deleteView(SPDesktop* view); @@ -60,16 +60,16 @@ public: static Inkscape::XML::Document *getPreferences(); static SPDesktop* getActiveDesktop(); static bool isDesktopActive (SPDesktop* dt) { return getActiveDesktop()==dt; } - static SPDesktop* createDesktop (SPDocument* doc); + static SPDesktop* createDesktop (Document* doc); static void addDesktop (SPDesktop* dt); static void removeDesktop (SPDesktop* dt); static void activateDesktop (SPDesktop* dt); static void reactivateDesktop (SPDesktop* dt); static bool isDuplicatedView (SPDesktop* dt); - static SPDocument* getActiveDocument(); - static void addDocument (SPDocument* doc); - static void removeDocument (SPDocument* doc); + static Document* getActiveDocument(); + static void addDocument (Document* doc); + static void removeDocument (Document* doc); static void selectionModified (Inkscape::Selection*, guint); static void selectionChanged (Inkscape::Selection*); @@ -96,7 +96,7 @@ protected: Editor(Editor const &); Editor& operator=(Editor const &); - std::multiset _document_set; + std::multiset _document_set; GSList *_documents; GSList *_desktops; gchar *_argv0; diff --git a/src/display/canvas-axonomgrid.h b/src/display/canvas-axonomgrid.h index e36804d7c..b4a27c873 100644 --- a/src/display/canvas-axonomgrid.h +++ b/src/display/canvas-axonomgrid.h @@ -31,7 +31,7 @@ namespace Inkscape { class CanvasAxonomGrid : public CanvasGrid { public: - CanvasAxonomGrid(SPNamedView * nv, Inkscape::XML::Node * in_repr, SPDocument * in_doc); + CanvasAxonomGrid(SPNamedView * nv, Inkscape::XML::Node * in_repr, Document * in_doc); virtual ~CanvasAxonomGrid(); void Update (Geom::Matrix const &affine, unsigned int flags); diff --git a/src/display/canvas-grid.h b/src/display/canvas-grid.h index 58cfbf735..058f88ef8 100644 --- a/src/display/canvas-grid.h +++ b/src/display/canvas-grid.h @@ -26,7 +26,7 @@ struct SPDesktop; struct SPNamedView; -class SPDocument; +class Document; namespace Inkscape { @@ -73,8 +73,8 @@ public: static GridType getGridTypeFromSVGName(const char * typestr); static GridType getGridTypeFromName(const char * typestr); - static CanvasGrid* NewGrid(SPNamedView * nv, Inkscape::XML::Node * repr, SPDocument *doc, GridType gridtype); - static void writeNewGridToRepr(Inkscape::XML::Node * repr, SPDocument * doc, GridType gridtype); + static CanvasGrid* NewGrid(SPNamedView * nv, Inkscape::XML::Node * repr, Document *doc, GridType gridtype); + static void writeNewGridToRepr(Inkscape::XML::Node * repr, Document * doc, GridType gridtype); GridCanvasItem * createCanvasItem(SPDesktop * desktop); @@ -94,7 +94,7 @@ public: SPUnit const* gridunit; Inkscape::XML::Node * repr; - SPDocument *doc; + Document *doc; Inkscape::Snapper* snapper; @@ -104,7 +104,7 @@ public: bool isEnabled(); protected: - CanvasGrid(SPNamedView * nv, Inkscape::XML::Node * in_repr, SPDocument *in_doc, GridType type); + CanvasGrid(SPNamedView * nv, Inkscape::XML::Node * in_repr, Document *in_doc, GridType type); virtual Gtk::Widget * newSpecificWidget() = 0; @@ -125,7 +125,7 @@ private: class CanvasXYGrid : public CanvasGrid { public: - CanvasXYGrid(SPNamedView * nv, Inkscape::XML::Node * in_repr, SPDocument * in_doc); + CanvasXYGrid(SPNamedView * nv, Inkscape::XML::Node * in_repr, Document * in_doc); virtual ~CanvasXYGrid(); void Update (Geom::Matrix const &affine, unsigned int flags); diff --git a/src/display/nr-filter-image.h b/src/display/nr-filter-image.h index f3565ef9f..6fbc5d7eb 100644 --- a/src/display/nr-filter-image.h +++ b/src/display/nr-filter-image.h @@ -29,14 +29,14 @@ public: virtual int render(FilterSlot &slot, FilterUnits const &units); virtual FilterTraits get_input_traits(); - void set_document( SPDocument *document ); + void set_document( Document *document ); void set_href(const gchar *href); void set_region(SVGLength x, SVGLength y, SVGLength width, SVGLength height); bool from_element; SPItem* SVGElem; private: - SPDocument *document; + Document *document; gchar *feImageHref; guint8* image_pixbuf; Glib::RefPtr image; diff --git a/src/extension/effect.h b/src/extension/effect.h index c02ce542b..637d29c5c 100644 --- a/src/extension/effect.h +++ b/src/extension/effect.h @@ -21,7 +21,7 @@ #include "prefdialog.h" #include "extension.h" -struct SPDocument; +struct Document; namespace Inkscape { namespace UI { diff --git a/src/extension/extension.h b/src/extension/extension.h index 48ca86cf7..8dcd1b393 100644 --- a/src/extension/extension.h +++ b/src/extension/extension.h @@ -72,7 +72,7 @@ #define INKSCAPE_EXTENSION_NS_NC "extension" #define INKSCAPE_EXTENSION_NS "extension:" -struct SPDocument; +struct Document; namespace Inkscape { namespace Extension { @@ -173,42 +173,42 @@ private: #endif public: bool get_param_bool (const gchar * name, - const SPDocument * doc = NULL, + const Document * doc = NULL, const Inkscape::XML::Node * node = NULL); int get_param_int (const gchar * name, - const SPDocument * doc = NULL, + const Document * doc = NULL, const Inkscape::XML::Node * node = NULL); float get_param_float (const gchar * name, - const SPDocument * doc = NULL, + const Document * doc = NULL, const Inkscape::XML::Node * node = NULL); const gchar * get_param_string (const gchar * name, - const SPDocument * doc = NULL, + const Document * doc = NULL, const Inkscape::XML::Node * node = NULL); guint32 get_param_color (const gchar * name, - const SPDocument * doc = NULL, + const Document * doc = NULL, const Inkscape::XML::Node * node = NULL); const gchar * get_param_enum (const gchar * name, - const SPDocument * doc = NULL, + const Document * doc = NULL, const Inkscape::XML::Node * node = NULL); bool set_param_bool (const gchar * name, bool value, - SPDocument * doc = NULL, + Document * doc = NULL, Inkscape::XML::Node * node = NULL); int set_param_int (const gchar * name, int value, - SPDocument * doc = NULL, + Document * doc = NULL, Inkscape::XML::Node * node = NULL); float set_param_float (const gchar * name, float value, - SPDocument * doc = NULL, + Document * doc = NULL, Inkscape::XML::Node * node = NULL); const gchar * set_param_string (const gchar * name, const gchar * value, - SPDocument * doc = NULL, + Document * doc = NULL, Inkscape::XML::Node * node = NULL); guint32 set_param_color (const gchar * name, guint32 color, - SPDocument * doc = NULL, + Document * doc = NULL, Inkscape::XML::Node * node = NULL); /* Error file handling */ @@ -217,7 +217,7 @@ public: static void error_file_close (void); public: - Gtk::Widget * autogui (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal = NULL); + Gtk::Widget * autogui (Document * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal = NULL); void paramListString (std::list & retlist); /* Extension editor dialog stuff */ diff --git a/src/extension/input.h b/src/extension/input.h index 55d807ce2..d2aac9376 100644 --- a/src/extension/input.h +++ b/src/extension/input.h @@ -37,7 +37,7 @@ public: Implementation::Implementation * in_imp); virtual ~Input (void); virtual bool check (void); - SPDocument * open (gchar const *uri); + Document * open (gchar const *uri); gchar * get_mimetype (void); gchar * get_extension (void); gchar * get_filetypename (void); diff --git a/src/extension/output.h b/src/extension/output.h index b52a96211..455b4a8ae 100644 --- a/src/extension/output.h +++ b/src/extension/output.h @@ -15,7 +15,7 @@ #include #include "extension.h" -struct SPDocument; +struct Document; namespace Inkscape { namespace Extension { @@ -36,7 +36,7 @@ public: Implementation::Implementation * in_imp); virtual ~Output (void); virtual bool check (void); - void save (SPDocument *doc, + void save (Document *doc, gchar const *uri); bool prefs (void); gchar * get_mimetype(void); diff --git a/src/extension/patheffect.h b/src/extension/patheffect.h index 0c00ae093..7ad875048 100644 --- a/src/extension/patheffect.h +++ b/src/extension/patheffect.h @@ -22,10 +22,10 @@ public: PathEffect (Inkscape::XML::Node * in_repr, Implementation::Implementation * in_imp); virtual ~PathEffect (void); - void processPath (SPDocument * doc, + void processPath (Document * doc, Inkscape::XML::Node * path, Inkscape::XML::Node * def); - static void processPathEffects (SPDocument * doc, + static void processPathEffects (Document * doc, Inkscape::XML::Node * path); }; /* PathEffect */ diff --git a/src/extension/print.h b/src/extension/print.h index 8ae71b8e6..3240942d7 100644 --- a/src/extension/print.h +++ b/src/extension/print.h @@ -36,7 +36,7 @@ public: unsigned int setup (void); unsigned int set_preview (void); - unsigned int begin (SPDocument *doc); + unsigned int begin (Document *doc); unsigned int finish (void); /* Rendering methods */ diff --git a/src/extension/system.h b/src/extension/system.h index 6c23b2f0d..ada5f799c 100644 --- a/src/extension/system.h +++ b/src/extension/system.h @@ -21,8 +21,8 @@ namespace Inkscape { namespace Extension { -SPDocument *open(Extension *key, gchar const *filename); -void save(Extension *key, SPDocument *doc, gchar const *filename, +Document *open(Extension *key, gchar const *filename); +void save(Extension *key, Document *doc, gchar const *filename, bool setextension, bool check_overwrite, bool official); Print *get_print(gchar const *key); Extension *build_from_file(gchar const *filename); diff --git a/src/filters/image.h b/src/filters/image.h index 7207918e1..74352db80 100644 --- a/src/filters/image.h +++ b/src/filters/image.h @@ -27,7 +27,7 @@ struct SPFeImage : public SPFilterPrimitive { /** IMAGE ATTRIBUTES HERE */ gchar *href; SVGLength x, y, height, width; - SPDocument *document; + Document *document; bool from_element; SPItem* SVGElem; Inkscape::URIReference* SVGElemRef; diff --git a/src/helper/pixbuf-ops.h b/src/helper/pixbuf-ops.h index a985be297..de6a80181 100644 --- a/src/helper/pixbuf-ops.h +++ b/src/helper/pixbuf-ops.h @@ -14,12 +14,12 @@ #include -struct SPDocument; +struct Document; -bool sp_export_jpg_file (SPDocument *doc, gchar const *filename, double x0, double y0, double x1, double y1, +bool sp_export_jpg_file (Document *doc, gchar const *filename, double x0, double y0, double x1, double y1, unsigned int width, unsigned int height, double xdpi, double ydpi, unsigned long bgcolor, double quality, GSList *items_only = NULL); -GdkPixbuf* sp_generate_internal_bitmap(SPDocument *doc, gchar const *filename, +GdkPixbuf* sp_generate_internal_bitmap(Document *doc, gchar const *filename, double x0, double y0, double x1, double y1, unsigned width, unsigned height, double xdpi, double ydpi, unsigned long bgcolor, GSList *items_only = NULL); diff --git a/src/helper/png-write.h b/src/helper/png-write.h index 83321aa4e..f7e372e0b 100644 --- a/src/helper/png-write.h +++ b/src/helper/png-write.h @@ -14,14 +14,14 @@ #include #include <2geom/forward.h> -struct SPDocument; +struct Document; -bool sp_export_png_file (SPDocument *doc, gchar const *filename, +bool sp_export_png_file (Document *doc, gchar const *filename, double x0, double y0, double x1, double y1, unsigned long int width, unsigned long int height, double xdpi, double ydpi, unsigned long bgcolor, unsigned int (*status) (float, void *), void *data, bool force_overwrite = false, GSList *items_only = NULL); -bool sp_export_png_file (SPDocument *doc, gchar const *filename, +bool sp_export_png_file (Document *doc, gchar const *filename, Geom::Rect const &area, unsigned long int width, unsigned long int height, double xdpi, double ydpi, unsigned long bgcolor, diff --git a/src/live_effects/lpeobject.h b/src/live_effects/lpeobject.h index dc631a5c1..842b84c45 100644 --- a/src/live_effects/lpeobject.h +++ b/src/live_effects/lpeobject.h @@ -49,7 +49,7 @@ public: private: static void livepatheffect_class_init(LivePathEffectObjectClass *klass); static void livepatheffect_init(LivePathEffectObject *stop); - static void livepatheffect_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); + static void livepatheffect_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); static void livepatheffect_release(SPObject *object); static void livepatheffect_set(SPObject *object, unsigned key, gchar const *value); static Inkscape::XML::Node *livepatheffect_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); diff --git a/src/ui/clipboard.h b/src/ui/clipboard.h index 54c05ac0d..467888ed7 100644 --- a/src/ui/clipboard.h +++ b/src/ui/clipboard.h @@ -31,7 +31,7 @@ namespace UI { * @brief System-wide clipboard manager * * ClipboardManager takes care of manipulating the system clipboard in response - * to user actions. It holds a complete SPDocument as the contents. This document + * to user actions. It holds a complete Document as the contents. This document * is exported using output extensions when other applications request data. * Copying to another instance of Inkscape is special-cased, because of the extra * data required (i.e. style, size, Live Path Effects parameters, etc.) -- cgit v1.2.3 From feea521541c5d36d23a5fefa579eb9c8323ac30e Mon Sep 17 00:00:00 2001 From: johnce Date: Wed, 5 Aug 2009 06:21:55 +0000 Subject: SPDocument->Document (bzr r8407) --- src/extension/implementation/implementation.h | 6 ++--- src/extension/implementation/script.h | 4 ++-- src/extension/implementation/xslt.h | 4 ++-- src/extension/internal/cairo-png-out.h | 2 +- src/extension/internal/cairo-ps-out.h | 4 ++-- src/extension/internal/cairo-renderer-pdf-out.h | 2 +- src/extension/internal/cairo-renderer.h | 4 ++-- src/extension/internal/emf-win32-inout.h | 4 ++-- src/extension/internal/emf-win32-print.h | 2 +- src/extension/internal/gdkpixbuf-input.h | 2 +- src/extension/internal/gimpgrad.h | 2 +- src/extension/internal/javafx-out.h | 10 ++++----- src/extension/internal/latex-pstricks-out.h | 2 +- src/extension/internal/latex-pstricks.h | 2 +- src/extension/internal/odf.h | 2 +- src/extension/internal/pdf-input-cairo.h | 2 +- src/extension/internal/pov-out.h | 8 +++---- src/extension/internal/svg.h | 4 ++-- src/extension/internal/win32.h | 2 +- src/extension/internal/wpg-input.h | 2 +- src/extension/param/bool.h | 6 ++--- src/extension/param/color.h | 6 ++--- src/extension/param/description.h | 2 +- src/extension/param/enum.h | 6 ++--- src/extension/param/float.h | 6 ++--- src/extension/param/int.h | 6 ++--- src/extension/param/notebook.h | 6 ++--- src/extension/param/parameter.h | 26 ++++++++++----------- src/extension/param/radiobutton.h | 6 ++--- src/extension/param/string.h | 6 ++--- src/ui/dialog/document-metadata.h | 2 +- src/ui/dialog/document-properties.h | 2 +- src/ui/dialog/filedialogimpl-gtkmm.h | 4 ++-- src/ui/dialog/filter-effects-dialog.h | 2 +- src/ui/dialog/layers.h | 2 +- src/ui/dialog/panel-dialog.h | 4 ++-- src/ui/dialog/print.h | 6 ++--- src/ui/dialog/swatches.h | 4 ++-- src/ui/dialog/undo-history.h | 2 +- src/ui/view/edit-widget.h | 6 ++--- src/ui/view/view.h | 8 +++---- src/ui/widget/entity-entry.h | 8 +++---- src/ui/widget/imageicon.h | 6 ++--- src/ui/widget/layer-selector.h | 2 +- src/ui/widget/licensor.h | 4 ++-- src/ui/widget/panel.h | 4 ++-- src/ui/widget/registered-enums.h | 2 +- src/ui/widget/registered-widget.h | 30 ++++++++++++------------- 48 files changed, 122 insertions(+), 122 deletions(-) (limited to 'src') diff --git a/src/extension/implementation/implementation.h b/src/extension/implementation/implementation.h index 9de70dce7..9f1894d95 100644 --- a/src/extension/implementation/implementation.h +++ b/src/extension/implementation/implementation.h @@ -70,13 +70,13 @@ public: virtual Gtk::Widget *prefs_input(Inkscape::Extension::Input *module, gchar const *filename); - virtual SPDocument *open(Inkscape::Extension::Input *module, + virtual Document *open(Inkscape::Extension::Input *module, gchar const *filename); /* ----- Output functions ----- */ /** Find out information about the file. */ virtual Gtk::Widget *prefs_output(Inkscape::Extension::Output *module); - virtual void save(Inkscape::Extension::Output *module, SPDocument *doc, gchar const *filename); + virtual void save(Inkscape::Extension::Output *module, Document *doc, gchar const *filename); /* ----- Effect functions ----- */ /** Find out information about the file. */ @@ -93,7 +93,7 @@ public: virtual unsigned set_preview(Inkscape::Extension::Print *module); virtual unsigned begin(Inkscape::Extension::Print *module, - SPDocument *doc); + Document *doc); virtual unsigned finish(Inkscape::Extension::Print *module); virtual bool textToPath(Inkscape::Extension::Print *ext); virtual bool fontEmbedded(Inkscape::Extension::Print * ext); diff --git a/src/extension/implementation/script.h b/src/extension/implementation/script.h index 8e25fb351..0769c9a18 100644 --- a/src/extension/implementation/script.h +++ b/src/extension/implementation/script.h @@ -73,7 +73,7 @@ public: /** * */ - virtual SPDocument *open(Inkscape::Extension::Input *module, + virtual Document *open(Inkscape::Extension::Input *module, gchar const *filename); /** @@ -85,7 +85,7 @@ public: * */ virtual void save(Inkscape::Extension::Output *module, - SPDocument *doc, + Document *doc, gchar const *filename); /** diff --git a/src/extension/implementation/xslt.h b/src/extension/implementation/xslt.h index 45befb529..df9467d9e 100644 --- a/src/extension/implementation/xslt.h +++ b/src/extension/implementation/xslt.h @@ -44,9 +44,9 @@ public: bool check(Inkscape::Extension::Extension *module); - SPDocument *open(Inkscape::Extension::Input *module, + Document *open(Inkscape::Extension::Input *module, gchar const *filename); - void save(Inkscape::Extension::Output *module, SPDocument *doc, gchar const *filename); + void save(Inkscape::Extension::Output *module, Document *doc, gchar const *filename); }; } /* Inkscape */ diff --git a/src/extension/internal/cairo-png-out.h b/src/extension/internal/cairo-png-out.h index 9b9bd6ffe..a062ec8df 100644 --- a/src/extension/internal/cairo-png-out.h +++ b/src/extension/internal/cairo-png-out.h @@ -27,7 +27,7 @@ class CairoRendererOutput : Inkscape::Extension::Implementation::Implementation public: bool check(Inkscape::Extension::Extension *module); void save(Inkscape::Extension::Output *mod, - SPDocument *doc, + Document *doc, gchar const *filename); static void init(); }; diff --git a/src/extension/internal/cairo-ps-out.h b/src/extension/internal/cairo-ps-out.h index 019b6b810..862571f0b 100644 --- a/src/extension/internal/cairo-ps-out.h +++ b/src/extension/internal/cairo-ps-out.h @@ -28,7 +28,7 @@ class CairoPsOutput : Inkscape::Extension::Implementation::Implementation { public: bool check(Inkscape::Extension::Extension *module); void save(Inkscape::Extension::Output *mod, - SPDocument *doc, + Document *doc, gchar const *filename); static void init(); bool textToPath(Inkscape::Extension::Print *ext); @@ -40,7 +40,7 @@ class CairoEpsOutput : Inkscape::Extension::Implementation::Implementation { public: bool check(Inkscape::Extension::Extension *module); void save(Inkscape::Extension::Output *mod, - SPDocument *doc, + Document *doc, gchar const *uri); static void init(); bool textToPath(Inkscape::Extension::Print *ext); diff --git a/src/extension/internal/cairo-renderer-pdf-out.h b/src/extension/internal/cairo-renderer-pdf-out.h index d76ffb4d4..f916eed49 100644 --- a/src/extension/internal/cairo-renderer-pdf-out.h +++ b/src/extension/internal/cairo-renderer-pdf-out.h @@ -27,7 +27,7 @@ class CairoRendererPdfOutput : Inkscape::Extension::Implementation::Implementati public: bool check(Inkscape::Extension::Extension *module); void save(Inkscape::Extension::Output *mod, - SPDocument *doc, + Document *doc, gchar const *filename); static void init(); }; diff --git a/src/extension/internal/cairo-renderer.h b/src/extension/internal/cairo-renderer.h index ab5d4cf58..4197c6784 100644 --- a/src/extension/internal/cairo-renderer.h +++ b/src/extension/internal/cairo-renderer.h @@ -50,9 +50,9 @@ public: void applyMask(CairoRenderContext *ctx, SPMask const *mask); /** Initializes the CairoRenderContext according to the specified - SPDocument. A set*Target function can only be called on the context + Document. A set*Target function can only be called on the context before setupDocument. */ - bool setupDocument(CairoRenderContext *ctx, SPDocument *doc, bool pageBoundingBox, SPItem *base); + bool setupDocument(CairoRenderContext *ctx, Document *doc, bool pageBoundingBox, SPItem *base); /** Traverses the object tree and invokes the render methods. */ void renderItem(CairoRenderContext *ctx, SPItem *item); diff --git a/src/extension/internal/emf-win32-inout.h b/src/extension/internal/emf-win32-inout.h index c62d7a4e9..544cd75db 100644 --- a/src/extension/internal/emf-win32-inout.h +++ b/src/extension/internal/emf-win32-inout.h @@ -28,10 +28,10 @@ public: bool check(Inkscape::Extension::Extension *module); //Can this module load (always yes for now) void save(Inkscape::Extension::Output *mod, // Save the given document to the given filename - SPDocument *doc, + Document *doc, gchar const *filename); - virtual SPDocument *open( Inkscape::Extension::Input *mod, + virtual Document *open( Inkscape::Extension::Input *mod, const gchar *uri ); static void init(void);//Initialize the class diff --git a/src/extension/internal/emf-win32-print.h b/src/extension/internal/emf-win32-print.h index 5c1d8439d..bec3f9582 100644 --- a/src/extension/internal/emf-win32-print.h +++ b/src/extension/internal/emf-win32-print.h @@ -55,7 +55,7 @@ public: /* Print functions */ virtual unsigned int setup (Inkscape::Extension::Print * module); - virtual unsigned int begin (Inkscape::Extension::Print * module, SPDocument *doc); + virtual unsigned int begin (Inkscape::Extension::Print * module, Document *doc); virtual unsigned int finish (Inkscape::Extension::Print * module); /* Rendering methods */ diff --git a/src/extension/internal/gdkpixbuf-input.h b/src/extension/internal/gdkpixbuf-input.h index 9d5e6ccf7..373d53da3 100644 --- a/src/extension/internal/gdkpixbuf-input.h +++ b/src/extension/internal/gdkpixbuf-input.h @@ -9,7 +9,7 @@ namespace Internal { class GdkpixbufInput : Inkscape::Extension::Implementation::Implementation { public: - SPDocument *open(Inkscape::Extension::Input *mod, + Document *open(Inkscape::Extension::Input *mod, gchar const *uri); static void init(); }; diff --git a/src/extension/internal/gimpgrad.h b/src/extension/internal/gimpgrad.h index 45b76dd6d..21ccfa215 100644 --- a/src/extension/internal/gimpgrad.h +++ b/src/extension/internal/gimpgrad.h @@ -26,7 +26,7 @@ class GimpGrad : public Inkscape::Extension::Implementation::Implementation { public: bool load(Inkscape::Extension::Extension *module); void unload(Inkscape::Extension::Extension *module); - SPDocument *open(Inkscape::Extension::Input *module, gchar const *filename); + Document *open(Inkscape::Extension::Input *module, gchar const *filename); static void init(); }; diff --git a/src/extension/internal/javafx-out.h b/src/extension/internal/javafx-out.h index 9c1c8778b..246172c23 100644 --- a/src/extension/internal/javafx-out.h +++ b/src/extension/internal/javafx-out.h @@ -56,7 +56,7 @@ public: * API call to perform the output to a file */ virtual void save(Inkscape::Extension::Output *mod, - SPDocument *doc, gchar const *filename); + Document *doc, gchar const *filename); /** * Inkscape runtime startup call. @@ -109,10 +109,10 @@ private: * Output the SVG document's curve data as JavaFX geometry types */ bool doCurve(SPItem *item, const String &id); - bool doTreeRecursive(SPDocument *doc, SPObject *obj); - bool doTree(SPDocument *doc); + bool doTreeRecursive(Document *doc, SPObject *obj); + bool doTree(Document *doc); - bool doBody(SPDocument *doc, SPObject *obj); + bool doBody(Document *doc, SPObject *obj); /** * Output the file footer @@ -124,7 +124,7 @@ private: /** * Actual method to save document */ - bool saveDocument(SPDocument *doc, gchar const *filename); + bool saveDocument(Document *doc, gchar const *filename); //For statistics int nrNodes; diff --git a/src/extension/internal/latex-pstricks-out.h b/src/extension/internal/latex-pstricks-out.h index a12cdc3c1..a9910f4cc 100644 --- a/src/extension/internal/latex-pstricks-out.h +++ b/src/extension/internal/latex-pstricks-out.h @@ -27,7 +27,7 @@ public: bool check(Inkscape::Extension::Extension *module); //Can this module load (always yes for now) void save(Inkscape::Extension::Output *mod, // Save the given document to the given filename - SPDocument *doc, + Document *doc, gchar const *filename); static void init(void);//Initialize the class diff --git a/src/extension/internal/latex-pstricks.h b/src/extension/internal/latex-pstricks.h index a33e169e8..4e310d6fd 100644 --- a/src/extension/internal/latex-pstricks.h +++ b/src/extension/internal/latex-pstricks.h @@ -43,7 +43,7 @@ public: /* Print functions */ virtual unsigned int setup (Inkscape::Extension::Print * module); - virtual unsigned int begin (Inkscape::Extension::Print * module, SPDocument *doc); + virtual unsigned int begin (Inkscape::Extension::Print * module, Document *doc); virtual unsigned int finish (Inkscape::Extension::Print * module); /* Rendering methods */ diff --git a/src/extension/internal/odf.h b/src/extension/internal/odf.h index 3854ddfe1..5ad1f1137 100644 --- a/src/extension/internal/odf.h +++ b/src/extension/internal/odf.h @@ -272,7 +272,7 @@ public: bool check (Inkscape::Extension::Extension * module); void save (Inkscape::Extension::Output *mod, - SPDocument *doc, + Document *doc, gchar const *filename); static void init (void); diff --git a/src/extension/internal/pdf-input-cairo.h b/src/extension/internal/pdf-input-cairo.h index 5715b57c9..15080bc14 100644 --- a/src/extension/internal/pdf-input-cairo.h +++ b/src/extension/internal/pdf-input-cairo.h @@ -27,7 +27,7 @@ namespace Internal { class PdfInputCairo: public Inkscape::Extension::Implementation::Implementation { PdfInputCairo () { }; public: - SPDocument *open( Inkscape::Extension::Input *mod, + Document *open( Inkscape::Extension::Input *mod, const gchar *uri ); static void init( void ); diff --git a/src/extension/internal/pov-out.h b/src/extension/internal/pov-out.h index 0c3b73a7f..02ba6da82 100644 --- a/src/extension/internal/pov-out.h +++ b/src/extension/internal/pov-out.h @@ -57,7 +57,7 @@ public: * API call to perform the output to a file */ void save(Inkscape::Extension::Output *mod, - SPDocument *doc, gchar const *filename); + Document *doc, gchar const *filename); /** * Inkscape runtime startup call. @@ -120,13 +120,13 @@ private: * Output the SVG document's curve data as POV curves */ bool doCurve(SPItem *item, const String &id); - bool doTreeRecursive(SPDocument *doc, SPObject *obj); - bool doTree(SPDocument *doc); + bool doTreeRecursive(Document *doc, SPObject *obj); + bool doTree(Document *doc); /** * Actual method to save document */ - void saveDocument(SPDocument *doc, gchar const *filename); + void saveDocument(Document *doc, gchar const *filename); /** diff --git a/src/extension/internal/svg.h b/src/extension/internal/svg.h index b97735dd8..48b57c8c5 100644 --- a/src/extension/internal/svg.h +++ b/src/extension/internal/svg.h @@ -25,9 +25,9 @@ class Svg : public Inkscape::Extension::Implementation::Implementation { public: virtual void save( Inkscape::Extension::Output *mod, - SPDocument *doc, + Document *doc, gchar const *filename ); - virtual SPDocument *open( Inkscape::Extension::Input *mod, + virtual Document *open( Inkscape::Extension::Input *mod, const gchar *uri ); static void init( void ); diff --git a/src/extension/internal/win32.h b/src/extension/internal/win32.h index 9462115c6..7f4b9352d 100644 --- a/src/extension/internal/win32.h +++ b/src/extension/internal/win32.h @@ -65,7 +65,7 @@ public: virtual unsigned int setup (Inkscape::Extension::Print * module); //virtual unsigned int set_preview (Inkscape::Extension::Print * module); - virtual unsigned int begin (Inkscape::Extension::Print * module, SPDocument *doc); + virtual unsigned int begin (Inkscape::Extension::Print * module, Document *doc); virtual unsigned int finish (Inkscape::Extension::Print * module); /* Rendering methods */ diff --git a/src/extension/internal/wpg-input.h b/src/extension/internal/wpg-input.h index ca882039b..e5c2838d5 100644 --- a/src/extension/internal/wpg-input.h +++ b/src/extension/internal/wpg-input.h @@ -24,7 +24,7 @@ namespace Internal { class WpgInput : public Inkscape::Extension::Implementation::Implementation { WpgInput () { }; public: - SPDocument *open( Inkscape::Extension::Input *mod, + Document *open( Inkscape::Extension::Input *mod, const gchar *uri ); static void init( void ); diff --git a/src/extension/param/bool.h b/src/extension/param/bool.h index a1cd4ce4a..23b15596d 100644 --- a/src/extension/param/bool.h +++ b/src/extension/param/bool.h @@ -22,9 +22,9 @@ private: bool _value; public: ParamBool(const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml); - bool get (const SPDocument * doc, const Inkscape::XML::Node * node); - bool set (bool in, SPDocument * doc, Inkscape::XML::Node * node); - Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); + bool get (const Document * doc, const Inkscape::XML::Node * node); + bool set (bool in, Document * doc, Inkscape::XML::Node * node); + Gtk::Widget * get_widget(Document * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); void string (std::string &string); }; diff --git a/src/extension/param/color.h b/src/extension/param/color.h index e6b44fbcb..89aac7be7 100644 --- a/src/extension/param/color.h +++ b/src/extension/param/color.h @@ -23,9 +23,9 @@ public: ParamColor(const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml); virtual ~ParamColor(void); /** \brief Returns \c _value, with a \i const to protect it. */ - guint32 get( const SPDocument * /*doc*/, const Inkscape::XML::Node * /*node*/ ) { return _value; } - guint32 set (guint32 in, SPDocument * doc, Inkscape::XML::Node * node); - Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); + guint32 get( const Document * /*doc*/, const Inkscape::XML::Node * /*node*/ ) { return _value; } + guint32 set (guint32 in, Document * doc, Inkscape::XML::Node * node); + Gtk::Widget * get_widget(Document * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); void string (std::string &string); sigc::signal * _changeSignal; }; /* class ParamColor */ diff --git a/src/extension/param/description.h b/src/extension/param/description.h index c305ea6df..42441e5a9 100644 --- a/src/extension/param/description.h +++ b/src/extension/param/description.h @@ -23,7 +23,7 @@ private: gchar * _value; public: ParamDescription(const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml); - Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); + Gtk::Widget * get_widget(Document * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); }; } /* namespace Extension */ diff --git a/src/extension/param/enum.h b/src/extension/param/enum.h index 3f9707c34..e1af8fd2b 100644 --- a/src/extension/param/enum.h +++ b/src/extension/param/enum.h @@ -39,11 +39,11 @@ private: public: ParamComboBox(const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml); virtual ~ParamComboBox(void); - Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); + Gtk::Widget * get_widget(Document * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); void string (std::string &string); - const gchar * get (const SPDocument * /*doc*/, const Inkscape::XML::Node * /*node*/) { return _value; } - const gchar * set (const gchar * in, SPDocument * doc, Inkscape::XML::Node * node); + const gchar * get (const Document * /*doc*/, const Inkscape::XML::Node * /*node*/) { return _value; } + const gchar * set (const gchar * in, Document * doc, Inkscape::XML::Node * node); void changed (void); }; /* class ParamComboBox */ diff --git a/src/extension/param/float.h b/src/extension/param/float.h index f105d8f0e..32ab7a796 100644 --- a/src/extension/param/float.h +++ b/src/extension/param/float.h @@ -26,12 +26,12 @@ private: public: ParamFloat (const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml); /** \brief Returns \c _value */ - float get (const SPDocument * /*doc*/, const Inkscape::XML::Node * /*node*/) { return _value; } - float set (float in, SPDocument * doc, Inkscape::XML::Node * node); + float get (const Document * /*doc*/, const Inkscape::XML::Node * /*node*/) { return _value; } + float set (float in, Document * doc, Inkscape::XML::Node * node); float max (void) { return _max; } float min (void) { return _min; } float precision (void) { return _precision; } - Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); + Gtk::Widget * get_widget(Document * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); void string (std::string &string); }; diff --git a/src/extension/param/int.h b/src/extension/param/int.h index a4eb54c81..6d44a10b3 100644 --- a/src/extension/param/int.h +++ b/src/extension/param/int.h @@ -25,11 +25,11 @@ private: public: ParamInt (const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml); /** \brief Returns \c _value */ - int get (const SPDocument * /*doc*/, const Inkscape::XML::Node * /*node*/) { return _value; } - int set (int in, SPDocument * doc, Inkscape::XML::Node * node); + int get (const Document * /*doc*/, const Inkscape::XML::Node * /*node*/) { return _value; } + int set (int in, Document * doc, Inkscape::XML::Node * node); int max (void) { return _max; } int min (void) { return _min; } - Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); + Gtk::Widget * get_widget(Document * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); void string (std::string &string); }; diff --git a/src/extension/param/notebook.h b/src/extension/param/notebook.h index 24d4ebfc1..6efd3c5f1 100644 --- a/src/extension/param/notebook.h +++ b/src/extension/param/notebook.h @@ -40,11 +40,11 @@ private: public: ParamNotebook(const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml); virtual ~ParamNotebook(void); - Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); + Gtk::Widget * get_widget(Document * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); void string (std::list &list); - const gchar * get (const SPDocument * /*doc*/, const Inkscape::XML::Node * /*node*/) { return _value; } - const gchar * set (const int in, SPDocument * doc, Inkscape::XML::Node * node); + const gchar * get (const Document * /*doc*/, const Inkscape::XML::Node * /*node*/) { return _value; } + const gchar * set (const int in, Document * doc, Inkscape::XML::Node * node); }; /* class ParamNotebook */ diff --git a/src/extension/param/parameter.h b/src/extension/param/parameter.h index 54249c12e..a79b2fd6b 100644 --- a/src/extension/param/parameter.h +++ b/src/extension/param/parameter.h @@ -68,7 +68,7 @@ protected: /* **** funcs **** */ gchar * pref_name (void); Inkscape::XML::Node * find_child (Inkscape::XML::Node * adult); - Inkscape::XML::Node * document_param_node (SPDocument * doc); + Inkscape::XML::Node * document_param_node (Document * doc); Inkscape::XML::Node * new_child (Inkscape::XML::Node * parent); public: @@ -85,29 +85,29 @@ public: Parameter(name, guitext, NULL, Parameter::SCOPE_USER, false, NULL, ext); }; virtual ~Parameter (void); - bool get_bool (const SPDocument * doc, + bool get_bool (const Document * doc, const Inkscape::XML::Node * node); - int get_int (const SPDocument * doc, + int get_int (const Document * doc, const Inkscape::XML::Node * node); - float get_float (const SPDocument * doc, + float get_float (const Document * doc, const Inkscape::XML::Node * node); - const gchar * get_string (const SPDocument * doc, + const gchar * get_string (const Document * doc, const Inkscape::XML::Node * node); - guint32 get_color (const SPDocument * doc, + guint32 get_color (const Document * doc, const Inkscape::XML::Node * node); - const gchar * get_enum (const SPDocument * doc, + const gchar * get_enum (const Document * doc, const Inkscape::XML::Node * node); - bool set_bool (bool in, SPDocument * doc, Inkscape::XML::Node * node); - int set_int (int in, SPDocument * doc, Inkscape::XML::Node * node); - float set_float (float in, SPDocument * doc, Inkscape::XML::Node * node); - const gchar * set_string (const gchar * in, SPDocument * doc, Inkscape::XML::Node * node); - guint32 set_color (guint32 in, SPDocument * doc, Inkscape::XML::Node * node); + bool set_bool (bool in, Document * doc, Inkscape::XML::Node * node); + int set_int (int in, Document * doc, Inkscape::XML::Node * node); + float set_float (float in, Document * doc, Inkscape::XML::Node * node); + const gchar * set_string (const gchar * in, Document * doc, Inkscape::XML::Node * node); + guint32 set_color (guint32 in, Document * doc, Inkscape::XML::Node * node); const gchar * name (void) {return _name;} static Parameter * make (Inkscape::XML::Node * in_repr, Inkscape::Extension::Extension * in_ext); - virtual Gtk::Widget * get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); + virtual Gtk::Widget * get_widget (Document * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); gchar const * get_tooltip (void) { return _desc; } diff --git a/src/extension/param/radiobutton.h b/src/extension/param/radiobutton.h index ea8440de2..ec35c2c53 100644 --- a/src/extension/param/radiobutton.h +++ b/src/extension/param/radiobutton.h @@ -43,11 +43,11 @@ public: Inkscape::XML::Node * xml, AppearanceMode mode); virtual ~ParamRadioButton(void); - Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); + Gtk::Widget * get_widget(Document * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); void string (std::string &string); - const gchar * get (const SPDocument * /*doc*/, const Inkscape::XML::Node * /*node*/) { return _value; } - const gchar * set (const gchar * in, SPDocument * doc, Inkscape::XML::Node * node); + const gchar * get (const Document * /*doc*/, const Inkscape::XML::Node * /*node*/) { return _value; } + const gchar * set (const gchar * in, Document * doc, Inkscape::XML::Node * node); private: /** \brief Internal value. This should point to a string that has diff --git a/src/extension/param/string.h b/src/extension/param/string.h index 10f45e5ac..0eb116a53 100644 --- a/src/extension/param/string.h +++ b/src/extension/param/string.h @@ -28,9 +28,9 @@ public: ParamString(const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml); virtual ~ParamString(void); /** \brief Returns \c _value, with a \i const to protect it. */ - const gchar * get (const SPDocument * /*doc*/, const Inkscape::XML::Node * /*node*/) { return _value; } - const gchar * set (const gchar * in, SPDocument * doc, Inkscape::XML::Node * node); - Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); + const gchar * get (const Document * /*doc*/, const Inkscape::XML::Node * /*node*/) { return _value; } + const gchar * set (const gchar * in, Document * doc, Inkscape::XML::Node * node); + Gtk::Widget * get_widget(Document * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); void string (std::string &string); void setMaxLength(int maxLenght) { _max_length = maxLenght; } int getMaxLength(void) { return _max_length; } diff --git a/src/ui/dialog/document-metadata.h b/src/ui/dialog/document-metadata.h index 7f718e9f7..2bc94836b 100644 --- a/src/ui/dialog/document-metadata.h +++ b/src/ui/dialog/document-metadata.h @@ -49,7 +49,7 @@ protected: void build_metadata(); void init(); - void _handleDocumentReplaced(SPDesktop* desktop, SPDocument *document); + void _handleDocumentReplaced(SPDesktop* desktop, Document *document); void _handleActivateDesktop(Inkscape::Application *application, SPDesktop *desktop); void _handleDeactivateDesktop(Inkscape::Application *application, SPDesktop *desktop); diff --git a/src/ui/dialog/document-properties.h b/src/ui/dialog/document-properties.h index 136ae2c89..5aa8d446d 100644 --- a/src/ui/dialog/document-properties.h +++ b/src/ui/dialog/document-properties.h @@ -70,7 +70,7 @@ protected: void removeExternalScript(); void scripting_create_popup_menu(Gtk::Widget& parent, sigc::slot rem); - void _handleDocumentReplaced(SPDesktop* desktop, SPDocument *document); + void _handleDocumentReplaced(SPDesktop* desktop, Document *document); void _handleActivateDesktop(Inkscape::Application *application, SPDesktop *desktop); void _handleDeactivateDesktop(Inkscape::Application *application, SPDesktop *desktop); diff --git a/src/ui/dialog/filedialogimpl-gtkmm.h b/src/ui/dialog/filedialogimpl-gtkmm.h index 90dddce59..bd0477b30 100644 --- a/src/ui/dialog/filedialogimpl-gtkmm.h +++ b/src/ui/dialog/filedialogimpl-gtkmm.h @@ -99,7 +99,7 @@ public: ~SVGPreview(); - bool setDocument(SPDocument *doc); + bool setDocument(Document *doc); bool setFileName(Glib::ustring &fileName); @@ -128,7 +128,7 @@ private: /** * The svg document we are currently showing */ - SPDocument *document; + Document *document; /** * The sp_svg_view widget diff --git a/src/ui/dialog/filter-effects-dialog.h b/src/ui/dialog/filter-effects-dialog.h index 3fb9a46fb..28c714905 100644 --- a/src/ui/dialog/filter-effects-dialog.h +++ b/src/ui/dialog/filter-effects-dialog.h @@ -88,7 +88,7 @@ private: static void on_activate_desktop(Application*, SPDesktop*, FilterModifier*); static void on_deactivate_desktop(Application*, SPDesktop*, FilterModifier*); - void on_document_replaced(SPDesktop*, SPDocument*) + void on_document_replaced(SPDesktop*, Document*) { update_filters(); } diff --git a/src/ui/dialog/layers.h b/src/ui/dialog/layers.h index 16b3be350..c5f945437 100644 --- a/src/ui/dialog/layers.h +++ b/src/ui/dialog/layers.h @@ -86,7 +86,7 @@ private: bool _checkForSelected(const Gtk::TreePath& path, const Gtk::TreeIter& iter, SPObject* layer); void _layersChanged(); - void _addLayer( SPDocument* doc, SPObject* layer, Gtk::TreeModel::Row* parentRow, SPObject* target, int level ); + void _addLayer( Document* doc, SPObject* layer, Gtk::TreeModel::Row* parentRow, SPObject* target, int level ); SPObject* _selectedLayer(); diff --git a/src/ui/dialog/panel-dialog.h b/src/ui/dialog/panel-dialog.h index 7dbb6dd4a..5fc4a9134 100644 --- a/src/ui/dialog/panel-dialog.h +++ b/src/ui/dialog/panel-dialog.h @@ -50,7 +50,7 @@ protected: static_cast(data)->_propagateDesktopActivated(application, desktop); } - inline virtual void _propagateDocumentReplaced(SPDesktop* desktop, SPDocument *document); + inline virtual void _propagateDocumentReplaced(SPDesktop* desktop, Document *document); inline virtual void _propagateDesktopActivated(Inkscape::Application *, SPDesktop *); inline virtual void _propagateDesktopDeactivated(Inkscape::Application *, SPDesktop *); @@ -106,7 +106,7 @@ private: void -PanelDialogBase::_propagateDocumentReplaced(SPDesktop *desktop, SPDocument *document) +PanelDialogBase::_propagateDocumentReplaced(SPDesktop *desktop, Document *document) { _panel.signalDocumentReplaced().emit(desktop, document); } diff --git a/src/ui/dialog/print.h b/src/ui/dialog/print.h index ea89ebdf2..e8904d744 100644 --- a/src/ui/dialog/print.h +++ b/src/ui/dialog/print.h @@ -30,7 +30,7 @@ */ struct workaround_gtkmm { - SPDocument *_doc; + Document *_doc; SPItem *_base; Inkscape::UI::Widget::RenderingOptions *_tab; }; @@ -41,14 +41,14 @@ namespace Dialog { class Print { public: - Print(SPDocument *doc, SPItem *base); + Print(Document *doc, SPItem *base); Gtk::PrintOperationResult run(Gtk::PrintOperationAction, Gtk::Window &parent_window); protected: private: GtkPrintOperation *_printop; - SPDocument *_doc; + Document *_doc; SPItem *_base; Inkscape::UI::Widget::RenderingOptions _tab; diff --git a/src/ui/dialog/swatches.h b/src/ui/dialog/swatches.h index 35bcd8c78..3ad5a38c1 100644 --- a/src/ui/dialog/swatches.h +++ b/src/ui/dialog/swatches.h @@ -45,7 +45,7 @@ public: protected: virtual void _updateFromSelection(); virtual void _handleAction( int setId, int itemId ); - virtual void _setDocument( SPDocument *document ); + virtual void _setDocument( Document *document ); virtual void _rebuild(); private: @@ -57,7 +57,7 @@ private: ColorItem* _remove; int _currentIndex; SPDesktop* _currentDesktop; - SPDocument* _currentDocument; + Document* _currentDocument; void* _ptr; sigc::connection _documentConnection; diff --git a/src/ui/dialog/undo-history.h b/src/ui/dialog/undo-history.h index 82e04f3c9..0e14b7d7b 100644 --- a/src/ui/dialog/undo-history.h +++ b/src/ui/dialog/undo-history.h @@ -122,7 +122,7 @@ public: protected: - SPDocument *_document; + Document *_document; EventLog *_event_log; const EventLog::EventModelColumns *_columns; diff --git a/src/ui/view/edit-widget.h b/src/ui/view/edit-widget.h index 2bb708305..28b4b52d2 100644 --- a/src/ui/view/edit-widget.h +++ b/src/ui/view/edit-widget.h @@ -36,7 +36,7 @@ #include "ui/widget/zoom-status.h" struct SPDesktop; -struct SPDocument; +struct Document; struct SPNamedView; namespace Inkscape { @@ -46,14 +46,14 @@ namespace View { class EditWidget : public Gtk::Window, public EditWidgetInterface { public: - EditWidget (SPDocument*); + EditWidget (Document*); ~EditWidget(); // Initialization void initActions(); void initUIManager(); void initLayout(); - void initEdit (SPDocument*); + void initEdit (Document*); void destroyEdit(); // Actions diff --git a/src/ui/view/view.h b/src/ui/view/view.h index 882746cea..6465807d6 100644 --- a/src/ui/view/view.h +++ b/src/ui/view/view.h @@ -53,7 +53,7 @@ struct StopOnNonZero { } }; -class SPDocument; +class Document; namespace Inkscape { class MessageContext; @@ -80,7 +80,7 @@ public: void close() { _close(); } /// Returns a pointer to the view's document. - SPDocument *doc() const + Document *doc() const { return _doc; } /// Returns a pointer to the view's message stack. Inkscape::MessageStack *messageStack() const @@ -108,12 +108,12 @@ public: virtual void onDocumentResized (double, double) = 0; protected: - SPDocument *_doc; + Document *_doc; Inkscape::MessageStack *_message_stack; Inkscape::MessageContext *_tips_message_context; virtual void _close(); - virtual void setDocument(SPDocument *doc); + virtual void setDocument(Document *doc); sigc::signal _position_set_signal; sigc::signal _resized_signal; diff --git a/src/ui/widget/entity-entry.h b/src/ui/widget/entity-entry.h index 5bdee9a90..d080787c1 100644 --- a/src/ui/widget/entity-entry.h +++ b/src/ui/widget/entity-entry.h @@ -16,7 +16,7 @@ #include struct rdf_work_entity_t; -class SPDocument; +class Document; namespace Gtk { class TextBuffer; @@ -32,7 +32,7 @@ class EntityEntry { public: static EntityEntry* create (rdf_work_entity_t* ent, Gtk::Tooltips& tt, Registry& wr); virtual ~EntityEntry() = 0; - virtual void update (SPDocument *doc) = 0; + virtual void update (Document *doc) = 0; virtual void on_changed() = 0; Gtk::Label _label; Gtk::Widget *_packable; @@ -49,7 +49,7 @@ class EntityLineEntry : public EntityEntry { public: EntityLineEntry (rdf_work_entity_t* ent, Gtk::Tooltips& tt, Registry& wr); ~EntityLineEntry(); - void update (SPDocument *doc); + void update (Document *doc); protected: virtual void on_changed(); @@ -59,7 +59,7 @@ class EntityMultiLineEntry : public EntityEntry { public: EntityMultiLineEntry (rdf_work_entity_t* ent, Gtk::Tooltips& tt, Registry& wr); ~EntityMultiLineEntry(); - void update (SPDocument *doc); + void update (Document *doc); protected: virtual void on_changed(); diff --git a/src/ui/widget/imageicon.h b/src/ui/widget/imageicon.h index 803b2f53f..3819a3c77 100644 --- a/src/ui/widget/imageicon.h +++ b/src/ui/widget/imageicon.h @@ -16,7 +16,7 @@ #include -class SPDocument; +class Document; namespace Inkscape { @@ -62,7 +62,7 @@ public: /** * */ - bool showSvgDocument(const SPDocument *doc); + bool showSvgDocument(const Document *doc); /** * @@ -99,7 +99,7 @@ private: /** * The svg document we are currently showing */ - SPDocument *document; + Document *document; /** * The sp_svg_view widget diff --git a/src/ui/widget/layer-selector.h b/src/ui/widget/layer-selector.h index 0b5300272..d9ef558a5 100644 --- a/src/ui/widget/layer-selector.h +++ b/src/ui/widget/layer-selector.h @@ -23,7 +23,7 @@ #include "util/list.h" class SPDesktop; -class SPDocument; +class Document; class SPObject; namespace Inkscape { namespace XML { diff --git a/src/ui/widget/licensor.h b/src/ui/widget/licensor.h index 9f41a6d0d..6738c48df 100644 --- a/src/ui/widget/licensor.h +++ b/src/ui/widget/licensor.h @@ -15,7 +15,7 @@ #include -class SPDocument; +class Document; namespace Gtk { class Tooltips; @@ -34,7 +34,7 @@ public: Licensor(); virtual ~Licensor(); void init (Gtk::Tooltips&, Registry&); - void update (SPDocument *doc); + void update (Document *doc); protected: EntityEntry *_eentry; diff --git a/src/ui/widget/panel.h b/src/ui/widget/panel.h index d42548f16..36f5ea804 100644 --- a/src/ui/widget/panel.h +++ b/src/ui/widget/panel.h @@ -71,7 +71,7 @@ public: void setDefaultResponse(int response_id); void setResponseSensitive(int response_id, bool setting); - virtual sigc::signal &signalDocumentReplaced(); + virtual sigc::signal &signalDocumentReplaced(); virtual sigc::signal &signalActivateDesktop(); virtual sigc::signal &signalDeactiveDesktop(); @@ -100,7 +100,7 @@ protected: /** Signals */ sigc::signal _signal_response; sigc::signal _signal_present; - sigc::signal _signal_document_replaced; + sigc::signal _signal_document_replaced; sigc::signal _signal_activate_desktop; sigc::signal _signal_deactive_desktop; diff --git a/src/ui/widget/registered-enums.h b/src/ui/widget/registered-enums.h index 739745817..f9195d1f2 100644 --- a/src/ui/widget/registered-enums.h +++ b/src/ui/widget/registered-enums.h @@ -32,7 +32,7 @@ public: const Util::EnumDataConverter& c, Registry& wr, Inkscape::XML::Node* repr_in = NULL, - SPDocument *doc_in = NULL ) + Document *doc_in = NULL ) : RegisteredWidget< LabelledComboBoxEnum >(label, tip, c) { RegisteredWidget< LabelledComboBoxEnum >::init_parent(key, wr, repr_in, doc_in); diff --git a/src/ui/widget/registered-widget.h b/src/ui/widget/registered-widget.h index a5c61f68a..32d6c93fa 100644 --- a/src/ui/widget/registered-widget.h +++ b/src/ui/widget/registered-widget.h @@ -35,7 +35,7 @@ #include "sp-namedview.h" class SPUnit; -class SPDocument; +class Document; namespace Gtk { class HScale; @@ -81,7 +81,7 @@ protected: virtual ~RegisteredWidget() {}; - void init_parent(const Glib::ustring& key, Registry& wr, Inkscape::XML::Node* repr_in, SPDocument *doc_in) + void init_parent(const Glib::ustring& key, Registry& wr, Inkscape::XML::Node* repr_in, Document *doc_in) { _wr = ≀ _key = key; @@ -96,7 +96,7 @@ protected: // Use local repr here. When repr is specified, use that one, but // if repr==NULL, get the repr of namedview of active desktop. Inkscape::XML::Node *local_repr = repr; - SPDocument *local_doc = doc; + Document *local_doc = doc; if (!local_repr) { // no repr specified, use active desktop's namedview's repr SPDesktop* dt = SP_ACTIVE_DESKTOP; @@ -120,7 +120,7 @@ protected: Registry * _wr; Glib::ustring _key; Inkscape::XML::Node * repr; - SPDocument * doc; + Document * doc; unsigned int event_type; Glib::ustring event_description; bool write_undo; @@ -139,7 +139,7 @@ private: class RegisteredCheckButton : public RegisteredWidget { public: virtual ~RegisteredCheckButton(); - RegisteredCheckButton (const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, bool right=true, Inkscape::XML::Node* repr_in=NULL, SPDocument *doc_in=NULL); + RegisteredCheckButton (const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, bool right=true, Inkscape::XML::Node* repr_in=NULL, Document *doc_in=NULL); void setActive (bool); @@ -168,7 +168,7 @@ public: const Glib::ustring& key, Registry& wr, Inkscape::XML::Node* repr_in = NULL, - SPDocument *doc_in = NULL ); + Document *doc_in = NULL ); void setUnit (const SPUnit*); Unit getUnit() const { return static_cast(_widget)->getUnit(); }; @@ -188,7 +188,7 @@ public: const RegisteredUnitMenu &rum, Registry& wr, Inkscape::XML::Node* repr_in = NULL, - SPDocument *doc_in = NULL ); + Document *doc_in = NULL ); protected: sigc::connection _value_changed_connection; @@ -204,7 +204,7 @@ public: const Glib::ustring& key, Registry& wr, Inkscape::XML::Node* repr_in = NULL, - SPDocument *doc_in = NULL ); + Document *doc_in = NULL ); protected: sigc::connection _value_changed_connection; @@ -219,7 +219,7 @@ public: const Glib::ustring& key, Registry& wr, Inkscape::XML::Node* repr_in = NULL, - SPDocument *doc_in = NULL ); + Document *doc_in = NULL ); protected: sigc::connection _activate_connection; @@ -237,7 +237,7 @@ public: const Glib::ustring& akey, Registry& wr, Inkscape::XML::Node* repr_in = NULL, - SPDocument *doc_in = NULL); + Document *doc_in = NULL); void setRgba32 (guint32); void closeWindow(); @@ -259,7 +259,7 @@ public: const Glib::ustring& key, Registry& wr, Inkscape::XML::Node* repr_in = NULL, - SPDocument *doc_in = NULL ); + Document *doc_in = NULL ); bool setProgrammatically; // true if the value was set by setValue, not changed by the user; // if a callback checks it, it must reset it back to false @@ -280,7 +280,7 @@ public: const Glib::ustring& key, Registry& wr, Inkscape::XML::Node* repr_in = NULL, - SPDocument *doc_in = NULL ); + Document *doc_in = NULL ); void setValue (bool second); @@ -301,7 +301,7 @@ public: const Glib::ustring& key, Registry& wr, Inkscape::XML::Node* repr_in = NULL, - SPDocument *doc_in = NULL ); + Document *doc_in = NULL ); protected: sigc::connection _value_x_changed_connection; @@ -318,7 +318,7 @@ public: const Glib::ustring& key, Registry& wr, Inkscape::XML::Node* repr_in = NULL, - SPDocument *doc_in = NULL ); + Document *doc_in = NULL ); // redefine setValue, because transform must be applied void setValue(Geom::Point const & p); @@ -342,7 +342,7 @@ public: const Glib::ustring& key, Registry& wr, Inkscape::XML::Node* repr_in = NULL, - SPDocument *doc_in = NULL); + Document *doc_in = NULL); void setValue (double val, long startseed); -- cgit v1.2.3 From 4cd79453c07adefb912a4dbd0afb2e7c2722bd90 Mon Sep 17 00:00:00 2001 From: johnce Date: Wed, 5 Aug 2009 06:38:07 +0000 Subject: SPDocument->Document (bzr r8408) --- src/extension/implementation/implementation.cpp | 8 +++--- src/extension/implementation/script.cpp | 8 +++--- src/extension/implementation/xslt.cpp | 6 ++--- src/extension/internal/bitmap/imagemagick.cpp | 2 +- src/extension/internal/cairo-png-out.cpp | 4 +-- src/extension/internal/cairo-ps-out.cpp | 6 ++--- src/extension/internal/cairo-render-context.cpp | 2 +- src/extension/internal/cairo-renderer-pdf-out.cpp | 4 +-- src/extension/internal/cairo-renderer.cpp | 4 +-- src/extension/internal/emf-win32-inout.cpp | 8 +++--- src/extension/internal/emf-win32-print.cpp | 2 +- src/extension/internal/gdkpixbuf-input.cpp | 4 +-- src/extension/internal/gimpgrad.cpp | 4 +-- src/extension/internal/grid.cpp | 4 +-- src/extension/internal/javafx-out.cpp | 10 ++++---- src/extension/internal/latex-pstricks-out.cpp | 2 +- src/extension/internal/latex-pstricks.cpp | 2 +- src/extension/internal/odf.cpp | 2 +- src/extension/internal/pdf-input-cairo.cpp | 4 +-- src/extension/internal/pdfinput/pdf-input.cpp | 4 +-- src/extension/internal/pdfinput/svg-builder.cpp | 2 +- src/extension/internal/pov-out.cpp | 8 +++--- src/extension/internal/svg.cpp | 8 +++--- src/extension/internal/win32.cpp | 2 +- src/extension/internal/wpg-input.cpp | 4 +-- src/extension/param/bool.cpp | 10 ++++---- src/extension/param/color.cpp | 4 +-- src/extension/param/description.cpp | 2 +- src/extension/param/enum.cpp | 8 +++--- src/extension/param/float.cpp | 8 +++--- src/extension/param/int.cpp | 8 +++--- src/extension/param/notebook.cpp | 12 ++++----- src/extension/param/parameter.cpp | 26 ++++++++++---------- src/extension/param/radiobutton.cpp | 14 +++++------ src/extension/param/string.cpp | 8 +++--- src/ui/dialog/aboutbox.cpp | 2 +- src/ui/dialog/document-metadata.cpp | 2 +- src/ui/dialog/document-properties.cpp | 4 +-- src/ui/dialog/filedialogimpl-gtkmm.cpp | 6 ++--- src/ui/dialog/filedialogimpl-win32.cpp | 2 +- src/ui/dialog/filter-effects-dialog.cpp | 8 +++--- src/ui/dialog/guides.cpp | 2 +- src/ui/dialog/icon-preview.cpp | 4 +-- src/ui/dialog/layers.cpp | 4 +-- src/ui/dialog/livepatheffect-editor.cpp | 2 +- src/ui/dialog/print.cpp | 2 +- src/ui/dialog/svg-fonts-dialog.cpp | 30 +++++++++++------------ src/ui/dialog/swatches.cpp | 16 ++++++------ src/ui/view/edit-widget.cpp | 8 +++--- src/ui/view/view.cpp | 2 +- src/ui/widget/entity-entry.cpp | 8 +++--- src/ui/widget/imageicon.cpp | 8 +++--- src/ui/widget/licensor.cpp | 2 +- src/ui/widget/object-composite-settings.cpp | 2 +- src/ui/widget/page-sizer.cpp | 2 +- src/ui/widget/panel.cpp | 2 +- src/ui/widget/registered-widget.cpp | 24 +++++++++--------- src/ui/widget/tolerance-slider.cpp | 2 +- 58 files changed, 179 insertions(+), 179 deletions(-) (limited to 'src') diff --git a/src/extension/implementation/implementation.cpp b/src/extension/implementation/implementation.cpp index 6090b72d0..e3421b26d 100644 --- a/src/extension/implementation/implementation.cpp +++ b/src/extension/implementation/implementation.cpp @@ -79,7 +79,7 @@ Implementation::prefs_input(Inkscape::Extension::Input *module, gchar const */*f return module->autogui(NULL, NULL); } /* Implementation::prefs_input */ -SPDocument * +Document * Implementation::open(Inkscape::Extension::Input */*module*/, gchar const */*filename*/) { /* throw open_failed(); */ return NULL; @@ -91,7 +91,7 @@ Implementation::prefs_output(Inkscape::Extension::Output *module) { } /* Implementation::prefs_output */ void -Implementation::save(Inkscape::Extension::Output */*module*/, SPDocument */*doc*/, gchar const */*filename*/) { +Implementation::save(Inkscape::Extension::Output */*module*/, Document */*doc*/, gchar const */*filename*/) { /* throw save_fail */ return; } /* Implementation::save */ @@ -100,7 +100,7 @@ Gtk::Widget * Implementation::prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View * view, sigc::signal * changeSignal, ImplementationDocumentCache * docCache) { if (module->param_visible_count() == 0) return NULL; - SPDocument * current_document = view->doc(); + Document * current_document = view->doc(); using Inkscape::Util::GSListConstIterator; GSListConstIterator selected = @@ -134,7 +134,7 @@ Implementation::set_preview(Inkscape::Extension::Print */*module*/) unsigned int -Implementation::begin(Inkscape::Extension::Print */*module*/, SPDocument */*doc*/) +Implementation::begin(Inkscape::Extension::Print */*module*/, Document */*doc*/) { return 0; } diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp index e6ce40bc0..d207c1a19 100644 --- a/src/extension/implementation/script.cpp +++ b/src/extension/implementation/script.cpp @@ -545,7 +545,7 @@ Script::prefs_output(Inkscape::Extension::Output *module) the incoming filename (so that it's not the temporary filename). That document is then returned from this function. */ -SPDocument * +Document * Script::open(Inkscape::Extension::Input *module, const gchar *filenameArg) { @@ -567,7 +567,7 @@ Script::open(Inkscape::Extension::Input *module, int data_read = execute(command, params, lfilename, fileout); fileout.toFile(tempfilename_out); - SPDocument * mydoc = NULL; + Document * mydoc = NULL; if (data_read > 10) { if (helper_extension.size()==0) { mydoc = Inkscape::Extension::open( @@ -623,7 +623,7 @@ Script::open(Inkscape::Extension::Input *module, */ void Script::save(Inkscape::Extension::Output *module, - SPDocument *doc, + Document *doc, const gchar *filenameArg) { std::list params; @@ -757,7 +757,7 @@ Script::effect(Inkscape::Extension::Effect *module, pump_events(); - SPDocument * mydoc = NULL; + Document * mydoc = NULL; if (data_read > 10) { mydoc = Inkscape::Extension::open( Inkscape::Extension::db.get(SP_MODULE_KEY_INPUT_SVG), diff --git a/src/extension/implementation/xslt.cpp b/src/extension/implementation/xslt.cpp index f34fea64a..9eea2dbeb 100644 --- a/src/extension/implementation/xslt.cpp +++ b/src/extension/implementation/xslt.cpp @@ -136,7 +136,7 @@ XSLT::unload(Inkscape::Extension::Extension *module) return; } -SPDocument * +Document * XSLT::open(Inkscape::Extension::Input */*module*/, gchar const *filename) { xmlDocPtr filein = xmlParseFile(filename); @@ -174,7 +174,7 @@ XSLT::open(Inkscape::Extension::Input */*module*/, gchar const *filename) } g_free(s); - SPDocument * doc = sp_document_create(rdoc, filename, base, name, true); + Document * doc = sp_document_create(rdoc, filename, base, name, true); g_free(base); g_free(name); @@ -182,7 +182,7 @@ XSLT::open(Inkscape::Extension::Input */*module*/, gchar const *filename) } void -XSLT::save(Inkscape::Extension::Output */*module*/, SPDocument *doc, gchar const *filename) +XSLT::save(Inkscape::Extension::Output */*module*/, Document *doc, gchar const *filename) { /* TODO: Should we assume filename to be in utf8 or to be a raw filename? * See JavaFXOutput::save for discussion. */ diff --git a/src/extension/internal/bitmap/imagemagick.cpp b/src/extension/internal/bitmap/imagemagick.cpp index e907612fd..75d53927d 100644 --- a/src/extension/internal/bitmap/imagemagick.cpp +++ b/src/extension/internal/bitmap/imagemagick.cpp @@ -221,7 +221,7 @@ ImageMagick::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::Vi Gtk::Widget * ImageMagick::prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View * view, sigc::signal * changeSignal, Inkscape::Extension::Implementation::ImplementationDocumentCache * /*docCache*/) { - SPDocument * current_document = view->doc(); + Document * current_document = view->doc(); using Inkscape::Util::GSListConstIterator; GSListConstIterator selected = sp_desktop_selection((SPDesktop *)view)->itemList(); diff --git a/src/extension/internal/cairo-png-out.cpp b/src/extension/internal/cairo-png-out.cpp index c81fdd029..d849755b7 100644 --- a/src/extension/internal/cairo-png-out.cpp +++ b/src/extension/internal/cairo-png-out.cpp @@ -48,7 +48,7 @@ CairoRendererOutput::check (Inkscape::Extension::Extension * module) } static bool -png_render_document_to_file(SPDocument *doc, gchar const *filename) +png_render_document_to_file(Document *doc, gchar const *filename) { CairoRenderer *renderer; CairoRenderContext *ctx; @@ -92,7 +92,7 @@ png_render_document_to_file(SPDocument *doc, gchar const *filename) \param uri Filename to save to (probably will end in .png) */ void -CairoRendererOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *filename) +CairoRendererOutput::save(Inkscape::Extension::Output *mod, Document *doc, gchar const *filename) { if (!png_render_document_to_file(doc, filename)) throw Inkscape::Extension::Output::save_failed(); diff --git a/src/extension/internal/cairo-ps-out.cpp b/src/extension/internal/cairo-ps-out.cpp index dff89c1ed..d9cac666c 100644 --- a/src/extension/internal/cairo-ps-out.cpp +++ b/src/extension/internal/cairo-ps-out.cpp @@ -61,7 +61,7 @@ CairoEpsOutput::check (Inkscape::Extension::Extension * module) } static bool -ps_print_document_to_file(SPDocument *doc, gchar const *filename, unsigned int level, bool texttopath, bool filtertobitmap, int resolution, const gchar * const exportId, bool exportDrawing, bool exportCanvas, bool eps = false) +ps_print_document_to_file(Document *doc, gchar const *filename, unsigned int level, bool texttopath, bool filtertobitmap, int resolution, const gchar * const exportId, bool exportDrawing, bool exportCanvas, bool eps = false) { sp_document_ensure_up_to_date(doc); @@ -124,7 +124,7 @@ ps_print_document_to_file(SPDocument *doc, gchar const *filename, unsigned int l \param filename Filename to save to (probably will end in .ps) */ void -CairoPsOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *filename) +CairoPsOutput::save(Inkscape::Extension::Output *mod, Document *doc, gchar const *filename) { Inkscape::Extension::Extension * ext; unsigned int ret; @@ -188,7 +188,7 @@ CairoPsOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar con \param filename Filename to save to (probably will end in .ps) */ void -CairoEpsOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *filename) +CairoEpsOutput::save(Inkscape::Extension::Output *mod, Document *doc, gchar const *filename) { Inkscape::Extension::Extension * ext; unsigned int ret; diff --git a/src/extension/internal/cairo-render-context.cpp b/src/extension/internal/cairo-render-context.cpp index d1462e52e..28cf406f2 100644 --- a/src/extension/internal/cairo-render-context.cpp +++ b/src/extension/internal/cairo-render-context.cpp @@ -811,7 +811,7 @@ CairoRenderContext::_finishSurfaceSetup(cairo_surface_t *surface, cairo_matrix_t cairo_scale(_cr, PT_PER_PX, PT_PER_PX); } else if (cairo_surface_get_content(_surface) != CAIRO_CONTENT_ALPHA) { // set background color on non-alpha surfaces - // TODO: bgcolor should be derived from SPDocument + // TODO: bgcolor should be derived from Document cairo_set_source_rgb(_cr, 1.0, 1.0, 1.0); cairo_rectangle(_cr, 0, 0, _width, _height); cairo_fill(_cr); diff --git a/src/extension/internal/cairo-renderer-pdf-out.cpp b/src/extension/internal/cairo-renderer-pdf-out.cpp index b44e83449..1e5404c50 100644 --- a/src/extension/internal/cairo-renderer-pdf-out.cpp +++ b/src/extension/internal/cairo-renderer-pdf-out.cpp @@ -47,7 +47,7 @@ CairoRendererPdfOutput::check (Inkscape::Extension::Extension * module) } static bool -pdf_render_document_to_file(SPDocument *doc, gchar const *filename, unsigned int level, +pdf_render_document_to_file(Document *doc, gchar const *filename, unsigned int level, bool texttopath, bool filtertobitmap, int resolution, const gchar * const exportId, bool exportDrawing, bool exportCanvas) { @@ -118,7 +118,7 @@ pdf_render_document_to_file(SPDocument *doc, gchar const *filename, unsigned int tell the printing system to save to file. */ void -CairoRendererPdfOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *filename) +CairoRendererPdfOutput::save(Inkscape::Extension::Output *mod, Document *doc, gchar const *filename) { Inkscape::Extension::Extension * ext; unsigned int ret; diff --git a/src/extension/internal/cairo-renderer.cpp b/src/extension/internal/cairo-renderer.cpp index da88a5eae..3414993e5 100644 --- a/src/extension/internal/cairo-renderer.cpp +++ b/src/extension/internal/cairo-renderer.cpp @@ -460,7 +460,7 @@ static void sp_asbitmap_render(SPItem *item, CairoRenderContext *ctx) Geom::Matrix t = t_on_document * t_item.inverse(); // Do the export - SPDocument *document = SP_OBJECT(item)->document; + Document *document = SP_OBJECT(item)->document; GSList *items = NULL; items = g_slist_append(items, item); @@ -567,7 +567,7 @@ CairoRenderer::renderItem(CairoRenderContext *ctx, SPItem *item) } bool -CairoRenderer::setupDocument(CairoRenderContext *ctx, SPDocument *doc, bool pageBoundingBox, SPItem *base) +CairoRenderer::setupDocument(CairoRenderContext *ctx, Document *doc, bool pageBoundingBox, SPItem *base) { g_assert( ctx != NULL ); diff --git a/src/extension/internal/emf-win32-inout.cpp b/src/extension/internal/emf-win32-inout.cpp index f400a3649..ffba5af81 100644 --- a/src/extension/internal/emf-win32-inout.cpp +++ b/src/extension/internal/emf-win32-inout.cpp @@ -101,7 +101,7 @@ EmfWin32::check (Inkscape::Extension::Extension * /*module*/) static void -emf_print_document_to_file(SPDocument *doc, gchar const *filename) +emf_print_document_to_file(Document *doc, gchar const *filename) { Inkscape::Extension::Print *mod; SPPrintContext context; @@ -147,7 +147,7 @@ emf_print_document_to_file(SPDocument *doc, gchar const *filename) void -EmfWin32::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *filename) +EmfWin32::save(Inkscape::Extension::Output *mod, Document *doc, gchar const *filename) { Inkscape::Extension::Extension * ext; @@ -2162,7 +2162,7 @@ typedef struct #pragma pack( pop ) -SPDocument * +Document * EmfWin32::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri ) { EMF_CALLBACK_DATA d; @@ -2365,7 +2365,7 @@ EmfWin32::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri ) // std::cout << "SVG Output: " << std::endl << *(d.outsvg) << std::endl; - SPDocument *doc = sp_document_new_from_mem(d.outsvg->c_str(), d.outsvg->length(), TRUE); + Document *doc = sp_document_new_from_mem(d.outsvg->c_str(), d.outsvg->length(), TRUE); delete d.outsvg; delete d.path; diff --git a/src/extension/internal/emf-win32-print.cpp b/src/extension/internal/emf-win32-print.cpp index d098f6466..822a0577b 100644 --- a/src/extension/internal/emf-win32-print.cpp +++ b/src/extension/internal/emf-win32-print.cpp @@ -116,7 +116,7 @@ PrintEmfWin32::setup (Inkscape::Extension::Print * /*mod*/) unsigned int -PrintEmfWin32::begin (Inkscape::Extension::Print *mod, SPDocument *doc) +PrintEmfWin32::begin (Inkscape::Extension::Print *mod, Document *doc) { gchar const *utf8_fn = mod->get_param_string("destination"); diff --git a/src/extension/internal/gdkpixbuf-input.cpp b/src/extension/internal/gdkpixbuf-input.cpp index 64a099c8a..2f52561d1 100644 --- a/src/extension/internal/gdkpixbuf-input.cpp +++ b/src/extension/internal/gdkpixbuf-input.cpp @@ -16,10 +16,10 @@ GdkPixbuf* pixbuf_new_from_file( char const *utf8name, GError **error ); namespace Extension { namespace Internal { -SPDocument * +Document * GdkpixbufInput::open(Inkscape::Extension::Input */*mod*/, char const *uri) { - SPDocument *doc = NULL; + PDocument *doc = NULL; GdkPixbuf *pb = Inkscape::IO::pixbuf_new_from_file( uri, NULL ); if (pb) { /* We are readable */ diff --git a/src/extension/internal/gimpgrad.cpp b/src/extension/internal/gimpgrad.cpp index 5b3e0c16e..9510b5ebd 100644 --- a/src/extension/internal/gimpgrad.cpp +++ b/src/extension/internal/gimpgrad.cpp @@ -95,7 +95,7 @@ stop_svg(ColorRGBA const in_color, double const location) } /** - \brief Actually open the gradient and turn it into an SPDocument + \brief Actually open the gradient and turn it into an Document \param module The input module being used \param filename The filename of the gradient to be opened \return A Document with the gradient in it. @@ -129,7 +129,7 @@ stop_svg(ColorRGBA const in_color, double const location) document using the \c sp_document_from_mem. That is then returned to Inkscape. */ -SPDocument * +Document * GimpGrad::open (Inkscape::Extension::Input */*module*/, gchar const *filename) { Inkscape::IO::dump_fopen_call(filename, "I"); diff --git a/src/extension/internal/grid.cpp b/src/extension/internal/grid.cpp index d4b35b261..5a0523ba8 100644 --- a/src/extension/internal/grid.cpp +++ b/src/extension/internal/grid.cpp @@ -81,7 +81,7 @@ Grid::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View *doc Geom::Rect bounding_area = Geom::Rect(Geom::Point(0,0), Geom::Point(100,100)); if (selection->isEmpty()) { /* get page size */ - SPDocument * doc = document->doc(); + Document * doc = document->doc(); bounding_area = Geom::Rect( Geom::Point(0,0), Geom::Point(sp_document_width(doc), sp_document_height(doc)) ); } else { @@ -171,7 +171,7 @@ PrefAdjustment::val_changed (void) Gtk::Widget * Grid::prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View * view, sigc::signal * changeSignal, Inkscape::Extension::Implementation::ImplementationDocumentCache * /*docCache*/) { - SPDocument * current_document = view->doc(); + Document * current_document = view->doc(); using Inkscape::Util::GSListConstIterator; GSListConstIterator selected = sp_desktop_selection((SPDesktop *)view)->itemList(); diff --git a/src/extension/internal/javafx-out.cpp b/src/extension/internal/javafx-out.cpp index 417755e19..c1f057071 100644 --- a/src/extension/internal/javafx-out.cpp +++ b/src/extension/internal/javafx-out.cpp @@ -701,7 +701,7 @@ bool JavaFXOutput::doCurve(SPItem *item, const String &id) /** * Output the tree data to buffer */ -bool JavaFXOutput::doTreeRecursive(SPDocument *doc, SPObject *obj) +bool JavaFXOutput::doTreeRecursive(Document *doc, SPObject *obj) { /** * Check the type of node and process @@ -749,7 +749,7 @@ bool JavaFXOutput::doTreeRecursive(SPDocument *doc, SPObject *obj) /** * Output the curve data to buffer */ -bool JavaFXOutput::doTree(SPDocument *doc) +bool JavaFXOutput::doTree(Document *doc) { double bignum = 1000000.0; @@ -767,7 +767,7 @@ bool JavaFXOutput::doTree(SPDocument *doc) } -bool JavaFXOutput::doBody(SPDocument *doc, SPObject *obj) +bool JavaFXOutput::doBody(Document *doc, SPObject *obj) { /** * Check the type of node and process @@ -842,7 +842,7 @@ void JavaFXOutput::reset() /** * Saves the of an Inkscape SVG file as JavaFX spline definitions */ -bool JavaFXOutput::saveDocument(SPDocument *doc, gchar const *filename_utf8) +bool JavaFXOutput::saveDocument(Document *doc, gchar const *filename_utf8) { reset(); @@ -918,7 +918,7 @@ bool JavaFXOutput::saveDocument(SPDocument *doc, gchar const *filename_utf8) */ void JavaFXOutput::save(Inkscape::Extension::Output */*mod*/, - SPDocument *doc, gchar const *filename_utf8) + Document *doc, gchar const *filename_utf8) { /* N.B. The name `filename_utf8' represents the fact that we want it to be in utf8; whereas in * fact we know that some callers of Extension::save pass something in the filesystem's diff --git a/src/extension/internal/latex-pstricks-out.cpp b/src/extension/internal/latex-pstricks-out.cpp index 4a469a750..924f9697e 100644 --- a/src/extension/internal/latex-pstricks-out.cpp +++ b/src/extension/internal/latex-pstricks-out.cpp @@ -47,7 +47,7 @@ LatexOutput::check (Inkscape::Extension::Extension * module) void -LatexOutput::save(Inkscape::Extension::Output *mod2, SPDocument *doc, gchar const *filename) +LatexOutput::save(Inkscape::Extension::Output *mod2, Document *doc, gchar const *filename) { Inkscape::Extension::Print *mod; SPPrintContext context; diff --git a/src/extension/internal/latex-pstricks.cpp b/src/extension/internal/latex-pstricks.cpp index 789e5ea34..afc985e14 100644 --- a/src/extension/internal/latex-pstricks.cpp +++ b/src/extension/internal/latex-pstricks.cpp @@ -64,7 +64,7 @@ PrintLatex::setup (Inkscape::Extension::Print *mod) } unsigned int -PrintLatex::begin (Inkscape::Extension::Print *mod, SPDocument *doc) +PrintLatex::begin (Inkscape::Extension::Print *mod, Document *doc) { Inkscape::SVGOStringStream os; int res; diff --git a/src/extension/internal/odf.cpp b/src/extension/internal/odf.cpp index cc8489302..e7e22414a 100644 --- a/src/extension/internal/odf.cpp +++ b/src/extension/internal/odf.cpp @@ -2367,7 +2367,7 @@ OdfOutput::reset() * Descends into the SVG tree, mapping things to ODF when appropriate */ void -OdfOutput::save(Inkscape::Extension::Output */*mod*/, SPDocument *doc, gchar const *filename) +OdfOutput::save(Inkscape::Extension::Output */*mod*/, Document *doc, gchar const *filename) { reset(); diff --git a/src/extension/internal/pdf-input-cairo.cpp b/src/extension/internal/pdf-input-cairo.cpp index 937fefb11..76759259d 100644 --- a/src/extension/internal/pdf-input-cairo.cpp +++ b/src/extension/internal/pdf-input-cairo.cpp @@ -32,7 +32,7 @@ namespace Internal { static cairo_status_t _write_ustring_cb(void *closure, const unsigned char *data, unsigned int length); -SPDocument * +Document * PdfInputCairo::open(Inkscape::Extension::Input * /*mod*/, const gchar * uri) { printf("Attempting to open using PdfInputCairo\n"); @@ -58,7 +58,7 @@ PdfInputCairo::open(Inkscape::Extension::Input * /*mod*/, const gchar * uri) { cairo_destroy(cr); cairo_surface_destroy(surface); - SPDocument * doc = sp_document_new_from_mem(output->c_str(), output->length(), TRUE); + Document * doc = sp_document_new_from_mem(output->c_str(), output->length(), TRUE); delete output; g_object_unref(page); diff --git a/src/extension/internal/pdfinput/pdf-input.cpp b/src/extension/internal/pdfinput/pdf-input.cpp index c2d417f2c..476f0daf6 100644 --- a/src/extension/internal/pdfinput/pdf-input.cpp +++ b/src/extension/internal/pdfinput/pdf-input.cpp @@ -589,7 +589,7 @@ void PdfImportDialog::_setPreviewPage(int page) { /** * Parses the selected page of the given PDF document using PdfParser. */ -SPDocument * +Document * PdfInput::open(::Inkscape::Extension::Input * /*mod*/, const gchar * uri) { // Initialize the globalParams variable for poppler @@ -661,7 +661,7 @@ PdfInput::open(::Inkscape::Extension::Input * /*mod*/, const gchar * uri) { Catalog *catalog = pdf_doc->getCatalog(); Page *page = catalog->getPage(page_num); - SPDocument *doc = sp_document_new(NULL, TRUE, TRUE); + Document *doc = sp_document_new(NULL, TRUE, TRUE); bool saved = sp_document_get_undo_sensitive(doc); sp_document_set_undo_sensitive(doc, false); // No need to undo in this temporary document diff --git a/src/extension/internal/pdfinput/svg-builder.cpp b/src/extension/internal/pdfinput/svg-builder.cpp index 00bd8fa4d..686e44bb1 100644 --- a/src/extension/internal/pdfinput/svg-builder.cpp +++ b/src/extension/internal/pdfinput/svg-builder.cpp @@ -77,7 +77,7 @@ struct SvgTransparencyGroup { * */ -SvgBuilder::SvgBuilder(SPDocument *document, gchar *docname, XRef *xref) { +SvgBuilder::SvgBuilder(Document *document, gchar *docname, XRef *xref) { _is_top_level = true; _doc = document; _docname = docname; diff --git a/src/extension/internal/pov-out.cpp b/src/extension/internal/pov-out.cpp index f30cbc317..d3ed39d1f 100644 --- a/src/extension/internal/pov-out.cpp +++ b/src/extension/internal/pov-out.cpp @@ -417,7 +417,7 @@ bool PovOutput::doCurve(SPItem *item, const String &id) /** * Descend the svg tree recursively, translating data */ -bool PovOutput::doTreeRecursive(SPDocument *doc, SPObject *obj) +bool PovOutput::doTreeRecursive(Document *doc, SPObject *obj) { String id; @@ -454,7 +454,7 @@ bool PovOutput::doTreeRecursive(SPDocument *doc, SPObject *obj) /** * Output the curve data to buffer */ -bool PovOutput::doTree(SPDocument *doc) +bool PovOutput::doTree(Document *doc) { double bignum = 1000000.0; minx = bignum; @@ -576,7 +576,7 @@ void PovOutput::reset() /** * Saves the Shapes of an Inkscape SVG file as PovRay spline definitions */ -void PovOutput::saveDocument(SPDocument *doc, gchar const *filename_utf8) +void PovOutput::saveDocument(Document *doc, gchar const *filename_utf8) { reset(); @@ -641,7 +641,7 @@ void PovOutput::saveDocument(SPDocument *doc, gchar const *filename_utf8) */ void PovOutput::save(Inkscape::Extension::Output */*mod*/, - SPDocument *doc, gchar const *filename_utf8) + Document *doc, gchar const *filename_utf8) { /* See comments in JavaFSOutput::save re the name `filename_utf8'. */ saveDocument(doc, filename_utf8); diff --git a/src/extension/internal/svg.cpp b/src/extension/internal/svg.cpp index a3589e905..317811088 100644 --- a/src/extension/internal/svg.cpp +++ b/src/extension/internal/svg.cpp @@ -138,13 +138,13 @@ _load_uri (const gchar *uri) /** \return A new document just for you! \brief This function takes in a filename of a SVG document and - turns it into a SPDocument. + turns it into a Document. \param mod Module to use \param uri The path to the file (UTF-8) This function is really simple, it just calls sp_document_new... */ -SPDocument * +Document * Svg::open (Inkscape::Extension::Input */*mod*/, const gchar *uri) { #ifdef WITH_GNOME_VFS @@ -157,7 +157,7 @@ Svg::open (Inkscape::Extension::Input */*mod*/, const gchar *uri) g_warning("Error: Could not open file '%s' with VFS\n", uri); return NULL; } - SPDocument * doc = sp_document_new_from_mem(buffer, strlen(buffer), 1); + Document * doc = sp_document_new_from_mem(buffer, strlen(buffer), 1); g_free(buffer); return doc; @@ -191,7 +191,7 @@ Svg::open (Inkscape::Extension::Input */*mod*/, const gchar *uri) all of this code. I just stole it. */ void -Svg::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *filename) +Svg::save(Inkscape::Extension::Output *mod, Document *doc, gchar const *filename) { g_return_if_fail(doc != NULL); g_return_if_fail(filename != NULL); diff --git a/src/extension/internal/win32.cpp b/src/extension/internal/win32.cpp index 21f278858..f272292b5 100644 --- a/src/extension/internal/win32.cpp +++ b/src/extension/internal/win32.cpp @@ -215,7 +215,7 @@ PrintWin32::setup (Inkscape::Extension::Print *mod) } unsigned int -PrintWin32::begin (Inkscape::Extension::Print *mod, SPDocument *doc) +PrintWin32::begin (Inkscape::Extension::Print *mod, Document *doc) { DOCINFO di = { sizeof (DOCINFO), diff --git a/src/extension/internal/wpg-input.cpp b/src/extension/internal/wpg-input.cpp index c37d5705b..e7177e5e3 100644 --- a/src/extension/internal/wpg-input.cpp +++ b/src/extension/internal/wpg-input.cpp @@ -59,7 +59,7 @@ namespace Extension { namespace Internal { -SPDocument * +Document * WpgInput::open(Inkscape::Extension::Input * mod, const gchar * uri) { WPXInputStream* input = new libwpg::WPGFileStream(uri); if (input->isOLEStream()) { @@ -86,7 +86,7 @@ WpgInput::open(Inkscape::Extension::Input * mod, const gchar * uri) { //printf("I've got a doc: \n%s", painter.document.c_str()); - SPDocument * doc = sp_document_new_from_mem(output.cstr(), strlen(output.cstr()), TRUE); + Document * doc = sp_document_new_from_mem(output.cstr(), strlen(output.cstr()), TRUE); delete input; return doc; } diff --git a/src/extension/param/bool.cpp b/src/extension/param/bool.cpp index 1dda3d73f..07170587a 100644 --- a/src/extension/param/bool.cpp +++ b/src/extension/param/bool.cpp @@ -53,7 +53,7 @@ ParamBool::ParamBool (const gchar * name, const gchar * guitext, const gchar * d and \c pref_name() are used. */ bool -ParamBool::set( bool in, SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/ ) +ParamBool::set( bool in, Document * /*doc*/, Inkscape::XML::Node * /*node*/ ) { _value = in; @@ -67,7 +67,7 @@ ParamBool::set( bool in, SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/ ) /** \brief Returns \c _value */ bool -ParamBool::get (const SPDocument * doc, const Inkscape::XML::Node * node) +ParamBool::get (const Document * doc, const Inkscape::XML::Node * node) { return _value; } @@ -79,7 +79,7 @@ class ParamBoolCheckButton : public Gtk::CheckButton { private: /** \brief Param to change */ ParamBool * _pref; - SPDocument * _doc; + Document * _doc; Inkscape::XML::Node * _node; sigc::signal * _changeSignal; public: @@ -89,7 +89,7 @@ public: This function sets the value of the checkbox to be that of the parameter, and then sets up a callback to \c on_toggle. */ - ParamBoolCheckButton (ParamBool * param, SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) : + ParamBoolCheckButton (ParamBool * param, Document * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) : Gtk::CheckButton(), _pref(param), _doc(doc), _node(node), _changeSignal(changeSignal) { this->set_active(_pref->get(NULL, NULL) /**\todo fix */); this->signal_toggled().connect(sigc::mem_fun(this, &ParamBoolCheckButton::on_toggle)); @@ -132,7 +132,7 @@ ParamBool::string (std::string &string) Builds a hbox with a label and a check button in it. */ Gtk::Widget * -ParamBool::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) +ParamBool::get_widget (Document * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) { if (_gui_hidden) return NULL; Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4)); diff --git a/src/extension/param/color.cpp b/src/extension/param/color.cpp index 58db85748..080356e71 100644 --- a/src/extension/param/color.cpp +++ b/src/extension/param/color.cpp @@ -41,7 +41,7 @@ ParamColor::~ParamColor(void) } guint32 -ParamColor::set( guint32 in, SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/ ) +ParamColor::set( guint32 in, Document * /*doc*/, Inkscape::XML::Node * /*node*/ ) { _value = in; @@ -87,7 +87,7 @@ ParamColor::string (std::string &string) } Gtk::Widget * -ParamColor::get_widget( SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/, sigc::signal * changeSignal ) +ParamColor::get_widget( Document * /*doc*/, Inkscape::XML::Node * /*node*/, sigc::signal * changeSignal ) { if (_gui_hidden) return NULL; diff --git a/src/extension/param/description.cpp b/src/extension/param/description.cpp index 656e58c49..3641695cc 100644 --- a/src/extension/param/description.cpp +++ b/src/extension/param/description.cpp @@ -46,7 +46,7 @@ ParamDescription::ParamDescription (const gchar * name, const gchar * guitext, c /** \brief Create a label for the description */ Gtk::Widget * -ParamDescription::get_widget (SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/, sigc::signal * /*changeSignal*/) +ParamDescription::get_widget (Document * /*doc*/, Inkscape::XML::Node * /*node*/, sigc::signal * /*changeSignal*/) { if (_gui_hidden) return NULL; diff --git a/src/extension/param/enum.cpp b/src/extension/param/enum.cpp index 03c1f839b..9de3f60dd 100644 --- a/src/extension/param/enum.cpp +++ b/src/extension/param/enum.cpp @@ -129,7 +129,7 @@ ParamComboBox::~ParamComboBox (void) the passed in value is duplicated using \c g_strdup(). */ const gchar * -ParamComboBox::set (const gchar * in, SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/) +ParamComboBox::set (const gchar * in, Document * /*doc*/, Inkscape::XML::Node * /*node*/) { if (in == NULL) return NULL; /* Can't have NULL string */ @@ -177,7 +177,7 @@ ParamComboBox::string (std::string &string) class ParamComboBoxEntry : public Gtk::ComboBoxText { private: ParamComboBox * _pref; - SPDocument * _doc; + Document * _doc; Inkscape::XML::Node * _node; sigc::signal * _changeSignal; public: @@ -185,7 +185,7 @@ public: \param pref Where to get the string from, and where to put it when it changes. */ - ParamComboBoxEntry (ParamComboBox * pref, SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) : + ParamComboBoxEntry (ParamComboBox * pref, Document * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) : Gtk::ComboBoxText(), _pref(pref), _doc(doc), _node(node), _changeSignal(changeSignal) { this->signal_changed().connect(sigc::mem_fun(this, &ParamComboBoxEntry::changed)); }; @@ -211,7 +211,7 @@ ParamComboBoxEntry::changed (void) \brief Creates a combobox widget for an enumeration parameter */ Gtk::Widget * -ParamComboBox::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) +ParamComboBox::get_widget (Document * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) { if (_gui_hidden) return NULL; diff --git a/src/extension/param/float.cpp b/src/extension/param/float.cpp index 11e3a8d97..516249c3c 100644 --- a/src/extension/param/float.cpp +++ b/src/extension/param/float.cpp @@ -75,7 +75,7 @@ ParamFloat::ParamFloat (const gchar * name, const gchar * guitext, const gchar * and \c pref_name() are used. */ float -ParamFloat::set (float in, SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/) +ParamFloat::set (float in, Document * /*doc*/, Inkscape::XML::Node * /*node*/) { _value = in; if (_value > _max) _value = _max; @@ -103,13 +103,13 @@ ParamFloat::string (std::string &string) class ParamFloatAdjustment : public Gtk::Adjustment { /** The parameter to adjust */ ParamFloat * _pref; - SPDocument * _doc; + Document * _doc; Inkscape::XML::Node * _node; sigc::signal * _changeSignal; public: /** \brief Make the adjustment using an extension and the string describing the parameter. */ - ParamFloatAdjustment (ParamFloat * param, SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) : + ParamFloatAdjustment (ParamFloat * param, Document * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) : Gtk::Adjustment(0.0, param->min(), param->max(), 0.1, 0), _pref(param), _doc(doc), _node(node), _changeSignal(changeSignal) { this->set_value(_pref->get(NULL, NULL) /* \todo fix */); this->signal_value_changed().connect(sigc::mem_fun(this, &ParamFloatAdjustment::val_changed)); @@ -142,7 +142,7 @@ ParamFloatAdjustment::val_changed (void) Builds a hbox with a label and a float adjustment in it. */ Gtk::Widget * -ParamFloat::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) +ParamFloat::get_widget (Document * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) { if (_gui_hidden) return NULL; diff --git a/src/extension/param/int.cpp b/src/extension/param/int.cpp index 301d54ed0..2818bb57b 100644 --- a/src/extension/param/int.cpp +++ b/src/extension/param/int.cpp @@ -70,7 +70,7 @@ ParamInt::ParamInt (const gchar * name, const gchar * guitext, const gchar * des and \c pref_name() are used. */ int -ParamInt::set (int in, SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/) +ParamInt::set (int in, Document * /*doc*/, Inkscape::XML::Node * /*node*/) { _value = in; if (_value > _max) _value = _max; @@ -88,13 +88,13 @@ ParamInt::set (int in, SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/) class ParamIntAdjustment : public Gtk::Adjustment { /** The parameter to adjust */ ParamInt * _pref; - SPDocument * _doc; + Document * _doc; Inkscape::XML::Node * _node; sigc::signal * _changeSignal; public: /** \brief Make the adjustment using an extension and the string describing the parameter. */ - ParamIntAdjustment (ParamInt * param, SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) : + ParamIntAdjustment (ParamInt * param, Document * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) : Gtk::Adjustment(0.0, param->min(), param->max(), 1.0, 0), _pref(param), _doc(doc), _node(node), _changeSignal(changeSignal) { this->set_value(_pref->get(NULL, NULL) /* \todo fix */); this->signal_value_changed().connect(sigc::mem_fun(this, &ParamIntAdjustment::val_changed)); @@ -127,7 +127,7 @@ ParamIntAdjustment::val_changed (void) Builds a hbox with a label and a int adjustment in it. */ Gtk::Widget * -ParamInt::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) +ParamInt::get_widget (Document * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) { if (_gui_hidden) return NULL; diff --git a/src/extension/param/notebook.cpp b/src/extension/param/notebook.cpp index 1c30b7e0e..6ad338ffa 100644 --- a/src/extension/param/notebook.cpp +++ b/src/extension/param/notebook.cpp @@ -54,7 +54,7 @@ public: ParamNotebookPage(const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml); ~ParamNotebookPage(void); - Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); + Gtk::Widget * get_widget(Document * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); void paramString (std::list &list); gchar * get_guitext (void) {return _text;}; @@ -196,7 +196,7 @@ ParamNotebookPage::makepage (Inkscape::XML::Node * in_repr, Inkscape::Extension: Builds a notebook page (a vbox) and puts parameters on it. */ Gtk::Widget * -ParamNotebookPage::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) +ParamNotebookPage::get_widget (Document * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) { if (_gui_hidden) return NULL; @@ -295,7 +295,7 @@ ParamNotebook::~ParamNotebook (void) the passed in value is duplicated using \c g_strdup(). */ const gchar * -ParamNotebook::set (const int in, SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/) +ParamNotebook::set (const int in, Document * /*doc*/, Inkscape::XML::Node * /*node*/) { ParamNotebookPage * page = NULL; int i = 0; @@ -347,14 +347,14 @@ ParamNotebook::string (std::list &list) class ParamNotebookWdg : public Gtk::Notebook { private: ParamNotebook * _pref; - SPDocument * _doc; + Document * _doc; Inkscape::XML::Node * _node; public: /** \brief Build a notebookpage preference for the given parameter \param pref Where to get the string (pagename) from, and where to put it when it changes. */ - ParamNotebookWdg (ParamNotebook * pref, SPDocument * doc, Inkscape::XML::Node * node) : + ParamNotebookWdg (ParamNotebook * pref, Document * doc, Inkscape::XML::Node * node) : Gtk::Notebook(), _pref(pref), _doc(doc), _node(node), activated(false) { // don't have to set the correct page: this is done in ParamNotebook::get_widget. // hook function @@ -389,7 +389,7 @@ ParamNotebookWdg::changed_page(GtkNotebookPage */*page*/, Builds a notebook and puts pages in it. */ Gtk::Widget * -ParamNotebook::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) +ParamNotebook::get_widget (Document * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) { if (_gui_hidden) return NULL; diff --git a/src/extension/param/parameter.cpp b/src/extension/param/parameter.cpp index 2773af61d..1094a5d3f 100644 --- a/src/extension/param/parameter.cpp +++ b/src/extension/param/parameter.cpp @@ -156,7 +156,7 @@ Parameter::make (Inkscape::XML::Node * in_repr, Inkscape::Extension::Extension * /** \brief Wrapper to cast to the object and use it's function. */ bool -Parameter::get_bool (const SPDocument * doc, const Inkscape::XML::Node * node) +Parameter::get_bool (const Document * doc, const Inkscape::XML::Node * node) { ParamBool * boolpntr = dynamic_cast(this); if (boolpntr == NULL) @@ -166,7 +166,7 @@ Parameter::get_bool (const SPDocument * doc, const Inkscape::XML::Node * node) /** \brief Wrapper to cast to the object and use it's function. */ int -Parameter::get_int (const SPDocument * doc, const Inkscape::XML::Node * node) +Parameter::get_int (const Document * doc, const Inkscape::XML::Node * node) { ParamInt * intpntr = dynamic_cast(this); if (intpntr == NULL) @@ -176,7 +176,7 @@ Parameter::get_int (const SPDocument * doc, const Inkscape::XML::Node * node) /** \brief Wrapper to cast to the object and use it's function. */ float -Parameter::get_float (const SPDocument * doc, const Inkscape::XML::Node * node) +Parameter::get_float (const Document * doc, const Inkscape::XML::Node * node) { ParamFloat * floatpntr = dynamic_cast(this); if (floatpntr == NULL) @@ -186,7 +186,7 @@ Parameter::get_float (const SPDocument * doc, const Inkscape::XML::Node * node) /** \brief Wrapper to cast to the object and use it's function. */ const gchar * -Parameter::get_string (const SPDocument * doc, const Inkscape::XML::Node * node) +Parameter::get_string (const Document * doc, const Inkscape::XML::Node * node) { ParamString * stringpntr = dynamic_cast(this); if (stringpntr == NULL) @@ -196,7 +196,7 @@ Parameter::get_string (const SPDocument * doc, const Inkscape::XML::Node * node) /** \brief Wrapper to cast to the object and use it's function. */ const gchar * -Parameter::get_enum (const SPDocument * doc, const Inkscape::XML::Node * node) +Parameter::get_enum (const Document * doc, const Inkscape::XML::Node * node) { ParamComboBox * param = dynamic_cast(this); if (param == NULL) @@ -205,7 +205,7 @@ Parameter::get_enum (const SPDocument * doc, const Inkscape::XML::Node * node) } guint32 -Parameter::get_color(const SPDocument* doc, const Inkscape::XML::Node* node) +Parameter::get_color(const Document* doc, const Inkscape::XML::Node* node) { ParamColor* param = dynamic_cast(this); if (param == NULL) @@ -215,7 +215,7 @@ Parameter::get_color(const SPDocument* doc, const Inkscape::XML::Node* node) /** \brief Wrapper to cast to the object and use it's function. */ bool -Parameter::set_bool (bool in, SPDocument * doc, Inkscape::XML::Node * node) +Parameter::set_bool (bool in, Document * doc, Inkscape::XML::Node * node) { ParamBool * boolpntr = dynamic_cast(this); if (boolpntr == NULL) @@ -225,7 +225,7 @@ Parameter::set_bool (bool in, SPDocument * doc, Inkscape::XML::Node * node) /** \brief Wrapper to cast to the object and use it's function. */ int -Parameter::set_int (int in, SPDocument * doc, Inkscape::XML::Node * node) +Parameter::set_int (int in, Document * doc, Inkscape::XML::Node * node) { ParamInt * intpntr = dynamic_cast(this); if (intpntr == NULL) @@ -235,7 +235,7 @@ Parameter::set_int (int in, SPDocument * doc, Inkscape::XML::Node * node) /** \brief Wrapper to cast to the object and use it's function. */ float -Parameter::set_float (float in, SPDocument * doc, Inkscape::XML::Node * node) +Parameter::set_float (float in, Document * doc, Inkscape::XML::Node * node) { ParamFloat * floatpntr; floatpntr = dynamic_cast(this); @@ -246,7 +246,7 @@ Parameter::set_float (float in, SPDocument * doc, Inkscape::XML::Node * node) /** \brief Wrapper to cast to the object and use it's function. */ const gchar * -Parameter::set_string (const gchar * in, SPDocument * doc, Inkscape::XML::Node * node) +Parameter::set_string (const gchar * in, Document * doc, Inkscape::XML::Node * node) { ParamString * stringpntr = dynamic_cast(this); if (stringpntr == NULL) @@ -255,7 +255,7 @@ Parameter::set_string (const gchar * in, SPDocument * doc, Inkscape::XML::Node * } /** \brief Wrapper to cast to the object and use it's function. */ guint32 -Parameter::set_color (guint32 in, SPDocument * doc, Inkscape::XML::Node * node) +Parameter::set_color (guint32 in, Document * doc, Inkscape::XML::Node * node) { ParamColor* param = dynamic_cast(this); if (param == NULL) @@ -323,7 +323,7 @@ Parameter::new_child (Inkscape::XML::Node * parent) } Inkscape::XML::Node * -Parameter::document_param_node (SPDocument * doc) +Parameter::document_param_node (Document * doc) { Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc); Inkscape::XML::Node * defs = SP_OBJECT_REPR(SP_DOCUMENT_DEFS(doc)); @@ -353,7 +353,7 @@ Parameter::document_param_node (SPDocument * doc) /** \brief Basically, if there is no widget pass a NULL. */ Gtk::Widget * -Parameter::get_widget (SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/, sigc::signal * /*changeSignal*/) +Parameter::get_widget (Document * /*doc*/, Inkscape::XML::Node * /*node*/, sigc::signal * /*changeSignal*/) { return NULL; } diff --git a/src/extension/param/radiobutton.cpp b/src/extension/param/radiobutton.cpp index c17839001..315984e17 100644 --- a/src/extension/param/radiobutton.cpp +++ b/src/extension/param/radiobutton.cpp @@ -149,7 +149,7 @@ ParamRadioButton::~ParamRadioButton (void) the passed in value is duplicated using \c g_strdup(). */ const gchar * -ParamRadioButton::set (const gchar * in, SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/) +ParamRadioButton::set (const gchar * in, Document * /*doc*/, Inkscape::XML::Node * /*node*/) { if (in == NULL) return NULL; /* Can't have NULL string */ @@ -189,7 +189,7 @@ ParamRadioButton::string (std::string &string) class ParamRadioButtonWdg : public Gtk::RadioButton { private: ParamRadioButton * _pref; - SPDocument * _doc; + Document * _doc; Inkscape::XML::Node * _node; sigc::signal * _changeSignal; public: @@ -197,12 +197,12 @@ public: \param pref Where to put the radiobutton's string when it is selected. */ ParamRadioButtonWdg ( Gtk::RadioButtonGroup& group, const Glib::ustring& label, - ParamRadioButton * pref, SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal ) : + ParamRadioButton * pref, Document * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal ) : Gtk::RadioButton(group, label), _pref(pref), _doc(doc), _node(node), _changeSignal(changeSignal) { add_changesignal(); }; ParamRadioButtonWdg ( const Glib::ustring& label, - ParamRadioButton * pref, SPDocument * doc, Inkscape::XML::Node * node , sigc::signal * changeSignal) : + ParamRadioButton * pref, Document * doc, Inkscape::XML::Node * node , sigc::signal * changeSignal) : Gtk::RadioButton(label), _pref(pref), _doc(doc), _node(node), _changeSignal(changeSignal) { add_changesignal(); }; @@ -232,7 +232,7 @@ ParamRadioButtonWdg::changed (void) class ComboWdg : public Gtk::ComboBoxText { public: - ComboWdg(ParamRadioButton* base, SPDocument * doc, Inkscape::XML::Node * node) : + ComboWdg(ParamRadioButton* base, Document * doc, Inkscape::XML::Node * node) : Gtk::ComboBoxText(), base(base), doc(doc), @@ -243,7 +243,7 @@ public: protected: ParamRadioButton* base; - SPDocument* doc; + Document* doc; Inkscape::XML::Node* node; virtual void on_changed() { @@ -257,7 +257,7 @@ protected: \brief Creates a combobox widget for an enumeration parameter */ Gtk::Widget * -ParamRadioButton::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) +ParamRadioButton::get_widget (Document * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) { if (_gui_hidden) return NULL; diff --git a/src/extension/param/string.cpp b/src/extension/param/string.cpp index e32224332..6427f6f76 100644 --- a/src/extension/param/string.cpp +++ b/src/extension/param/string.cpp @@ -42,7 +42,7 @@ ParamString::~ParamString(void) the passed in value is duplicated using \c g_strdup(). */ const gchar * -ParamString::set (const gchar * in, SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/) +ParamString::set (const gchar * in, Document * /*doc*/, Inkscape::XML::Node * /*node*/) { if (in == NULL) return NULL; /* Can't have NULL string */ @@ -96,7 +96,7 @@ ParamString::ParamString (const gchar * name, const gchar * guitext, const gchar class ParamStringEntry : public Gtk::Entry { private: ParamString * _pref; - SPDocument * _doc; + Document * _doc; Inkscape::XML::Node * _node; sigc::signal * _changeSignal; public: @@ -104,7 +104,7 @@ public: \param pref Where to get the string from, and where to put it when it changes. */ - ParamStringEntry (ParamString * pref, SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) : + ParamStringEntry (ParamString * pref, Document * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) : Gtk::Entry(), _pref(pref), _doc(doc), _node(node), _changeSignal(changeSignal) { if (_pref->get(NULL, NULL) != NULL) this->set_text(Glib::ustring(_pref->get(NULL, NULL))); @@ -137,7 +137,7 @@ ParamStringEntry::changed_text (void) Builds a hbox with a label and a text box in it. */ Gtk::Widget * -ParamString::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) +ParamString::get_widget (Document * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) { if (_gui_hidden) return NULL; diff --git a/src/ui/dialog/aboutbox.cpp b/src/ui/dialog/aboutbox.cpp index 025bec37a..af6a0c516 100644 --- a/src/ui/dialog/aboutbox.cpp +++ b/src/ui/dialog/aboutbox.cpp @@ -147,7 +147,7 @@ Gtk::Widget *build_splash_widget() { // should be in UTF-*8.. char *about=g_build_filename(INKSCAPE_SCREENSDIR, _("about.svg"), NULL); - SPDocument *doc=sp_document_new (about, TRUE); + Document *doc=sp_document_new (about, TRUE); g_free(about); g_return_val_if_fail(doc != NULL, NULL); diff --git a/src/ui/dialog/document-metadata.cpp b/src/ui/dialog/document-metadata.cpp index 96cad1fbe..f69d80fe5 100644 --- a/src/ui/dialog/document-metadata.cpp +++ b/src/ui/dialog/document-metadata.cpp @@ -207,7 +207,7 @@ DocumentMetadata::update() } void -DocumentMetadata::_handleDocumentReplaced(SPDesktop* desktop, SPDocument *) +DocumentMetadata::_handleDocumentReplaced(SPDesktop* desktop, Document *) { Inkscape::XML::Node *repr = SP_OBJECT_REPR(sp_desktop_namedview(desktop)); repr->addListener (&_repr_events, this); diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 423778276..0e928a9eb 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -851,7 +851,7 @@ DocumentProperties::on_response (int id) } void -DocumentProperties::_handleDocumentReplaced(SPDesktop* desktop, SPDocument *document) +DocumentProperties::_handleDocumentReplaced(SPDesktop* desktop, Document *document) { Inkscape::XML::Node *repr = SP_OBJECT_REPR(sp_desktop_namedview(desktop)); repr->addListener(&_repr_events, this); @@ -915,7 +915,7 @@ DocumentProperties::onNewGrid() { SPDesktop *dt = getDesktop(); Inkscape::XML::Node *repr = SP_OBJECT_REPR(sp_desktop_namedview(dt)); - SPDocument *doc = sp_desktop_document(dt); + Document *doc = sp_desktop_document(dt); Glib::ustring typestring = _grids_combo_gridtype.get_active_text(); CanvasGrid::writeNewGridToRepr(repr, doc, CanvasGrid::getGridTypeFromName(typestring.c_str())); diff --git a/src/ui/dialog/filedialogimpl-gtkmm.cpp b/src/ui/dialog/filedialogimpl-gtkmm.cpp index 70f2f2ae5..30a7e7c2a 100644 --- a/src/ui/dialog/filedialogimpl-gtkmm.cpp +++ b/src/ui/dialog/filedialogimpl-gtkmm.cpp @@ -120,7 +120,7 @@ findExpanderWidgets(Gtk::Container *parent, ### SVG Preview Widget #########################################################################*/ -bool SVGPreview::setDocument(SPDocument *doc) +bool SVGPreview::setDocument(Document *doc) { if (document) sp_document_unref(document); @@ -151,7 +151,7 @@ bool SVGPreview::setFileName(Glib::ustring &theFileName) * I don't know why passing false to keepalive is bad. But it * prevents the display of an svg with a non-ascii filename */ - SPDocument *doc = sp_document_new (fileName.c_str(), true); + Document *doc = sp_document_new (fileName.c_str(), true); if (!doc) { g_warning("SVGView: error loading document '%s'\n", fileName.c_str()); return false; @@ -172,7 +172,7 @@ bool SVGPreview::setFromMem(char const *xmlBuffer) return false; gint len = (gint)strlen(xmlBuffer); - SPDocument *doc = sp_document_new_from_mem(xmlBuffer, len, 0); + Document *doc = sp_document_new_from_mem(xmlBuffer, len, 0); if (!doc) { g_warning("SVGView: error loading buffer '%s'\n",xmlBuffer); return false; diff --git a/src/ui/dialog/filedialogimpl-win32.cpp b/src/ui/dialog/filedialogimpl-win32.cpp index 0d8f0de5f..4a2cc879d 100644 --- a/src/ui/dialog/filedialogimpl-win32.cpp +++ b/src/ui/dialog/filedialogimpl-win32.cpp @@ -887,7 +887,7 @@ bool FileOpenDialogImplWin32::set_svg_preview() gchar *utf8string = g_utf16_to_utf8((const gunichar2*)_path_string, _MAX_PATH, NULL, NULL, NULL); - SPDocument *svgDoc = sp_document_new (utf8string, true); + Document *svgDoc = sp_document_new (utf8string, true); g_free(utf8string); // Check the document loaded properly diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp index baf46970a..026af2c9f 100644 --- a/src/ui/dialog/filter-effects-dialog.cpp +++ b/src/ui/dialog/filter-effects-dialog.cpp @@ -1222,7 +1222,7 @@ void FilterEffectsDialog::FilterModifier::on_selection_toggled(const Glib::ustri if(iter) { SPDesktop *desktop = _dialog.getDesktop(); - SPDocument *doc = sp_desktop_document(desktop); + Document *doc = sp_desktop_document(desktop); SPFilter* filter = (*iter)[_columns.filter]; Inkscape::Selection *sel = sp_desktop_selection(desktop); @@ -1255,7 +1255,7 @@ void FilterEffectsDialog::FilterModifier::on_selection_toggled(const Glib::ustri void FilterEffectsDialog::FilterModifier::update_filters() { SPDesktop* desktop = _dialog.getDesktop(); - SPDocument* document = sp_desktop_document(desktop); + Document* document = sp_desktop_document(desktop); const GSList* filters = sp_document_get_resource_list(document, "filter"); _model->clear(); @@ -1310,7 +1310,7 @@ void FilterEffectsDialog::FilterModifier::filter_list_button_release(GdkEventBut void FilterEffectsDialog::FilterModifier::add_filter() { - SPDocument* doc = sp_desktop_document(_dialog.getDesktop()); + Document* doc = sp_desktop_document(_dialog.getDesktop()); SPFilter* filter = new_filter(doc); const int count = _model->children().size(); @@ -1330,7 +1330,7 @@ void FilterEffectsDialog::FilterModifier::remove_filter() SPFilter *filter = get_selected_filter(); if(filter) { - SPDocument* doc = filter->document; + Document* doc = filter->document; sp_repr_unparent(filter->repr); sp_document_done(doc, SP_VERB_DIALOG_FILTER_EFFECTS, _("Remove filter")); diff --git a/src/ui/dialog/guides.cpp b/src/ui/dialog/guides.cpp index 3a7964ba2..2d7f7cb5b 100644 --- a/src/ui/dialog/guides.cpp +++ b/src/ui/dialog/guides.cpp @@ -119,7 +119,7 @@ void GuidelinePropertiesDialog::_onOK() void GuidelinePropertiesDialog::_onDelete() { - SPDocument *doc = SP_OBJECT_DOCUMENT(_guide); + Document *doc = SP_OBJECT_DOCUMENT(_guide); sp_guide_remove(_guide); sp_document_done(doc, SP_VERB_NONE, _("Delete guide")); diff --git a/src/ui/dialog/icon-preview.cpp b/src/ui/dialog/icon-preview.cpp index 336afc3c5..1490e5b73 100644 --- a/src/ui/dialog/icon-preview.cpp +++ b/src/ui/dialog/icon-preview.cpp @@ -36,7 +36,7 @@ extern "C" { // takes doc, root, icon, and icon name to produce pixels guchar * -sp_icon_doc_icon( SPDocument *doc, NRArenaItem *root, +sp_icon_doc_icon( Document *doc, NRArenaItem *root, const gchar *name, unsigned int psize ); } @@ -247,7 +247,7 @@ void IconPreviewPanel::modeToggled() void IconPreviewPanel::renderPreview( SPObject* obj ) { - SPDocument * doc = SP_OBJECT_DOCUMENT(obj); + Document * doc = SP_OBJECT_DOCUMENT(obj); gchar * id = SP_OBJECT_ID(obj); // g_message(" setting up to render '%s' as the icon", id ); diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp index fa47ad88d..0298042ef 100644 --- a/src/ui/dialog/layers.cpp +++ b/src/ui/dialog/layers.cpp @@ -349,7 +349,7 @@ bool LayersPanel::_checkForSelected(const Gtk::TreePath &path, const Gtk::TreeIt void LayersPanel::_layersChanged() { // g_message("_layersChanged()"); - SPDocument* document = _desktop->doc(); + Document* document = _desktop->doc(); SPObject* root = document->root; if ( root ) { _selectedConnection.block(); @@ -366,7 +366,7 @@ void LayersPanel::_layersChanged() } } -void LayersPanel::_addLayer( SPDocument* doc, SPObject* layer, Gtk::TreeModel::Row* parentRow, SPObject* target, int level ) +void LayersPanel::_addLayer( Document* doc, SPObject* layer, Gtk::TreeModel::Row* parentRow, SPObject* target, int level ) { if ( layer && (level < _maxNestDepth) ) { unsigned int counter = _mgr->childCount(layer); diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp index dd2dc8250..bea8a096e 100644 --- a/src/ui/dialog/livepatheffect-editor.cpp +++ b/src/ui/dialog/livepatheffect-editor.cpp @@ -357,7 +357,7 @@ LivePathEffectEditor::onApply() if ( sel && !sel->isEmpty() ) { SPItem *item = sel->singleItem(); if ( item && SP_IS_LPE_ITEM(item) ) { - SPDocument *doc = current_desktop->doc(); + Document *doc = current_desktop->doc(); const Util::EnumData* data = combo_effecttype.get_active_data(); if (!data) return; diff --git a/src/ui/dialog/print.cpp b/src/ui/dialog/print.cpp index d15773ecb..198495f74 100644 --- a/src/ui/dialog/print.cpp +++ b/src/ui/dialog/print.cpp @@ -148,7 +148,7 @@ namespace Inkscape { namespace UI { namespace Dialog { -Print::Print(SPDocument *doc, SPItem *base) : +Print::Print(Document *doc, SPItem *base) : _doc (doc), _base (base) { diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp index 5f86196b1..64ea07877 100644 --- a/src/ui/dialog/svg-fonts-dialog.cpp +++ b/src/ui/dialog/svg-fonts-dialog.cpp @@ -161,7 +161,7 @@ void GlyphComboBox::update(SPFont* spfont){ void SvgFontsDialog::on_kerning_value_changed(){ if (!this->kerning_pair) return; - SPDocument* document = sp_desktop_document(this->getDesktop()); + Document* document = sp_desktop_document(this->getDesktop()); //TODO: I am unsure whether this is the correct way of calling sp_document_maybe_done Glib::ustring undokey = "svgfonts:hkern:k:"; @@ -242,7 +242,7 @@ void SvgFontsDialog::update_sensitiveness(){ void SvgFontsDialog::update_fonts() { SPDesktop* desktop = this->getDesktop(); - SPDocument* document = sp_desktop_document(desktop); + Document* document = sp_desktop_document(desktop); const GSList* fonts = sp_document_get_resource_list(document, "font"); _model->clear(); @@ -420,7 +420,7 @@ SvgFontsDialog::populate_kerning_pairs_box() } } -SPGlyph *new_glyph(SPDocument* document, SPFont *font, const int count) +SPGlyph *new_glyph(Document* document, SPFont *font, const int count) { g_return_val_if_fail(font != NULL, NULL); Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document); @@ -459,7 +459,7 @@ void SvgFontsDialog::update_glyphs(){ void SvgFontsDialog::add_glyph(){ const int count = _GlyphsListStore->children().size(); - SPDocument* doc = sp_desktop_document(this->getDesktop()); + Document* doc = sp_desktop_document(this->getDesktop()); /* SPGlyph* glyph =*/ new_glyph(doc, get_selected_spfont(), count+1); sp_document_done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Add glyph")); @@ -475,7 +475,7 @@ void SvgFontsDialog::set_glyph_description_from_selected_path(){ } Inkscape::MessageStack *msgStack = sp_desktop_message_stack(desktop); - SPDocument* doc = sp_desktop_document(desktop); + Document* doc = sp_desktop_document(desktop); Inkscape::Selection* sel = sp_desktop_selection(desktop); if (sel->isEmpty()){ char *msg = _("Select a path to define the curves of a glyph"); @@ -519,7 +519,7 @@ void SvgFontsDialog::missing_glyph_description_from_selected_path(){ } Inkscape::MessageStack *msgStack = sp_desktop_message_stack(desktop); - SPDocument* doc = sp_desktop_document(desktop); + Document* doc = sp_desktop_document(desktop); Inkscape::Selection* sel = sp_desktop_selection(desktop); if (sel->isEmpty()){ char *msg = _("Select a path to define the curves of a glyph"); @@ -562,7 +562,7 @@ void SvgFontsDialog::reset_missing_glyph_description(){ return; } - SPDocument* doc = sp_desktop_document(desktop); + Document* doc = sp_desktop_document(desktop); SPObject* obj; for (obj = get_selected_spfont()->children; obj; obj=obj->next){ if (SP_IS_MISSING_GLYPH(obj)){ @@ -581,7 +581,7 @@ void SvgFontsDialog::glyph_name_edit(const Glib::ustring&, const Glib::ustring& SPGlyph* glyph = (*i)[_GlyphsListColumns.glyph_node]; glyph->repr->setAttribute("glyph-name", str.c_str()); - SPDocument* doc = sp_desktop_document(this->getDesktop()); + Document* doc = sp_desktop_document(this->getDesktop()); sp_document_done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Edit glyph name")); update_glyphs(); @@ -594,7 +594,7 @@ void SvgFontsDialog::glyph_unicode_edit(const Glib::ustring&, const Glib::ustrin SPGlyph* glyph = (*i)[_GlyphsListColumns.glyph_node]; glyph->repr->setAttribute("unicode", str.c_str()); - SPDocument* doc = sp_desktop_document(this->getDesktop()); + Document* doc = sp_desktop_document(this->getDesktop()); sp_document_done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Set glyph unicode")); update_glyphs(); @@ -604,7 +604,7 @@ void SvgFontsDialog::remove_selected_font(){ SPFont* font = get_selected_spfont(); sp_repr_unparent(font->repr); - SPDocument* doc = sp_desktop_document(this->getDesktop()); + Document* doc = sp_desktop_document(this->getDesktop()); sp_document_done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Remove font")); update_fonts(); @@ -619,7 +619,7 @@ void SvgFontsDialog::remove_selected_glyph(){ SPGlyph* glyph = (*i)[_GlyphsListColumns.glyph_node]; sp_repr_unparent(glyph->repr); - SPDocument* doc = sp_desktop_document(this->getDesktop()); + Document* doc = sp_desktop_document(this->getDesktop()); sp_document_done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Remove glyph")); update_glyphs(); @@ -634,7 +634,7 @@ void SvgFontsDialog::remove_selected_kerning_pair(){ SPGlyphKerning* pair = (*i)[_KerningPairsListColumns.spnode]; sp_repr_unparent(pair->repr); - SPDocument* doc = sp_desktop_document(this->getDesktop()); + Document* doc = sp_desktop_document(this->getDesktop()); sp_document_done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Remove kerning pair")); update_glyphs(); @@ -705,7 +705,7 @@ void SvgFontsDialog::add_kerning_pair(){ if (this->kerning_pair) return; //We already have this kerning pair - SPDocument* document = sp_desktop_document(this->getDesktop()); + Document* document = sp_desktop_document(this->getDesktop()); Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document); // create a new hkern node @@ -767,7 +767,7 @@ Gtk::VBox* SvgFontsDialog::kerning_tab(){ return &kerning_vbox; } -SPFont *new_font(SPDocument *document) +SPFont *new_font(Document *document) { g_return_val_if_fail(document != NULL, NULL); @@ -820,7 +820,7 @@ void set_font_family(SPFont* font, char* str){ } void SvgFontsDialog::add_font(){ - SPDocument* doc = sp_desktop_document(this->getDesktop()); + Document* doc = sp_desktop_document(this->getDesktop()); SPFont* font = new_font(doc); const int count = _model->children().size(); diff --git a/src/ui/dialog/swatches.cpp b/src/ui/dialog/swatches.cpp index e273a827c..cdd479e9d 100644 --- a/src/ui/dialog/swatches.cpp +++ b/src/ui/dialog/swatches.cpp @@ -377,7 +377,7 @@ static void editGradient( GtkMenuItem */*menuitem*/, gpointer /*user_data*/ ) if ( bounceTarget ) { SwatchesPanel* swp = bounceTarget->ptr ? reinterpret_cast(bounceTarget->ptr) : 0; SPDesktop* desktop = swp ? swp->getDesktop() : 0; - SPDocument *doc = desktop ? desktop->doc() : 0; + Document *doc = desktop ? desktop->doc() : 0; if (doc) { std::string targetName(bounceTarget->def.descr); const GSList *gradients = sp_document_get_resource_list(doc, "gradient"); @@ -397,7 +397,7 @@ static void addNewGradient( GtkMenuItem */*menuitem*/, gpointer /*user_data*/ ) if ( bounceTarget ) { SwatchesPanel* swp = bounceTarget->ptr ? reinterpret_cast(bounceTarget->ptr) : 0; SPDesktop* desktop = swp ? swp->getDesktop() : 0; - SPDocument *doc = desktop ? desktop->doc() : 0; + Document *doc = desktop ? desktop->doc() : 0; if (doc) { Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc); @@ -524,7 +524,7 @@ void ColorItem::_dropDataIn( GtkWidget */*widget*/, { } -static bool bruteForce( SPDocument* document, Inkscape::XML::Node* node, Glib::ustring const& match, int r, int g, int b ) +static bool bruteForce( Document* document, Inkscape::XML::Node* node, Glib::ustring const& match, int r, int g, int b ) { bool changed = false; @@ -612,7 +612,7 @@ void ColorItem::_colorDefChanged(void* data) { SPDesktop *desktop = SP_ACTIVE_DESKTOP; if ( desktop ) { - SPDocument* document = sp_desktop_document( desktop ); + Document* document = sp_desktop_document( desktop ); Inkscape::XML::Node *rroot = sp_document_repr_root( document ); if ( rroot ) { @@ -1362,9 +1362,9 @@ void SwatchesPanel::setDesktop( SPDesktop* desktop ) _currentDesktop->connectToolSubselectionChanged( sigc::hide(sigc::mem_fun(*this, &SwatchesPanel::_updateFromSelection))); - sigc::bound_mem_functor1 first = sigc::mem_fun(*this, &SwatchesPanel::_setDocument); - sigc::slot base2 = first; - sigc::slot slot2 = sigc::hide<0>( base2 ); + sigc::bound_mem_functor1 first = sigc::mem_fun(*this, &SwatchesPanel::_setDocument); + sigc::slot base2 = first; + sigc::slot slot2 = sigc::hide<0>( base2 ); _documentConnection = desktop->connectDocumentReplaced( slot2 ); _setDocument( desktop->doc() ); @@ -1374,7 +1374,7 @@ void SwatchesPanel::setDesktop( SPDesktop* desktop ) } } -void SwatchesPanel::_setDocument( SPDocument *document ) +void SwatchesPanel::_setDocument( Document *document ) { if ( document != _currentDocument ) { if ( _currentDocument ) { diff --git a/src/ui/view/edit-widget.cpp b/src/ui/view/edit-widget.cpp index 756f4df73..9619380bb 100644 --- a/src/ui/view/edit-widget.cpp +++ b/src/ui/view/edit-widget.cpp @@ -71,7 +71,7 @@ namespace Inkscape { namespace UI { namespace View { -EditWidget::EditWidget (SPDocument *doc) +EditWidget::EditWidget (Document *doc) : _main_window_table(4), _viewport_table(3,3), _act_grp(Gtk::ActionGroup::create()), @@ -1191,7 +1191,7 @@ EditWidget::shutdown() if (Inkscape::NSApplication::Editor::isDuplicatedView (_desktop)) return false; - SPDocument *doc = _desktop->doc(); + Document *doc = _desktop->doc(); if (doc->isModifiedSinceSave()) { gchar *markup; /// \todo FIXME !!! obviously this will have problems if the document @@ -1389,7 +1389,7 @@ EditWidget::updateScrollbars (double scale) _update_s_f = true; /* The desktop region we always show unconditionally */ - SPDocument *doc = _desktop->doc(); + Document *doc = _desktop->doc(); Geom::Rect darea ( Geom::Point(-sp_document_width(doc), -sp_document_height(doc)), Geom::Point(2 * sp_document_width(doc), 2 * sp_document_height(doc)) ); SPObject* root = doc->root; @@ -1548,7 +1548,7 @@ void EditWidget::_namedview_modified (SPObject *obj, guint flags) { } void -EditWidget::initEdit (SPDocument *doc) +EditWidget::initEdit (Document *doc) { _desktop = new SPDesktop(); _desktop->registerEditWidget (this); diff --git a/src/ui/view/view.cpp b/src/ui/view/view.cpp index 1b498a846..07bb6d2c1 100644 --- a/src/ui/view/view.cpp +++ b/src/ui/view/view.cpp @@ -137,7 +137,7 @@ void View::requestRedraw() * * \param doc The new document to connect the view to. */ -void View::setDocument(SPDocument *doc) { +void View::setDocument(Document *doc) { g_return_if_fail(doc != NULL); if (_doc) { diff --git a/src/ui/widget/entity-entry.cpp b/src/ui/widget/entity-entry.cpp index e9f09f574..f42b29760 100644 --- a/src/ui/widget/entity-entry.cpp +++ b/src/ui/widget/entity-entry.cpp @@ -81,7 +81,7 @@ EntityLineEntry::~EntityLineEntry() } void -EntityLineEntry::update (SPDocument *doc) +EntityLineEntry::update (Document *doc) { const char *text = rdf_get_work_entity (doc, _entity); static_cast(_packable)->set_text (text ? text : ""); @@ -93,7 +93,7 @@ EntityLineEntry::on_changed() if (_wr->isUpdating()) return; _wr->setUpdating (true); - SPDocument *doc = SP_ACTIVE_DOCUMENT; + Document *doc = SP_ACTIVE_DOCUMENT; Glib::ustring text = static_cast(_packable)->get_text(); if (rdf_set_work_entity (doc, _entity, text.c_str())) sp_document_done (doc, SP_VERB_NONE, @@ -122,7 +122,7 @@ EntityMultiLineEntry::~EntityMultiLineEntry() } void -EntityMultiLineEntry::update (SPDocument *doc) +EntityMultiLineEntry::update (Document *doc) { const char *text = rdf_get_work_entity (doc, _entity); Gtk::ScrolledWindow *s = static_cast(_packable); @@ -136,7 +136,7 @@ EntityMultiLineEntry::on_changed() if (_wr->isUpdating()) return; _wr->setUpdating (true); - SPDocument *doc = SP_ACTIVE_DOCUMENT; + Document *doc = SP_ACTIVE_DOCUMENT; Gtk::ScrolledWindow *s = static_cast(_packable); Gtk::TextView *tv = static_cast(s->get_child()); Glib::ustring text = tv->get_buffer()->get_text(); diff --git a/src/ui/widget/imageicon.cpp b/src/ui/widget/imageicon.cpp index 6a817e30d..ead32b4b7 100644 --- a/src/ui/widget/imageicon.cpp +++ b/src/ui/widget/imageicon.cpp @@ -94,13 +94,13 @@ void ImageIcon::init() } -bool ImageIcon::showSvgDocument(const SPDocument *docArg) +bool ImageIcon::showSvgDocument(const Document *docArg) { if (document) sp_document_unref(document); - SPDocument *doc = (SPDocument *)docArg; + Document *doc = (Document *)docArg; sp_document_ref(doc); document = doc; @@ -127,7 +127,7 @@ bool ImageIcon::showSvgFile(const Glib::ustring &theFileName) fileName = Glib::filename_to_utf8(fileName); - SPDocument *doc = sp_document_new (fileName.c_str(), 0); + Document *doc = sp_document_new (fileName.c_str(), 0); if (!doc) { g_warning("SVGView: error loading document '%s'\n", fileName.c_str()); return false; @@ -148,7 +148,7 @@ bool ImageIcon::showSvgFromMemory(const char *xmlBuffer) return false; gint len = (gint)strlen(xmlBuffer); - SPDocument *doc = sp_document_new_from_mem(xmlBuffer, len, 0); + Document *doc = sp_document_new_from_mem(xmlBuffer, len, 0); if (!doc) { g_warning("SVGView: error loading buffer '%s'\n",xmlBuffer); return false; diff --git a/src/ui/widget/licensor.cpp b/src/ui/widget/licensor.cpp index a5f1d89be..778fbc6cc 100644 --- a/src/ui/widget/licensor.cpp +++ b/src/ui/widget/licensor.cpp @@ -119,7 +119,7 @@ Licensor::init (Gtk::Tooltips& tt, Registry& wr) } void -Licensor::update (SPDocument *doc) +Licensor::update (Document *doc) { /* identify the license info */ struct rdf_license_t * license = rdf_get_license (doc); diff --git a/src/ui/widget/object-composite-settings.cpp b/src/ui/widget/object-composite-settings.cpp index bfc291bc0..1b4251143 100644 --- a/src/ui/widget/object-composite-settings.cpp +++ b/src/ui/widget/object-composite-settings.cpp @@ -117,7 +117,7 @@ ObjectCompositeSettings::_blendBlurValueChanged() if (!desktop) { return; } - SPDocument *document = sp_desktop_document (desktop); + Document *document = sp_desktop_document (desktop); if (_blocked) return; diff --git a/src/ui/widget/page-sizer.cpp b/src/ui/widget/page-sizer.cpp index 02688a55e..429442779 100644 --- a/src/ui/widget/page-sizer.cpp +++ b/src/ui/widget/page-sizer.cpp @@ -346,7 +346,7 @@ PageSizer::setDim (double w, double h, bool changeList) _changedh_connection.block(); if (SP_ACTIVE_DESKTOP && !_widgetRegistry->isUpdating()) { - SPDocument *doc = sp_desktop_document(SP_ACTIVE_DESKTOP); + Document *doc = sp_desktop_document(SP_ACTIVE_DESKTOP); double const old_height = sp_document_height(doc); sp_document_set_width (doc, w, &_px_unit); sp_document_set_height (doc, h, &_px_unit); diff --git a/src/ui/widget/panel.cpp b/src/ui/widget/panel.cpp index 93a950d1a..c2fafa001 100644 --- a/src/ui/widget/panel.cpp +++ b/src/ui/widget/panel.cpp @@ -566,7 +566,7 @@ Panel::setResponseSensitive(int response_id, bool setting) _response_map[response_id]->set_sensitive(setting); } -sigc::signal & +sigc::signal & Panel::signalDocumentReplaced() { return _signal_document_replaced; diff --git a/src/ui/widget/registered-widget.cpp b/src/ui/widget/registered-widget.cpp index 95ddec286..5780f74ed 100644 --- a/src/ui/widget/registered-widget.cpp +++ b/src/ui/widget/registered-widget.cpp @@ -50,7 +50,7 @@ RegisteredCheckButton::~RegisteredCheckButton() _toggled_connection.disconnect(); } -RegisteredCheckButton::RegisteredCheckButton (const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, bool right, Inkscape::XML::Node* repr_in, SPDocument *doc_in) +RegisteredCheckButton::RegisteredCheckButton (const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, bool right, Inkscape::XML::Node* repr_in, Document *doc_in) : RegisteredWidget() { init_parent(key, wr, repr_in, doc_in); @@ -108,7 +108,7 @@ RegisteredUnitMenu::~RegisteredUnitMenu() _changed_connection.disconnect(); } -RegisteredUnitMenu::RegisteredUnitMenu (const Glib::ustring& label, const Glib::ustring& key, Registry& wr, Inkscape::XML::Node* repr_in, SPDocument *doc_in) +RegisteredUnitMenu::RegisteredUnitMenu (const Glib::ustring& label, const Glib::ustring& key, Registry& wr, Inkscape::XML::Node* repr_in, Document *doc_in) : RegisteredWidget (label, "" /*tooltip*/, new UnitMenu()) { init_parent(key, wr, repr_in, doc_in); @@ -149,7 +149,7 @@ RegisteredScalarUnit::~RegisteredScalarUnit() _value_changed_connection.disconnect(); } -RegisteredScalarUnit::RegisteredScalarUnit (const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, const RegisteredUnitMenu &rum, Registry& wr, Inkscape::XML::Node* repr_in, SPDocument *doc_in) +RegisteredScalarUnit::RegisteredScalarUnit (const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, const RegisteredUnitMenu &rum, Registry& wr, Inkscape::XML::Node* repr_in, Document *doc_in) : RegisteredWidget(label, tip, UNIT_TYPE_LINEAR, "", "", rum.getUnitMenu()), _um(0) { @@ -200,7 +200,7 @@ RegisteredScalar::~RegisteredScalar() RegisteredScalar::RegisteredScalar ( const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, Inkscape::XML::Node* repr_in, - SPDocument * doc_in ) + Document * doc_in ) : RegisteredWidget(label, tip) { init_parent(key, wr, repr_in, doc_in); @@ -248,7 +248,7 @@ RegisteredText::~RegisteredText() RegisteredText::RegisteredText ( const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, Inkscape::XML::Node* repr_in, - SPDocument * doc_in ) + Document * doc_in ) : RegisteredWidget(label, tip) { init_parent(key, wr, repr_in, doc_in); @@ -296,7 +296,7 @@ RegisteredColorPicker::RegisteredColorPicker(const Glib::ustring& label, const Glib::ustring& akey, Registry& wr, Inkscape::XML::Node* repr_in, - SPDocument *doc_in) + Document *doc_in) : RegisteredWidget (title, tip, 0, true) { init_parent("", wr, repr_in, doc_in); @@ -337,7 +337,7 @@ RegisteredColorPicker::on_changed (guint32 rgba) // Use local repr here. When repr is specified, use that one, but // if repr==NULL, get the repr of namedview of active desktop. Inkscape::XML::Node *local_repr = repr; - SPDocument *local_doc = doc; + Document *local_doc = doc; if (!local_repr) { // no repr specified, use active desktop's namedview's repr SPDesktop *dt = SP_ACTIVE_DESKTOP; @@ -372,7 +372,7 @@ RegisteredSuffixedInteger::~RegisteredSuffixedInteger() _changed_connection.disconnect(); } -RegisteredSuffixedInteger::RegisteredSuffixedInteger (const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& suffix, const Glib::ustring& key, Registry& wr, Inkscape::XML::Node* repr_in, SPDocument *doc_in) +RegisteredSuffixedInteger::RegisteredSuffixedInteger (const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& suffix, const Glib::ustring& key, Registry& wr, Inkscape::XML::Node* repr_in, Document *doc_in) : RegisteredWidget(label, tip, 0, suffix), setProgrammatically(false) { @@ -419,7 +419,7 @@ RegisteredRadioButtonPair::~RegisteredRadioButtonPair() RegisteredRadioButtonPair::RegisteredRadioButtonPair (const Glib::ustring& label, const Glib::ustring& label1, const Glib::ustring& label2, const Glib::ustring& tip1, const Glib::ustring& tip2, - const Glib::ustring& key, Registry& wr, Inkscape::XML::Node* repr_in, SPDocument *doc_in) + const Glib::ustring& key, Registry& wr, Inkscape::XML::Node* repr_in, Document *doc_in) : RegisteredWidget(), _rb1(NULL), _rb2(NULL) @@ -486,7 +486,7 @@ RegisteredPoint::~RegisteredPoint() RegisteredPoint::RegisteredPoint ( const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, Inkscape::XML::Node* repr_in, - SPDocument* doc_in ) + Document* doc_in ) : RegisteredWidget (label, tip) { init_parent(key, wr, repr_in, doc_in); @@ -531,7 +531,7 @@ RegisteredTransformedPoint::~RegisteredTransformedPoint() RegisteredTransformedPoint::RegisteredTransformedPoint ( const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, Inkscape::XML::Node* repr_in, - SPDocument* doc_in ) + Document* doc_in ) : RegisteredWidget (label, tip), to_svg(Geom::identity()) { @@ -598,7 +598,7 @@ RegisteredRandom::~RegisteredRandom() RegisteredRandom::RegisteredRandom ( const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, Inkscape::XML::Node* repr_in, - SPDocument * doc_in ) + Document * doc_in ) : RegisteredWidget (label, tip) { init_parent(key, wr, repr_in, doc_in); diff --git a/src/ui/widget/tolerance-slider.cpp b/src/ui/widget/tolerance-slider.cpp index 3a36127f4..bc5b45979 100644 --- a/src/ui/widget/tolerance-slider.cpp +++ b/src/ui/widget/tolerance-slider.cpp @@ -185,7 +185,7 @@ ToleranceSlider::update (double val) _wr->setUpdating (true); - SPDocument *doc = sp_desktop_document(dt); + Document *doc = sp_desktop_document(dt); bool saved = sp_document_get_undo_sensitive (doc); sp_document_set_undo_sensitive (doc, false); Inkscape::XML::Node *repr = SP_OBJECT_REPR (sp_desktop_namedview(dt)); -- cgit v1.2.3 From 4e52fb5a8a6644c0394b9aef689400fad81d24cc Mon Sep 17 00:00:00 2001 From: johnce Date: Wed, 5 Aug 2009 06:39:04 +0000 Subject: SPDocument->Document (bzr r8409) --- src/extension/internal/pdfinput/pdf-input.h | 2 +- src/extension/internal/pdfinput/svg-builder.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/extension/internal/pdfinput/pdf-input.h b/src/extension/internal/pdfinput/pdf-input.h index 6bf0f11a2..968114ef3 100644 --- a/src/extension/internal/pdfinput/pdf-input.h +++ b/src/extension/internal/pdfinput/pdf-input.h @@ -113,7 +113,7 @@ private: class PdfInput: public Inkscape::Extension::Implementation::Implementation { PdfInput () { }; public: - SPDocument *open( Inkscape::Extension::Input *mod, + Document *open( Inkscape::Extension::Input *mod, const gchar *uri ); static void init( void ); diff --git a/src/extension/internal/pdfinput/svg-builder.h b/src/extension/internal/pdfinput/svg-builder.h index 3b9192d31..1f84ffcc3 100644 --- a/src/extension/internal/pdfinput/svg-builder.h +++ b/src/extension/internal/pdfinput/svg-builder.h @@ -18,7 +18,7 @@ #ifdef HAVE_POPPLER -class SPDocument; +class Document; namespace Inkscape { namespace XML { class Document; @@ -95,7 +95,7 @@ struct SvgGlyph { */ class SvgBuilder { public: - SvgBuilder(SPDocument *document, gchar *docname, XRef *xref); + SvgBuilder(Document *document, gchar *docname, XRef *xref); SvgBuilder(SvgBuilder *parent, Inkscape::XML::Node *root); virtual ~SvgBuilder(); @@ -220,7 +220,7 @@ private: std::vector _availableFontNames; // Full names, used for matching font names (Bug LP #179589). bool _is_top_level; // Whether this SvgBuilder is the top-level one - SPDocument *_doc; + Document *_doc; gchar *_docname; // Basename of the URI from which this document is created XRef *_xref; // Cross-reference table from the PDF doc we're converting from Inkscape::XML::Document *_xml_doc; -- cgit v1.2.3 From 5487b12d89e1e57c53af941bbafe51cf019a2a3c Mon Sep 17 00:00:00 2001 From: johnce Date: Wed, 5 Aug 2009 07:07:44 +0000 Subject: struct Document->class Document (bzr r8410) --- src/document.h | 1 + src/sp-object-repr.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/document.h b/src/document.h index b849181f9..45b828155 100644 --- a/src/document.h +++ b/src/document.h @@ -67,6 +67,7 @@ class Document : public Inkscape::GC::Managed<>, public Inkscape::GC::Finalized, public Inkscape::GC::Anchored { +public: typedef sigc::signal IDChangedSignal; typedef sigc::signal ResourcesChangedSignal; typedef sigc::signal ModifiedSignal; diff --git a/src/sp-object-repr.h b/src/sp-object-repr.h index 0dec20fe0..5a6b1772f 100644 --- a/src/sp-object-repr.h +++ b/src/sp-object-repr.h @@ -21,7 +21,7 @@ class Node; } -SPObject *sp_object_repr_build_tree (ocument *document, Inkscape::XML::Node *repr); +SPObject *sp_object_repr_build_tree (Document *document, Inkscape::XML::Node *repr); GType sp_repr_type_lookup (Inkscape::XML::Node *repr); -- cgit v1.2.3 From ca7bb4a2bf25b18014dbed47aa5a375d752f5692 Mon Sep 17 00:00:00 2001 From: chriswombat Date: Wed, 5 Aug 2009 08:10:42 +0000 Subject: Changed Inkscape logo icon mapping from "inkscape" to "inkscape-logo" as "inkscape" wasn't working (probably some obscure bug somewhere with a reserved name or similar). This fixes the problem where the About Inkscape menu item in Help had a broken image picture rather than the Inkscape logo (on Win32 at least). (bzr r8411) --- src/ui/icon-names.h | 2 +- src/widgets/icon.cpp | 2 +- src/widgets/mappings.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ui/icon-names.h b/src/ui/icon-names.h index 3332dd8cf..f9a6f2a7d 100644 --- a/src/ui/icon-names.h +++ b/src/ui/icon-names.h @@ -235,7 +235,7 @@ #define INKSCAPE_ICON_IMAGE_FILTER_TURBULENCE \ "image-filter-turbulence" #define INKSCAPE_ICON_INKSCAPE \ - "inkscape" + "inkscape-logo" #define INKSCAPE_ICON_LAYER_BOTTOM \ "layer-bottom" #define INKSCAPE_ICON_LAYER_DELETE \ diff --git a/src/widgets/icon.cpp b/src/widgets/icon.cpp index 5e47bd8e4..56602962d 100644 --- a/src/widgets/icon.cpp +++ b/src/widgets/icon.cpp @@ -381,7 +381,7 @@ static void setupLegacyNaming() { legacyNames["text-unkern"] ="remove_manual_kerns"; legacyNames["help-keyboard-shortcuts"] ="help_keys"; legacyNames["help-contents"] ="help_tutorials"; - legacyNames["inkscape"] ="inkscape_options"; + legacyNames["inkscape-logo"] ="inkscape_options"; legacyNames["dialog-memory"] ="about_memory"; legacyNames["tool-pointer"] ="draw_select"; legacyNames["tool-node-editor"] ="draw_node"; diff --git a/src/widgets/mappings.xml b/src/widgets/mappings.xml index f142c450c..2de3ff545 100644 --- a/src/widgets/mappings.xml +++ b/src/widgets/mappings.xml @@ -113,7 +113,7 @@ - + -- cgit v1.2.3 From a68dd35a31e54a4340d54a491a8f1b45d73352f4 Mon Sep 17 00:00:00 2001 From: johnce Date: Wed, 5 Aug 2009 17:25:25 +0000 Subject: SPDocument->Document (bzr r8416) --- src/document.cpp | 2 +- src/extension/internal/gdkpixbuf-input.cpp | 2 +- src/file.cpp | 2 +- src/xml/repr-css.cpp | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/document.cpp b/src/document.cpp index 750b29301..4289205c1 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -638,7 +638,7 @@ do_change_uri(Document *const document, gchar const *const filename, bool const sp_document_set_undo_sensitive(document, false); if (rebase) { - Inkscape::XML::rebase_hrefs(document, new_base, true); + Inkscape::XML::rebase_hrefs((Inkscape::XML::Document *)document, new_base, true); } repr->setAttribute("sodipodi:docname", document->name); diff --git a/src/extension/internal/gdkpixbuf-input.cpp b/src/extension/internal/gdkpixbuf-input.cpp index 2f52561d1..2aea1cc64 100644 --- a/src/extension/internal/gdkpixbuf-input.cpp +++ b/src/extension/internal/gdkpixbuf-input.cpp @@ -19,7 +19,7 @@ namespace Internal { Document * GdkpixbufInput::open(Inkscape::Extension::Input */*mod*/, char const *uri) { - PDocument *doc = NULL; + Document *doc = NULL; GdkPixbuf *pb = Inkscape::IO::pixbuf_new_from_file( uri, NULL ); if (pb) { /* We are readable */ diff --git a/src/file.cpp b/src/file.cpp index afca379ca..22425547e 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -1070,7 +1070,7 @@ file_import(Document *in_doc, const Glib::ustring &uri, } if (doc != NULL) { - Inkscape::XML::rebase_hrefs(doc, in_doc->base, true); + Inkscape::XML::rebase_hrefs((Inkscape::XML::Document *)doc, in_doc->base, true); Inkscape::XML::Document *xml_in_doc = sp_document_repr_doc(in_doc); prevent_id_clashes(doc, in_doc); diff --git a/src/xml/repr-css.cpp b/src/xml/repr-css.cpp index be125f453..172cfa6f3 100644 --- a/src/xml/repr-css.cpp +++ b/src/xml/repr-css.cpp @@ -18,7 +18,7 @@ using Inkscape::XML::AttributeRecord; using Inkscape::XML::SimpleNode; using Inkscape::XML::Node; using Inkscape::XML::NodeType; -using Inkscape::XML::Document; +//using Inkscape::XML::Document; struct SPCSSAttrImpl : public SimpleNode, public SPCSSAttr { public: @@ -30,7 +30,7 @@ public: NodeType type() const { return Inkscape::XML::ELEMENT_NODE; } protected: - SimpleNode *_duplicate(Document* doc) const { return new SPCSSAttrImpl(*this, doc); } + SimpleNode *_duplicate(Inkscape::XML::Document* doc) const { return new SPCSSAttrImpl(*this, doc); } }; static void sp_repr_css_add_components(SPCSSAttr *css, Node *repr, gchar const *attr); -- cgit v1.2.3 From e8b5612f8dbe3cefaf56469320fa12bea9713a1b Mon Sep 17 00:00:00 2001 From: johnce Date: Wed, 5 Aug 2009 18:32:38 +0000 Subject: xml/Document -> DocumentTree (bzr r8417) --- src/arc-context.cpp | 3 ++- src/box3d-context.cpp | 2 +- src/document.h | 4 +++- src/xml/document.h | 6 +++--- src/xml/rebase-hrefs.cpp | 8 ++++---- src/xml/rebase-hrefs.h | 5 +++-- src/xml/repr-css.cpp | 8 ++++---- src/xml/repr.h | 2 +- 8 files changed, 21 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/arc-context.cpp b/src/arc-context.cpp index e689c93db..835e43a26 100644 --- a/src/arc-context.cpp +++ b/src/arc-context.cpp @@ -25,6 +25,7 @@ #include "display/sp-canvas.h" #include "sp-ellipse.h" #include "document.h" +#include "xml/document.h" #include "sp-namedview.h" #include "selection.h" #include "desktop-handles.h" @@ -403,7 +404,7 @@ static void sp_arc_drag(SPArcContext *ac, Geom::Point pt, guint state) } /* Create object */ - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(desktop->doc()); + Inkscape::XML::DocumentTree *xml_doc = sp_document_repr_doc(desktop->doc()); Inkscape::XML::Node *repr = xml_doc->createElement("svg:path"); repr->setAttribute("sodipodi:type", "arc"); diff --git a/src/box3d-context.cpp b/src/box3d-context.cpp index 7e6eaaa22..4146ec30d 100644 --- a/src/box3d-context.cpp +++ b/src/box3d-context.cpp @@ -561,7 +561,7 @@ static void sp_box3d_drag(Box3DContext &bc, guint /*state*/) } /* Create object */ - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_EVENT_CONTEXT_DOCUMENT(&bc)); + Inkscape::XML::DocumentTree *xml_doc = sp_document_repr_doc(SP_EVENT_CONTEXT_DOCUMENT(&bc)); Inkscape::XML::Node *repr = xml_doc->createElement("svg:g"); repr->setAttribute("sodipodi:type", "inkscape:box3d"); diff --git a/src/document.h b/src/document.h index 45b828155..cb83c4d0d 100644 --- a/src/document.h +++ b/src/document.h @@ -31,6 +31,8 @@ #include #include +#include "xml/document.h" + namespace Avoid { class Router; } @@ -84,7 +86,7 @@ public: unsigned int virgin : 1; ///< Has the document never been touched? unsigned int modified_since_save : 1; - Inkscape::XML::Document *rdoc; ///< Our Inkscape::XML::Document + Inkscape::XML::DocumentTree *rdoc; ///< Our Inkscape::XML::Document Inkscape::XML::Node *rroot; ///< Root element of Inkscape::XML::Document SPObject *root; ///< Our SPRoot CRCascade *style_cascade; diff --git a/src/xml/document.h b/src/xml/document.h index 2b9ea5cc3..a5f457fe8 100644 --- a/src/xml/document.h +++ b/src/xml/document.h @@ -12,8 +12,8 @@ * */ -#ifndef SEEN_INKSCAPE_XML_SP_REPR_DOC_H -#define SEEN_INKSCAPE_XML_SP_REPR_DOC_H +#ifndef SEEN_INKSCAPE_XML_SP_REPR_DOCTREE_H +#define SEEN_INKSCAPE_XML_SP_REPR_DOCTREE_H #include "xml/xml-forward.h" #include "xml/node.h" @@ -41,7 +41,7 @@ namespace XML { * "restore point" by calling beginTransaction() again. There can be only one active * transaction at a time for a given document. */ -struct Document : virtual public Node { +class DocumentTree : virtual public Node { public: /** * @name Document transactions diff --git a/src/xml/rebase-hrefs.cpp b/src/xml/rebase-hrefs.cpp index 8d771fef2..0fa5c0337 100644 --- a/src/xml/rebase-hrefs.cpp +++ b/src/xml/rebase-hrefs.cpp @@ -1,6 +1,6 @@ #include "xml/rebase-hrefs.h" #include "dir-util.h" -#include "../document.h" /* Unfortunately there's a separate xml/document.h. */ +#include "document.h" /* Unfortunately there's a separate xml/document.h. */ #include "io/sys.h" #include "sp-object.h" #include "streq.h" @@ -199,9 +199,9 @@ Inkscape::XML::calc_abs_doc_base(gchar const *const doc_base) * * \param spns True iff doc should contain sodipodi:absref attributes. */ -void Inkscape::XML::rebase_hrefs(Document *const doc, gchar const *const new_base, bool const spns) +void Inkscape::XML::rebase_hrefs(Inkscape::XML::Document *doc, gchar const *const new_base, bool const spns) { - gchar *const old_abs_base = calc_abs_doc_base(doc->base); + gchar *const old_abs_base = calc_abs_doc_base((Inkscape::XML::Document *)(doc)->base); gchar *const new_abs_base = calc_abs_doc_base(new_base); /* TODO: Should handle not just image but also: @@ -224,7 +224,7 @@ void Inkscape::XML::rebase_hrefs(Document *const doc, gchar const *const new_bas * * Note also that Inkscape only supports fragment hrefs (href="#pattern257") for many of these * cases. */ - GSList const *images = sp_document_get_resource_list(doc, "image"); + GSList const *images = sp_document_get_resource_list((Inkscape::XML::Document *)doc, "image"); for (GSList const *l = images; l != NULL; l = l->next) { Inkscape::XML::Node *ir = SP_OBJECT_REPR(l->data); diff --git a/src/xml/rebase-hrefs.h b/src/xml/rebase-hrefs.h index 2f82a5587..36de6ba6e 100644 --- a/src/xml/rebase-hrefs.h +++ b/src/xml/rebase-hrefs.h @@ -4,14 +4,15 @@ #include #include "util/list.h" #include "xml/attribute-record.h" -struct Document; +#include "document.h" namespace Inkscape { namespace XML { +//struct Document; gchar *calc_abs_doc_base(gchar const *doc_base); -void rebase_hrefs(Document *doc, gchar const *new_base, bool spns); +void rebase_hrefs(Inkscape::XML::Document *doc, gchar const *new_base, bool spns); Inkscape::Util::List rebase_href_attrs( gchar const *old_abs_base, diff --git a/src/xml/repr-css.cpp b/src/xml/repr-css.cpp index 172cfa6f3..a7e913853 100644 --- a/src/xml/repr-css.cpp +++ b/src/xml/repr-css.cpp @@ -22,15 +22,15 @@ using Inkscape::XML::NodeType; struct SPCSSAttrImpl : public SimpleNode, public SPCSSAttr { public: - SPCSSAttrImpl(Document *doc) + SPCSSAttrImpl(Inkscape::XML::Document *doc) : SimpleNode(g_quark_from_static_string("css"), doc) {} - SPCSSAttrImpl(SPCSSAttrImpl const &other, Document *doc) - : SimpleNode(other, doc) {} + SPCSSAttrImpl(SPCSSAttrImpl const &other, Inkscape::XML::Document *doc) + : SimpleNode(other, (Inkscape::XML::Document *)doc) {} NodeType type() const { return Inkscape::XML::ELEMENT_NODE; } protected: - SimpleNode *_duplicate(Inkscape::XML::Document* doc) const { return new SPCSSAttrImpl(*this, doc); } + SimpleNode *_duplicate(Inkscape::XML::Document* doc) const { return new SPCSSAttrImpl(*this, (Inkscape::XML::Document *)doc); } }; static void sp_repr_css_add_components(SPCSSAttr *css, Node *repr, gchar const *attr); diff --git a/src/xml/repr.h b/src/xml/repr.h index 549822e4e..b40fe63a9 100644 --- a/src/xml/repr.h +++ b/src/xml/repr.h @@ -148,7 +148,7 @@ Inkscape::XML::Node *sp_repr_lookup_child(Inkscape::XML::Node *repr, gchar const *value); -inline Inkscape::XML::Node *sp_repr_document_first_child(Inkscape::XML::Document const *doc) { +inline Inkscape::XML::Node *sp_repr_document_first_child(Inkscape::XML::DocumentTree const *doc) { return const_cast(doc->firstChild()); } -- cgit v1.2.3 From 2553d36fec571b5a5da41ba08fe0f2740be4e451 Mon Sep 17 00:00:00 2001 From: johnce Date: Wed, 5 Aug 2009 19:46:20 +0000 Subject: Inkscape::XML::Document -> Inkscape::XML::DocumentTree (more refactoring ...) (bzr r8420) --- src/box3d.cpp | 16 ++++++++-------- src/forward.h | 5 ++++- src/sp-object.h | 8 ++++---- src/verbs.h | 4 ++-- src/xml/node.h | 2 ++ src/xml/xml-forward.h | 2 +- 6 files changed, 21 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/box3d.cpp b/src/box3d.cpp index 9ec0625aa..0caf7b1ef 100644 --- a/src/box3d.cpp +++ b/src/box3d.cpp @@ -43,11 +43,11 @@ static void box3d_class_init(SPBox3DClass *klass); static void box3d_init(SPBox3D *box3d); -static void box3d_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void box3d_build(SPObject *object, Inkscape::XML::Document *document, Inkscape::XML::Node *repr); static void box3d_release(SPObject *object); static void box3d_set(SPObject *object, unsigned int key, const gchar *value); static void box3d_update(SPObject *object, SPCtx *ctx, guint flags); -static Inkscape::XML::Node *box3d_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *box3d_write(SPObject *object, Inkscape::XML::DocumentTree *doc, Inkscape::XML::Node *repr, guint flags); static gchar *box3d_description(SPItem *item); static Geom::Matrix box3d_set_transform(SPItem *item, Geom::Matrix const &xform); @@ -110,7 +110,7 @@ box3d_init(SPBox3D *box) } static void -box3d_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +box3d_build(SPObject *object, Inkscape::XML::Document *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) (parent_class))->build) { ((SPObjectClass *) (parent_class))->build(object, document, repr); @@ -126,7 +126,7 @@ box3d_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) // TODO: Create/link to the correct perspective - Document *doc = SP_OBJECT_DOCUMENT(box); + Inkscape::XML::Document *doc = SP_OBJECT_DOCUMENT(box); if (!doc) { g_print ("No document for the box!!!!\n"); return; @@ -256,7 +256,7 @@ box3d_update(SPObject *object, SPCtx *ctx, guint flags) } -static Inkscape::XML::Node *box3d_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) +static Inkscape::XML::Node *box3d_write(SPObject *object, Inkscape::XML::DocumentTree *xml_doc, Inkscape::XML::Node *repr, guint flags) { SPBox3D *box = SP_BOX3D(object); @@ -272,13 +272,13 @@ static Inkscape::XML::Node *box3d_write(SPObject *object, Inkscape::XML::Documen repr->setAttribute("inkscape:perspectiveID", box->persp_href); } else { /* box is not yet linked to a perspective; use the document's current perspective */ - Document *doc = SP_OBJECT_DOCUMENT(object); + Inkscape::XML::Document *doc = SP_OBJECT_DOCUMENT(object); if (box->persp_ref->getURI()) { gchar *uri_string = box->persp_ref->getURI()->toString(); repr->setAttribute("inkscape:perspectiveID", uri_string); g_free(uri_string); } else { - Inkscape::XML::Node *persp_repr = SP_OBJECT_REPR(doc->current_persp3d); + Inkscape::XML::Node *persp_repr = SP_OBJECT_REPR(doc->current_persp3d);//NOTE1 const gchar *persp_id = persp_repr->attribute("id"); gchar *href = g_strdup_printf("#%s", persp_id); repr->setAttribute("inkscape:perspectiveID", href); @@ -1378,7 +1378,7 @@ box3d_switch_perspectives(SPBox3D *box, Persp3D *old_persp, Persp3D *new_persp, the original box and deletes the latter */ SPGroup * box3d_convert_to_group(SPBox3D *box) { - Document *doc = SP_OBJECT_DOCUMENT(box); + Inkscape::XML::Document *doc = SP_OBJECT_DOCUMENT(box); Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc); // remember position of the box diff --git a/src/forward.h b/src/forward.h index 852934e96..4ac08c126 100644 --- a/src/forward.h +++ b/src/forward.h @@ -20,6 +20,10 @@ namespace Inkscape { struct Application; struct ApplicationClass; +namespace XML { +class Document; +class DocumentTree; +} } /* Editing window */ @@ -43,7 +47,6 @@ GType sp_event_context_get_type (); /* Document tree */ -class Document; class SPDocumentClass; #define SP_TYPE_DOCUMENT (sp_document_get_type ()) diff --git a/src/sp-object.h b/src/sp-object.h index 2932da728..9a4f8fd4d 100644 --- a/src/sp-object.h +++ b/src/sp-object.h @@ -149,7 +149,7 @@ struct SPObject : public GObject { SPIXmlSpace xml_space; unsigned int hrefcount; /* number of xlink:href references */ unsigned int _total_hrefcount; /* our hrefcount + total descendants */ - Document *document; /* Document we are part of */ + Inkscape::XML::Document *document; /* Document we are part of */ SPObject *parent; /* Our parent (only one allowed) */ SPObject *children; /* Our children */ SPObject *_last_child; /* Remembered last child */ @@ -501,7 +501,7 @@ private: struct SPObjectClass { GObjectClass parent_class; - void (* build) (SPObject *object, Document *doc, Inkscape::XML::Node *repr); + void (* build) (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr); void (* release) (SPObject *object); /* Virtual handlers of repr signals */ @@ -519,7 +519,7 @@ struct SPObjectClass { /* Modification handler */ void (* modified) (SPObject *object, unsigned int flags); - Inkscape::XML::Node * (* write) (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, unsigned int flags); + Inkscape::XML::Node * (* write) (SPObject *object, Inkscape::XML::DocumentTree *doc, Inkscape::XML::Node *repr, unsigned int flags); }; @@ -536,7 +536,7 @@ inline SPObject *sp_object_first_child(SPObject *parent) { } SPObject *sp_object_get_child_by_repr(SPObject *object, Inkscape::XML::Node *repr); -void sp_object_invoke_build(SPObject *object, Document *document, Inkscape::XML::Node *repr, unsigned int cloned); +void sp_object_invoke_build(SPObject *object, Inkscape::XML::Document *document, Inkscape::XML::Node *repr, unsigned int cloned); void sp_object_set(SPObject *object, unsigned int key, gchar const *value); diff --git a/src/verbs.h b/src/verbs.h index 51bf0e34b..de9eae68a 100644 --- a/src/verbs.h +++ b/src/verbs.h @@ -437,8 +437,8 @@ public: static void delete_all_view (Inkscape::UI::View::View * view); void delete_view (Inkscape::UI::View::View * view); - void sensitive (Document * in_doc = NULL, bool in_sensitive = true); - void name (Document * in_doc = NULL, Glib::ustring in_name = ""); + void sensitive (Inkscape::XML::DocumentTree * in_doc = NULL, bool in_sensitive = true); + void name (Inkscape::XML::DocumentTree * in_doc = NULL, Glib::ustring in_name = ""); // Yes, multiple public, protected and private sections are bad. We'll clean that up later protected: diff --git a/src/xml/node.h b/src/xml/node.h index abcccdb9a..38f006d5c 100644 --- a/src/xml/node.h +++ b/src/xml/node.h @@ -80,6 +80,8 @@ public: * @{ */ + + /** * @brief Get the type of the node * @return NodeType enumeration member corresponding to the type of the node. diff --git a/src/xml/xml-forward.h b/src/xml/xml-forward.h index 33218c8ae..e3ebad183 100644 --- a/src/xml/xml-forward.h +++ b/src/xml/xml-forward.h @@ -20,7 +20,7 @@ namespace XML { struct AttributeRecord; struct CommentNode; class CompositeNodeObserver; -struct Document; +class Document; class ElementNode; class Event; class EventAdd; -- cgit v1.2.3 From 51c2905fd3e99955db2d823b79abb763d8097028 Mon Sep 17 00:00:00 2001 From: Maximilian Albert Date: Thu, 6 Aug 2009 14:17:17 +0000 Subject: Revert recent refactoring changes by johnce because they break the build, which cannot be fixed easily. (bzr r8422) --- src/Makefile_insert | 3 - src/application/editor.cpp | 16 +- src/application/editor.h | 14 +- src/arc-context.cpp | 3 +- src/bind/javabind.cpp | 6 +- src/box3d-context.cpp | 4 +- src/box3d-side.cpp | 6 +- src/box3d.cpp | 16 +- src/color-profile-fns.h | 4 +- src/color-profile-test.h | 2 +- src/color-profile.cpp | 10 +- src/color-profile.h | 2 +- src/composite-undo-stack-observer.cpp | 2 +- src/composite-undo-stack-observer.h | 4 +- src/conditions.cpp | 2 +- src/conn-avoid-ref.cpp | 2 +- src/connector-context.cpp | 10 +- src/desktop-events.cpp | 2 +- src/desktop-handles.cpp | 2 +- src/desktop-handles.h | 2 +- src/desktop.cpp | 6 +- src/desktop.h | 8 +- src/dialogs/clonetiler.cpp | 4 +- src/dialogs/export.cpp | 16 +- src/dialogs/xml-tree.cpp | 14 +- src/display/canvas-axonomgrid.cpp | 2 +- src/display/canvas-axonomgrid.h | 2 +- src/display/canvas-grid.cpp | 8 +- src/display/canvas-grid.h | 12 +- src/display/nr-filter-image.cpp | 2 +- src/display/nr-filter-image.h | 4 +- src/document-private.h | 18 +-- src/document-subset.h | 2 +- src/document-undo.cpp | 30 ++-- src/document.cpp | 154 +++++++++---------- src/document.h | 103 ++++++------- src/doxygen-main.cpp | 2 +- src/draw-context.cpp | 4 +- src/event-log.cpp | 2 +- src/event-log.h | 4 +- src/extension/effect.cpp | 2 +- src/extension/effect.h | 2 +- src/extension/execution-env.cpp | 2 +- src/extension/extension.cpp | 24 +-- src/extension/extension.h | 26 ++-- src/extension/implementation/implementation.cpp | 8 +- src/extension/implementation/implementation.h | 6 +- src/extension/implementation/script.cpp | 8 +- src/extension/implementation/script.h | 4 +- src/extension/implementation/xslt.cpp | 6 +- src/extension/implementation/xslt.h | 4 +- src/extension/input.cpp | 4 +- src/extension/input.h | 2 +- src/extension/internal/bitmap/imagemagick.cpp | 2 +- src/extension/internal/cairo-png-out.cpp | 4 +- src/extension/internal/cairo-png-out.h | 2 +- src/extension/internal/cairo-ps-out.cpp | 6 +- src/extension/internal/cairo-ps-out.h | 4 +- src/extension/internal/cairo-render-context.cpp | 2 +- src/extension/internal/cairo-renderer-pdf-out.cpp | 4 +- src/extension/internal/cairo-renderer-pdf-out.h | 2 +- src/extension/internal/cairo-renderer.cpp | 4 +- src/extension/internal/cairo-renderer.h | 4 +- src/extension/internal/emf-win32-inout.cpp | 8 +- src/extension/internal/emf-win32-inout.h | 4 +- src/extension/internal/emf-win32-print.cpp | 2 +- src/extension/internal/emf-win32-print.h | 2 +- src/extension/internal/gdkpixbuf-input.cpp | 4 +- src/extension/internal/gdkpixbuf-input.h | 2 +- src/extension/internal/gimpgrad.cpp | 4 +- src/extension/internal/gimpgrad.h | 2 +- src/extension/internal/grid.cpp | 4 +- src/extension/internal/javafx-out.cpp | 10 +- src/extension/internal/javafx-out.h | 10 +- src/extension/internal/latex-pstricks-out.cpp | 2 +- src/extension/internal/latex-pstricks-out.h | 2 +- src/extension/internal/latex-pstricks.cpp | 2 +- src/extension/internal/latex-pstricks.h | 2 +- src/extension/internal/odf.cpp | 2 +- src/extension/internal/odf.h | 2 +- src/extension/internal/pdf-input-cairo.cpp | 4 +- src/extension/internal/pdf-input-cairo.h | 2 +- src/extension/internal/pdfinput/pdf-input.cpp | 4 +- src/extension/internal/pdfinput/pdf-input.h | 2 +- src/extension/internal/pdfinput/svg-builder.cpp | 2 +- src/extension/internal/pdfinput/svg-builder.h | 6 +- src/extension/internal/pov-out.cpp | 8 +- src/extension/internal/pov-out.h | 8 +- src/extension/internal/svg.cpp | 8 +- src/extension/internal/svg.h | 4 +- src/extension/internal/win32.cpp | 2 +- src/extension/internal/win32.h | 2 +- src/extension/internal/wpg-input.cpp | 4 +- src/extension/internal/wpg-input.h | 2 +- src/extension/output.cpp | 2 +- src/extension/output.h | 4 +- src/extension/param/bool.cpp | 10 +- src/extension/param/bool.h | 6 +- src/extension/param/color.cpp | 4 +- src/extension/param/color.h | 6 +- src/extension/param/description.cpp | 2 +- src/extension/param/description.h | 2 +- src/extension/param/enum.cpp | 8 +- src/extension/param/enum.h | 6 +- src/extension/param/float.cpp | 8 +- src/extension/param/float.h | 6 +- src/extension/param/int.cpp | 8 +- src/extension/param/int.h | 6 +- src/extension/param/notebook.cpp | 12 +- src/extension/param/notebook.h | 6 +- src/extension/param/parameter.cpp | 26 ++-- src/extension/param/parameter.h | 26 ++-- src/extension/param/radiobutton.cpp | 14 +- src/extension/param/radiobutton.h | 6 +- src/extension/param/string.cpp | 8 +- src/extension/param/string.h | 6 +- src/extension/patheffect.cpp | 4 +- src/extension/patheffect.h | 4 +- src/extension/print.cpp | 2 +- src/extension/print.h | 2 +- src/extension/system.cpp | 6 +- src/extension/system.h | 4 +- src/file.cpp | 179 +++------------------- src/file.h | 37 +---- src/filter-chemistry.cpp | 10 +- src/filter-chemistry.h | 8 +- src/filters/blend.cpp | 4 +- src/filters/colormatrix.cpp | 4 +- src/filters/componenttransfer-funcnode.cpp | 4 +- src/filters/componenttransfer.cpp | 4 +- src/filters/composite.cpp | 4 +- src/filters/convolvematrix.cpp | 4 +- src/filters/diffuselighting.cpp | 4 +- src/filters/displacementmap.cpp | 4 +- src/filters/distantlight.cpp | 4 +- src/filters/flood.cpp | 4 +- src/filters/image.cpp | 4 +- src/filters/image.h | 2 +- src/filters/merge.cpp | 4 +- src/filters/mergenode.cpp | 4 +- src/filters/morphology.cpp | 4 +- src/filters/offset.cpp | 4 +- src/filters/pointlight.cpp | 4 +- src/filters/specularlighting.cpp | 4 +- src/filters/spotlight.cpp | 4 +- src/filters/tile.cpp | 4 +- src/filters/turbulence.cpp | 4 +- src/flood-context.cpp | 4 +- src/forward.h | 7 +- src/gradient-chemistry.cpp | 10 +- src/gradient-chemistry.h | 4 +- src/gradient-context.cpp | 6 +- src/gradient-drag.cpp | 2 +- src/helper/action.cpp | 2 +- src/helper/pixbuf-ops.cpp | 4 +- src/helper/pixbuf-ops.h | 6 +- src/helper/png-write.cpp | 6 +- src/helper/png-write.h | 6 +- src/helper/stock-items.cpp | 22 +-- src/id-clash.cpp | 4 +- src/id-clash.h | 2 +- src/inkscape-private.h | 4 +- src/inkscape.cpp | 28 ++-- src/inkscape.h | 4 +- src/inkview.cpp | 16 +- src/interface.cpp | 10 +- src/jabber_whiteboard/node-tracker.h | 2 +- src/jabber_whiteboard/session-manager.cpp | 10 +- src/jabber_whiteboard/session-manager.h | 6 +- src/layer-fns.cpp | 2 +- src/layer-manager.cpp | 8 +- src/layer-manager.h | 6 +- src/livarot/LivarotDefs.h | 4 +- src/live_effects/effect.cpp | 6 +- src/live_effects/effect.h | 8 +- src/live_effects/lpeobject.cpp | 4 +- src/live_effects/lpeobject.h | 2 +- src/lpe-tool-context.cpp | 4 +- src/lpe-tool-context.h | 2 +- src/main-cmdlineact.cpp | 2 +- src/main.cpp | 22 +-- src/marker.cpp | 6 +- src/marker.h | 2 +- src/nodepath.cpp | 4 +- src/path-chemistry.cpp | 4 +- src/persp3d.cpp | 10 +- src/persp3d.h | 8 +- src/print.cpp | 6 +- src/print.h | 6 +- src/profile-manager.cpp | 2 +- src/profile-manager.h | 6 +- src/rdf.cpp | 18 +-- src/rdf.h | 10 +- src/selection-chemistry.cpp | 40 ++--- src/selection-chemistry.h | 8 +- src/snap.cpp | 2 +- src/snap.h | 2 +- src/sp-anchor.cpp | 4 +- src/sp-animation.cpp | 12 +- src/sp-clippath.cpp | 6 +- src/sp-clippath.h | 2 +- src/sp-ellipse.cpp | 12 +- src/sp-filter-primitive.cpp | 4 +- src/sp-filter-reference.h | 2 +- src/sp-filter.cpp | 4 +- src/sp-flowdiv.cpp | 12 +- src/sp-flowtext.cpp | 6 +- src/sp-font-face.cpp | 4 +- src/sp-font.cpp | 4 +- src/sp-gaussian-blur.cpp | 4 +- src/sp-glyph-kerning.cpp | 4 +- src/sp-glyph.cpp | 4 +- src/sp-gradient-test.h | 2 +- src/sp-gradient.cpp | 16 +- src/sp-guide.cpp | 8 +- src/sp-image.cpp | 6 +- src/sp-item-group.cpp | 6 +- src/sp-item.cpp | 4 +- src/sp-line.cpp | 4 +- src/sp-lpe-item.cpp | 4 +- src/sp-mask.cpp | 6 +- src/sp-mask.h | 2 +- src/sp-metadata.cpp | 6 +- src/sp-metadata.h | 2 +- src/sp-missing-glyph.cpp | 4 +- src/sp-namedview.cpp | 14 +- src/sp-namedview.h | 4 +- src/sp-object-repr.cpp | 2 +- src/sp-object-repr.h | 2 +- src/sp-object.cpp | 12 +- src/sp-object.h | 10 +- src/sp-offset.cpp | 6 +- src/sp-paint-server.h | 2 +- src/sp-path.cpp | 4 +- src/sp-pattern.cpp | 8 +- src/sp-pattern.h | 2 +- src/sp-polygon.cpp | 4 +- src/sp-polyline.cpp | 4 +- src/sp-rect.cpp | 4 +- src/sp-root.cpp | 4 +- src/sp-script.cpp | 4 +- src/sp-shape.cpp | 4 +- src/sp-skeleton.cpp | 4 +- src/sp-spiral.cpp | 4 +- src/sp-star.cpp | 4 +- src/sp-string.cpp | 4 +- src/sp-style-elem-test.h | 2 +- src/sp-style-elem.cpp | 4 +- src/sp-symbol.cpp | 4 +- src/sp-text.cpp | 4 +- src/sp-tref.cpp | 6 +- src/sp-tspan.cpp | 8 +- src/sp-use.cpp | 6 +- src/splivarot.cpp | 4 +- src/style-test.h | 2 +- src/style.cpp | 26 ++-- src/style.h | 4 +- src/svg-view-widget.cpp | 2 +- src/svg-view-widget.h | 4 +- src/svg-view.cpp | 2 +- src/svg-view.h | 2 +- src/test-helpers.h | 2 +- src/text-chemistry.cpp | 4 +- src/trace/trace.cpp | 2 +- src/tweak-context.cpp | 4 +- src/ui/clipboard.cpp | 38 ++--- src/ui/clipboard.h | 2 +- src/ui/dialog/aboutbox.cpp | 2 +- src/ui/dialog/document-metadata.cpp | 2 +- src/ui/dialog/document-metadata.h | 2 +- src/ui/dialog/document-properties.cpp | 4 +- src/ui/dialog/document-properties.h | 2 +- src/ui/dialog/filedialogimpl-gtkmm.cpp | 6 +- src/ui/dialog/filedialogimpl-gtkmm.h | 4 +- src/ui/dialog/filedialogimpl-win32.cpp | 2 +- src/ui/dialog/filter-effects-dialog.cpp | 8 +- src/ui/dialog/filter-effects-dialog.h | 2 +- src/ui/dialog/guides.cpp | 2 +- src/ui/dialog/icon-preview.cpp | 4 +- src/ui/dialog/layers.cpp | 4 +- src/ui/dialog/layers.h | 2 +- src/ui/dialog/livepatheffect-editor.cpp | 2 +- src/ui/dialog/panel-dialog.h | 4 +- src/ui/dialog/print.cpp | 2 +- src/ui/dialog/print.h | 6 +- src/ui/dialog/svg-fonts-dialog.cpp | 30 ++-- src/ui/dialog/swatches.cpp | 16 +- src/ui/dialog/swatches.h | 4 +- src/ui/dialog/undo-history.h | 2 +- src/ui/view/edit-widget.cpp | 8 +- src/ui/view/edit-widget.h | 6 +- src/ui/view/view.cpp | 2 +- src/ui/view/view.h | 8 +- src/ui/widget/entity-entry.cpp | 8 +- src/ui/widget/entity-entry.h | 8 +- src/ui/widget/imageicon.cpp | 8 +- src/ui/widget/imageicon.h | 6 +- src/ui/widget/layer-selector.h | 2 +- src/ui/widget/licensor.cpp | 2 +- src/ui/widget/licensor.h | 4 +- src/ui/widget/object-composite-settings.cpp | 2 +- src/ui/widget/page-sizer.cpp | 2 +- src/ui/widget/panel.cpp | 2 +- src/ui/widget/panel.h | 4 +- src/ui/widget/registered-enums.h | 2 +- src/ui/widget/registered-widget.cpp | 24 +-- src/ui/widget/registered-widget.h | 30 ++-- src/ui/widget/tolerance-slider.cpp | 2 +- src/uri-references.cpp | 8 +- src/uri-references.h | 10 +- src/vanishing-point.cpp | 2 +- src/vanishing-point.h | 4 +- src/verbs.cpp | 16 +- src/verbs.h | 4 +- src/widgets/desktop-widget.cpp | 4 +- src/widgets/fill-style.cpp | 2 +- src/widgets/gradient-selector.cpp | 4 +- src/widgets/gradient-selector.h | 2 +- src/widgets/gradient-toolbar.cpp | 4 +- src/widgets/gradient-vector.cpp | 8 +- src/widgets/gradient-vector.h | 8 +- src/widgets/icon.cpp | 6 +- src/widgets/paint-selector.cpp | 12 +- src/widgets/select-toolbar.cpp | 2 +- src/widgets/stroke-style.cpp | 34 ++-- src/widgets/toolbox.cpp | 8 +- src/xml/document.h | 6 +- src/xml/node.h | 2 - src/xml/rebase-hrefs.cpp | 8 +- src/xml/rebase-hrefs.h | 5 +- src/xml/repr-css.cpp | 10 +- src/xml/repr.h | 2 +- src/xml/xml-forward.h | 2 +- 333 files changed, 1139 insertions(+), 1320 deletions(-) (limited to 'src') diff --git a/src/Makefile_insert b/src/Makefile_insert index 5967c7cfc..de986ca16 100644 --- a/src/Makefile_insert +++ b/src/Makefile_insert @@ -225,9 +225,6 @@ ink_common_sources += \ star-context.cpp star-context.h \ streq.h \ strneq.h \ - streams-handles.h streams-handles.cpp \ - streams-ftp.h streams-ftp.cpp \ - streams-http.h streams-http.cpp \ style.cpp style.h \ svg-profile.h \ svg-view.cpp svg-view.h \ diff --git a/src/application/editor.cpp b/src/application/editor.cpp index 730188bdd..49010efdc 100644 --- a/src/application/editor.cpp +++ b/src/application/editor.cpp @@ -18,7 +18,7 @@ #endif /* - TODO: Replace Document with the new Inkscape::Document + TODO: Replace SPDocument with the new Inkscape::Document TODO: Change 'desktop's to 'view*'s TODO: Add derivation from Inkscape::Application::RunMode */ @@ -76,7 +76,7 @@ Editor::init() // gchar const *tmpl = g_build_filename ((INKSCAPE_TEMPLATESDIR), "default.svg", NULL); bool have_default = Inkscape::IO::file_test (tmpl, G_FILE_TEST_IS_REGULAR); - Document *doc = sp_document_new (have_default? tmpl:0, true, true); + SPDocument *doc = sp_document_new (have_default? tmpl:0, true, true); g_return_val_if_fail (doc != 0, false); Inkscape::UI::View::EditWidget *ew = new Inkscape::UI::View::EditWidget (doc); sp_document_unref (doc); @@ -96,7 +96,7 @@ Editor::getWindow() } /// Returns the active document -Document* +SPDocument* Editor::getActiveDocument() { if (getActiveDesktop()) { @@ -107,7 +107,7 @@ Editor::getActiveDocument() } void -Editor::addDocument (Document *doc) +Editor::addDocument (SPDocument *doc) { if ( _instance->_document_set.find(doc) == _instance->_document_set.end() ) { _instance->_documents = g_slist_append (_instance->_documents, doc); @@ -116,7 +116,7 @@ Editor::addDocument (Document *doc) } void -Editor::removeDocument (Document *doc) +Editor::removeDocument (SPDocument *doc) { _instance->_document_set.erase(doc); if ( _instance->_document_set.find(doc) == _instance->_document_set.end() ) { @@ -125,7 +125,7 @@ Editor::removeDocument (Document *doc) } SPDesktop* -Editor::createDesktop (Document* doc) +Editor::createDesktop (SPDocument* doc) { g_assert (doc != 0); (new Inkscape::UI::View::EditWidget (doc))->present(); @@ -227,13 +227,13 @@ Editor::reactivateDesktop (SPDesktop* dt) bool Editor::isDuplicatedView (SPDesktop* dt) { - Document const* document = dt->doc(); + SPDocument const* document = dt->doc(); if (!document) { return false; } for ( GSList *iter = _instance->_desktops ; iter ; iter = iter->next ) { SPDesktop *other_desktop=(SPDesktop *)iter->data; - Document *other_document=other_desktop->doc(); + SPDocument *other_document=other_desktop->doc(); if ( other_document == document && other_desktop != dt ) { return true; } diff --git a/src/application/editor.h b/src/application/editor.h index 0886555e9..4545022b8 100644 --- a/src/application/editor.h +++ b/src/application/editor.h @@ -22,7 +22,7 @@ #include "app-prototype.h" class SPDesktop; -class Document; +class SPDocument; class SPEventContext; namespace Inkscape { @@ -52,7 +52,7 @@ public: void refreshDisplay(); void exit(); - bool lastViewOfDocument(Document* doc, SPDesktop* view) const; + bool lastViewOfDocument(SPDocument* doc, SPDesktop* view) const; bool addView(SPDesktop* view); bool deleteView(SPDesktop* view); @@ -60,16 +60,16 @@ public: static Inkscape::XML::Document *getPreferences(); static SPDesktop* getActiveDesktop(); static bool isDesktopActive (SPDesktop* dt) { return getActiveDesktop()==dt; } - static SPDesktop* createDesktop (Document* doc); + static SPDesktop* createDesktop (SPDocument* doc); static void addDesktop (SPDesktop* dt); static void removeDesktop (SPDesktop* dt); static void activateDesktop (SPDesktop* dt); static void reactivateDesktop (SPDesktop* dt); static bool isDuplicatedView (SPDesktop* dt); - static Document* getActiveDocument(); - static void addDocument (Document* doc); - static void removeDocument (Document* doc); + static SPDocument* getActiveDocument(); + static void addDocument (SPDocument* doc); + static void removeDocument (SPDocument* doc); static void selectionModified (Inkscape::Selection*, guint); static void selectionChanged (Inkscape::Selection*); @@ -96,7 +96,7 @@ protected: Editor(Editor const &); Editor& operator=(Editor const &); - std::multiset _document_set; + std::multiset _document_set; GSList *_documents; GSList *_desktops; gchar *_argv0; diff --git a/src/arc-context.cpp b/src/arc-context.cpp index 835e43a26..e689c93db 100644 --- a/src/arc-context.cpp +++ b/src/arc-context.cpp @@ -25,7 +25,6 @@ #include "display/sp-canvas.h" #include "sp-ellipse.h" #include "document.h" -#include "xml/document.h" #include "sp-namedview.h" #include "selection.h" #include "desktop-handles.h" @@ -404,7 +403,7 @@ static void sp_arc_drag(SPArcContext *ac, Geom::Point pt, guint state) } /* Create object */ - Inkscape::XML::DocumentTree *xml_doc = sp_document_repr_doc(desktop->doc()); + Inkscape::XML::Document *xml_doc = sp_document_repr_doc(desktop->doc()); Inkscape::XML::Node *repr = xml_doc->createElement("svg:path"); repr->setAttribute("sodipodi:type", "arc"); diff --git a/src/bind/javabind.cpp b/src/bind/javabind.cpp index 026486948..f7022584f 100644 --- a/src/bind/javabind.cpp +++ b/src/bind/javabind.cpp @@ -44,9 +44,9 @@ #include #endif -//--tullarisc #if HAVE_SYS_STAT_H +#if HAVE_SYS_STAT_H #include -//#endif +#endif #include "javabind.h" #include "javabind-private.h" @@ -742,7 +742,7 @@ jboolean JNICALL documentSet(JNIEnv */*env*/, jobject /*obj*/, jlong /*ptr*/, js /* JavaBinderyImpl *bind = (JavaBinderyImpl *)ptr; String s = getString(env, jstr); - Document *doc = sp_document_new_from_mem(s.c_str(), s.size(), true); + SPDocument *doc = sp_document_new_from_mem(s.c_str(), s.size(), true); */ return JNI_TRUE; } diff --git a/src/box3d-context.cpp b/src/box3d-context.cpp index 4146ec30d..128b5f2ff 100644 --- a/src/box3d-context.cpp +++ b/src/box3d-context.cpp @@ -185,7 +185,7 @@ static void sp_box3d_context_selection_changed(Inkscape::Selection *selection, g /* create a default perspective in document defs if none is present (can happen after 'vacuum defs' or when a pre-0.46 file is opened) */ -static void sp_box3d_context_check_for_persp_in_defs(Document *document) { +static void sp_box3d_context_check_for_persp_in_defs(SPDocument *document) { SPDefs *defs = (SPDefs *) SP_DOCUMENT_DEFS(document); bool has_persp = false; @@ -561,7 +561,7 @@ static void sp_box3d_drag(Box3DContext &bc, guint /*state*/) } /* Create object */ - Inkscape::XML::DocumentTree *xml_doc = sp_document_repr_doc(SP_EVENT_CONTEXT_DOCUMENT(&bc)); + Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_EVENT_CONTEXT_DOCUMENT(&bc)); Inkscape::XML::Node *repr = xml_doc->createElement("svg:g"); repr->setAttribute("sodipodi:type", "inkscape:box3d"); diff --git a/src/box3d-side.cpp b/src/box3d-side.cpp index f09a2f9f6..241279100 100644 --- a/src/box3d-side.cpp +++ b/src/box3d-side.cpp @@ -28,7 +28,7 @@ static void box3d_side_class_init (Box3DSideClass *klass); static void box3d_side_init (Box3DSide *side); -static void box3d_side_build (SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void box3d_side_build (SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static Inkscape::XML::Node *box3d_side_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void box3d_side_set (SPObject *object, unsigned int key, const gchar *value); static void box3d_side_update (SPObject *object, SPCtx *ctx, guint flags); @@ -94,7 +94,7 @@ box3d_side_init (Box3DSide * side) } static void -box3d_side_build (SPObject * object, Document * document, Inkscape::XML::Node * repr) +box3d_side_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr) { if (((SPObjectClass *) parent_class)->build) ((SPObjectClass *) parent_class)->build (object, document, repr); @@ -307,7 +307,7 @@ box3d_side_perspective(Box3DSide *side) { Inkscape::XML::Node * box3d_side_convert_to_path(Box3DSide *side) { // TODO: Copy over all important attributes (see sp_selected_item_to_curved_repr() for an example) - Document *doc = SP_OBJECT_DOCUMENT(side); + SPDocument *doc = SP_OBJECT_DOCUMENT(side); Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc); Inkscape::XML::Node *repr = xml_doc->createElement("svg:path"); diff --git a/src/box3d.cpp b/src/box3d.cpp index 0caf7b1ef..5cffa66d9 100644 --- a/src/box3d.cpp +++ b/src/box3d.cpp @@ -43,11 +43,11 @@ static void box3d_class_init(SPBox3DClass *klass); static void box3d_init(SPBox3D *box3d); -static void box3d_build(SPObject *object, Inkscape::XML::Document *document, Inkscape::XML::Node *repr); +static void box3d_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void box3d_release(SPObject *object); static void box3d_set(SPObject *object, unsigned int key, const gchar *value); static void box3d_update(SPObject *object, SPCtx *ctx, guint flags); -static Inkscape::XML::Node *box3d_write(SPObject *object, Inkscape::XML::DocumentTree *doc, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *box3d_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static gchar *box3d_description(SPItem *item); static Geom::Matrix box3d_set_transform(SPItem *item, Geom::Matrix const &xform); @@ -110,7 +110,7 @@ box3d_init(SPBox3D *box) } static void -box3d_build(SPObject *object, Inkscape::XML::Document *document, Inkscape::XML::Node *repr) +box3d_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) (parent_class))->build) { ((SPObjectClass *) (parent_class))->build(object, document, repr); @@ -126,7 +126,7 @@ box3d_build(SPObject *object, Inkscape::XML::Document *document, Inkscape::XML:: // TODO: Create/link to the correct perspective - Inkscape::XML::Document *doc = SP_OBJECT_DOCUMENT(box); + SPDocument *doc = SP_OBJECT_DOCUMENT(box); if (!doc) { g_print ("No document for the box!!!!\n"); return; @@ -256,7 +256,7 @@ box3d_update(SPObject *object, SPCtx *ctx, guint flags) } -static Inkscape::XML::Node *box3d_write(SPObject *object, Inkscape::XML::DocumentTree *xml_doc, Inkscape::XML::Node *repr, guint flags) +static Inkscape::XML::Node *box3d_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { SPBox3D *box = SP_BOX3D(object); @@ -272,13 +272,13 @@ static Inkscape::XML::Node *box3d_write(SPObject *object, Inkscape::XML::Documen repr->setAttribute("inkscape:perspectiveID", box->persp_href); } else { /* box is not yet linked to a perspective; use the document's current perspective */ - Inkscape::XML::Document *doc = SP_OBJECT_DOCUMENT(object); + SPDocument *doc = SP_OBJECT_DOCUMENT(object); if (box->persp_ref->getURI()) { gchar *uri_string = box->persp_ref->getURI()->toString(); repr->setAttribute("inkscape:perspectiveID", uri_string); g_free(uri_string); } else { - Inkscape::XML::Node *persp_repr = SP_OBJECT_REPR(doc->current_persp3d);//NOTE1 + Inkscape::XML::Node *persp_repr = SP_OBJECT_REPR(doc->current_persp3d); const gchar *persp_id = persp_repr->attribute("id"); gchar *href = g_strdup_printf("#%s", persp_id); repr->setAttribute("inkscape:perspectiveID", href); @@ -1378,7 +1378,7 @@ box3d_switch_perspectives(SPBox3D *box, Persp3D *old_persp, Persp3D *new_persp, the original box and deletes the latter */ SPGroup * box3d_convert_to_group(SPBox3D *box) { - Inkscape::XML::Document *doc = SP_OBJECT_DOCUMENT(box); + SPDocument *doc = SP_OBJECT_DOCUMENT(box); Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc); // remember position of the box diff --git a/src/color-profile-fns.h b/src/color-profile-fns.h index 62e4c865f..c8c51b551 100644 --- a/src/color-profile-fns.h +++ b/src/color-profile-fns.h @@ -13,7 +13,7 @@ #include #endif // ENABLE_LCMS -class Document; +class SPDocument; namespace Inkscape { @@ -27,7 +27,7 @@ GType colorprofile_get_type(); #if ENABLE_LCMS -cmsHPROFILE colorprofile_get_handle( Document* document, guint* intent, gchar const* name ); +cmsHPROFILE colorprofile_get_handle( SPDocument* document, guint* intent, gchar const* name ); cmsHTRANSFORM colorprofile_get_display_transform(); Glib::ustring colorprofile_get_display_id( int screen, int monitor ); diff --git a/src/color-profile-test.h b/src/color-profile-test.h index d7b361c50..cdbf76b44 100644 --- a/src/color-profile-test.h +++ b/src/color-profile-test.h @@ -14,7 +14,7 @@ class ColorProfileTest : public CxxTest::TestSuite { public: - Document* _doc; + SPDocument* _doc; ColorProfileTest() : _doc(0) diff --git a/src/color-profile.cpp b/src/color-profile.cpp index b2487a6a9..5868a9582 100644 --- a/src/color-profile.cpp +++ b/src/color-profile.cpp @@ -151,7 +151,7 @@ void ColorProfile::init( ColorProfile *cprof ) void ColorProfile::release( SPObject *object ) { // Unregister ourselves - Document* document = SP_OBJECT_DOCUMENT(object); + SPDocument* document = SP_OBJECT_DOCUMENT(object); if ( document ) { sp_document_remove_resource (SP_OBJECT_DOCUMENT (object), "iccprofile", SP_OBJECT (object)); } @@ -205,7 +205,7 @@ void ColorProfile::_clearProfile() /** * Callback: set attributes from associated repr. */ -void ColorProfile::build( SPObject *object, Document *document, Inkscape::XML::Node *repr ) +void ColorProfile::build( SPObject *object, SPDocument *document, Inkscape::XML::Node *repr ) { ColorProfile *cprof = COLORPROFILE(object); g_assert(cprof->href == 0); @@ -251,7 +251,7 @@ void ColorProfile::set( SPObject *object, unsigned key, gchar const *value ) //LCMSAPI cmsHPROFILE LCMSEXPORT cmsOpenProfileFromMem(LPVOID MemPtr, DWORD dwSize); // Try to open relative - Document *doc = SP_OBJECT_DOCUMENT(object); + SPDocument *doc = SP_OBJECT_DOCUMENT(object); if (!doc) { doc = SP_ACTIVE_DOCUMENT; g_warning("object has no document. using active"); @@ -436,7 +436,7 @@ static int getLcmsIntent( guint svgIntent ) return intent; } -static SPObject* bruteFind( Document* document, gchar const* name ) +static SPObject* bruteFind( SPDocument* document, gchar const* name ) { SPObject* result = 0; const GSList * current = sp_document_get_resource_list(document, "iccprofile"); @@ -456,7 +456,7 @@ static SPObject* bruteFind( Document* document, gchar const* name ) return result; } -cmsHPROFILE Inkscape::colorprofile_get_handle( Document* document, guint* intent, gchar const* name ) +cmsHPROFILE Inkscape::colorprofile_get_handle( SPDocument* document, guint* intent, gchar const* name ) { cmsHPROFILE prof = 0; diff --git a/src/color-profile.h b/src/color-profile.h index 2d8ac5b6d..2e57e7ef0 100644 --- a/src/color-profile.h +++ b/src/color-profile.h @@ -56,7 +56,7 @@ private: static void init( ColorProfile *cprof ); static void release( SPObject *object ); - static void build( SPObject *object, Document *document, Inkscape::XML::Node *repr ); + static void build( SPObject *object, SPDocument *document, Inkscape::XML::Node *repr ); static void set( SPObject *object, unsigned key, gchar const *value ); static Inkscape::XML::Node *write( SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags ); #if ENABLE_LCMS diff --git a/src/composite-undo-stack-observer.cpp b/src/composite-undo-stack-observer.cpp index 89ffdc65e..03e4796bd 100644 --- a/src/composite-undo-stack-observer.cpp +++ b/src/composite-undo-stack-observer.cpp @@ -1,5 +1,5 @@ /** - * Aggregates undo stack observers for convenient management and triggering in Document + * Aggregates undo stack observers for convenient management and triggering in SPDocument * * Heavily inspired by Inkscape::XML::CompositeNodeObserver. * diff --git a/src/composite-undo-stack-observer.h b/src/composite-undo-stack-observer.h index 01c64f4fd..cd00d4211 100644 --- a/src/composite-undo-stack-observer.h +++ b/src/composite-undo-stack-observer.h @@ -1,5 +1,5 @@ /** - * Aggregates undo stack observers for management and triggering in Document + * Aggregates undo stack observers for management and triggering in SPDocument * * Heavily inspired by Inkscape::XML::CompositeNodeObserver. * @@ -25,7 +25,7 @@ namespace Inkscape { class Event; /** - * Aggregates UndoStackObservers for management and triggering in an Document's undo/redo + * Aggregates UndoStackObservers for management and triggering in an SPDocument's undo/redo * system. */ class CompositeUndoStackObserver : public UndoStackObserver { diff --git a/src/conditions.cpp b/src/conditions.cpp index c431600f3..4a18a6913 100644 --- a/src/conditions.cpp +++ b/src/conditions.cpp @@ -108,7 +108,7 @@ static bool evaluateSystemLanguage(SPItem const *item, gchar const *value) { if (language_codes.empty()) return false; - Document *document = SP_OBJECT_DOCUMENT(item); + SPDocument *document = SP_OBJECT_DOCUMENT(item); Glib::ustring document_language = document->getLanguage(); if (document_language.size() == 0) diff --git a/src/conn-avoid-ref.cpp b/src/conn-avoid-ref.cpp index 0bc961e5d..43c9c0b66 100644 --- a/src/conn-avoid-ref.cpp +++ b/src/conn-avoid-ref.cpp @@ -254,7 +254,7 @@ void init_avoided_shape_geometry(SPDesktop *desktop) { // Don't count this as changes to the document, // it is basically just late initialisation. - Document *document = sp_desktop_document(desktop); + SPDocument *document = sp_desktop_document(desktop); bool saved = sp_document_get_undo_sensitive(document); sp_document_set_undo_sensitive(document, false); diff --git a/src/connector-context.cpp b/src/connector-context.cpp index 17e5f6f32..2131bdced 100644 --- a/src/connector-context.cpp +++ b/src/connector-context.cpp @@ -686,7 +686,7 @@ connector_handle_button_release(SPConnectorContext *const cc, GdkEventButton con if ( revent.button == 1 && !event_context->space_panning ) { SPDesktop *desktop = SP_EVENT_CONTEXT_DESKTOP(cc); - Document *doc = sp_desktop_document(desktop); + SPDocument *doc = sp_desktop_document(desktop); SnapManager &m = desktop->namedview->snap_manager; m.setup(desktop); @@ -763,7 +763,7 @@ connector_handle_key_press(SPConnectorContext *const cc, guint const keyval) if (cc->state == SP_CONNECTOR_CONTEXT_REROUTING) { SPDesktop *desktop = SP_EVENT_CONTEXT_DESKTOP(cc); - Document *doc = sp_desktop_document(desktop); + SPDocument *doc = sp_desktop_document(desktop); cc_connector_rerouting_finish(cc, NULL); @@ -794,7 +794,7 @@ static void cc_connector_rerouting_finish(SPConnectorContext *const cc, Geom::Point *const p) { SPDesktop *desktop = SP_EVENT_CONTEXT_DESKTOP(cc); - Document *doc = sp_desktop_document(desktop); + SPDocument *doc = sp_desktop_document(desktop); // Clear the temporary path: cc->red_curve->reset(); @@ -936,7 +936,7 @@ spcc_flush_white(SPConnectorContext *cc, SPCurve *gc) c->transform(SP_EVENT_CONTEXT_DESKTOP(cc)->dt2doc()); SPDesktop *desktop = SP_EVENT_CONTEXT_DESKTOP(cc); - Document *doc = sp_desktop_document(desktop); + SPDocument *doc = sp_desktop_document(desktop); Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc); if ( c && !c->is_empty() ) { @@ -1311,7 +1311,7 @@ void cc_selection_set_avoid(bool const set_avoid) return; } - Document *document = sp_desktop_document(desktop); + SPDocument *document = sp_desktop_document(desktop); Inkscape::Selection *selection = sp_desktop_selection(desktop); diff --git a/src/desktop-events.cpp b/src/desktop-events.cpp index 41b7ab4da..cea478f85 100644 --- a/src/desktop-events.cpp +++ b/src/desktop-events.cpp @@ -440,7 +440,7 @@ gint sp_dt_guide_event(SPCanvasItem *item, GdkEvent *event, gpointer data) case GDK_KP_Delete: case GDK_BackSpace: { - Document *doc = SP_OBJECT_DOCUMENT(guide); + SPDocument *doc = SP_OBJECT_DOCUMENT(guide); sp_guide_remove(guide); sp_document_done(doc, SP_VERB_NONE, _("Delete guide")); ret = TRUE; diff --git a/src/desktop-handles.cpp b/src/desktop-handles.cpp index b0ca4b84a..481bf35ea 100644 --- a/src/desktop-handles.cpp +++ b/src/desktop-handles.cpp @@ -31,7 +31,7 @@ sp_desktop_selection (SPDesktop const * desktop) return desktop->selection; } -Document * +SPDocument * sp_desktop_document (SPDesktop const * desktop) { g_return_val_if_fail (desktop != NULL, NULL); diff --git a/src/desktop-handles.h b/src/desktop-handles.h index 8c48d0bbd..a8d0a3d1e 100644 --- a/src/desktop-handles.h +++ b/src/desktop-handles.h @@ -30,7 +30,7 @@ namespace Inkscape { SPEventContext * sp_desktop_event_context (SPDesktop const * desktop); Inkscape::Selection * sp_desktop_selection (SPDesktop const * desktop); -Document * sp_desktop_document (SPDesktop const * desktop); +SPDocument * sp_desktop_document (SPDesktop const * desktop); SPCanvas * sp_desktop_canvas (SPDesktop const * desktop); SPCanvasItem * sp_desktop_acetate (SPDesktop const * desktop); SPCanvasGroup * sp_desktop_main (SPDesktop const * desktop); diff --git a/src/desktop.cpp b/src/desktop.cpp index 4f832682d..6b7c20094 100644 --- a/src/desktop.cpp +++ b/src/desktop.cpp @@ -178,7 +178,7 @@ SPDesktop::init (SPNamedView *nv, SPCanvas *aCanvas) namedview = nv; canvas = aCanvas; - Document *document = SP_OBJECT_DOCUMENT (namedview); + SPDocument *document = SP_OBJECT_DOCUMENT (namedview); /* Kill flicker */ sp_document_ensure_up_to_date (document); @@ -577,7 +577,7 @@ SPDesktop::activate_guides(bool activate) * Make desktop switch documents. */ void -SPDesktop::change_document (Document *theDocument) +SPDesktop::change_document (SPDocument *theDocument) { g_return_if_fail (theDocument != NULL); @@ -1492,7 +1492,7 @@ SPDesktop::updateCanvasNow() * Associate document with desktop. */ void -SPDesktop::setDocument (Document *doc) +SPDesktop::setDocument (SPDocument *doc) { if (this->doc() && doc) { namedview->hide(this); diff --git a/src/desktop.h b/src/desktop.h index f9e7f6a17..73b9262dd 100644 --- a/src/desktop.h +++ b/src/desktop.h @@ -143,7 +143,7 @@ struct SPDesktop : public Inkscape::UI::View::View sigc::signal _layer_changed_signal; sigc::signal::accumulated _set_style_signal; sigc::signal::accumulated _query_style_signal; - sigc::connection connectDocumentReplaced (const sigc::slot & slot) + sigc::connection connectDocumentReplaced (const sigc::slot & slot) { return _document_replaced_signal.connect (slot); } @@ -219,7 +219,7 @@ struct SPDesktop : public Inkscape::UI::View::View bool itemIsHidden(SPItem const *item) const; void activate_guides (bool activate); - void change_document (Document *document); + void change_document (SPDocument *document); void set_event_context (GtkType type, const gchar *config); void push_event_context (GtkType type, const gchar *config, unsigned int key); @@ -315,7 +315,7 @@ struct SPDesktop : public Inkscape::UI::View::View Geom::Point doc2dt(Geom::Point const &p) const; Geom::Point dt2doc(Geom::Point const &p) const; - virtual void setDocument (Document* doc); + virtual void setDocument (SPDocument* doc); virtual bool shutdown(); virtual void mouseover() {} virtual void mouseout() {} @@ -337,7 +337,7 @@ private: void push_current_zoom (GList**); - sigc::signal _document_replaced_signal; + sigc::signal _document_replaced_signal; sigc::signal _activate_signal; sigc::signal _deactivate_signal; sigc::signal _event_context_changed_signal; diff --git a/src/dialogs/clonetiler.cpp b/src/dialogs/clonetiler.cpp index cd690a0d4..55884fe4a 100644 --- a/src/dialogs/clonetiler.cpp +++ b/src/dialogs/clonetiler.cpp @@ -841,7 +841,7 @@ static NRArena const *trace_arena = NULL; static unsigned trace_visionkey; static NRArenaItem *trace_root; static gdouble trace_zoom; -static Document *trace_doc; +static SPDocument *trace_doc; static void clonetiler_trace_hide_tiled_clones_recursively (SPObject *from) @@ -857,7 +857,7 @@ clonetiler_trace_hide_tiled_clones_recursively (SPObject *from) } static void -clonetiler_trace_setup (Document *doc, gdouble zoom, SPItem *original) +clonetiler_trace_setup (SPDocument *doc, gdouble zoom, SPItem *original) { trace_arena = NRArena::create(); /* Create ArenaItem and set transform */ diff --git a/src/dialogs/export.cpp b/src/dialogs/export.cpp index 56d50596c..0cde76657 100644 --- a/src/dialogs/export.cpp +++ b/src/dialogs/export.cpp @@ -538,7 +538,7 @@ sp_export_dialog (void) if (SP_ACTIVE_DOCUMENT && SP_DOCUMENT_URI (SP_ACTIVE_DOCUMENT)) { gchar *name; - Document * doc = SP_ACTIVE_DOCUMENT; + SPDocument * doc = SP_ACTIVE_DOCUMENT; const gchar *uri = SP_DOCUMENT_URI (doc); Inkscape::XML::Node * repr = sp_document_repr_root(doc); const gchar * text_extension = repr->attribute("inkscape:output_extension"); @@ -779,7 +779,7 @@ sp_export_selection_modified ( Inkscape::Application */*inkscape*/, switch (current_key) { case SELECTION_DRAWING: if ( SP_ACTIVE_DESKTOP ) { - Document *doc; + SPDocument *doc; doc = sp_desktop_document (SP_ACTIVE_DESKTOP); Geom::OptRect bbox = sp_item_bbox_desktop (SP_ITEM (SP_DOCUMENT_ROOT (doc))); if (bbox) { @@ -839,7 +839,7 @@ sp_export_area_toggled (GtkToggleButton *tb, GtkObject *base) if ( SP_ACTIVE_DESKTOP ) { - Document *doc; + SPDocument *doc; Geom::OptRect bbox; doc = sp_desktop_document (SP_ACTIVE_DESKTOP); @@ -906,7 +906,7 @@ sp_export_area_toggled (GtkToggleButton *tb, GtkObject *base) switch (key) { case SELECTION_PAGE: case SELECTION_DRAWING: { - Document * doc = SP_ACTIVE_DOCUMENT; + SPDocument * doc = SP_ACTIVE_DOCUMENT; sp_document_get_export_hints (doc, &filename, &xdpi, &ydpi); if (filename == NULL) { @@ -1213,7 +1213,7 @@ sp_export_export_clicked (GtkButton */*button*/, GtkObject *base) switch ((selection_type)(GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(base), "selection-type")))) { case SELECTION_PAGE: case SELECTION_DRAWING: { - Document * doc = SP_ACTIVE_DOCUMENT; + SPDocument * doc = SP_ACTIVE_DOCUMENT; Inkscape::XML::Node * repr = sp_document_repr_root(doc); bool modified = false; const gchar * temp_string; @@ -1245,7 +1245,7 @@ sp_export_export_clicked (GtkButton */*button*/, GtkObject *base) } case SELECTION_SELECTION: { const GSList * reprlst; - Document * doc = SP_ACTIVE_DOCUMENT; + SPDocument * doc = SP_ACTIVE_DOCUMENT; bool modified = false; bool saved = sp_document_get_undo_sensitive(doc); @@ -1466,7 +1466,7 @@ sp_export_detect_size(GtkObject * base) { } break; case SELECTION_DRAWING: { - Document *doc = sp_desktop_document (SP_ACTIVE_DESKTOP); + SPDocument *doc = sp_desktop_document (SP_ACTIVE_DESKTOP); Geom::OptRect bbox = sp_item_bbox_desktop (SP_ITEM (SP_DOCUMENT_ROOT (doc))); @@ -1478,7 +1478,7 @@ sp_export_detect_size(GtkObject * base) { } case SELECTION_PAGE: { - Document *doc; + SPDocument *doc; doc = sp_desktop_document (SP_ACTIVE_DESKTOP); diff --git a/src/dialogs/xml-tree.cpp b/src/dialogs/xml-tree.cpp index 32dee453a..c8644fef9 100644 --- a/src/dialogs/xml-tree.cpp +++ b/src/dialogs/xml-tree.cpp @@ -69,7 +69,7 @@ static SPXMLViewContent *content = NULL; static gint blocked = 0; static SPDesktop *current_desktop = NULL; -static Document *current_document = NULL; +static SPDocument *current_document = NULL; static gint selected_attr = 0; static Inkscape::XML::Node *selected_repr = NULL; @@ -77,7 +77,7 @@ static void sp_xmltree_desktop_activate( Inkscape::Application *inkscape, SPDes static void sp_xmltree_desktop_deactivate( Inkscape::Application *inkscape, SPDesktop *desktop, GtkWidget *dialog ); static void set_tree_desktop(SPDesktop *desktop); -static void set_tree_document(Document *document); +static void set_tree_document(SPDocument *document); static void set_tree_repr(Inkscape::XML::Node *repr); static void set_tree_select(Inkscape::XML::Node *repr); @@ -119,8 +119,8 @@ static void on_attr_unselect_row_clear_text(GtkCList *list, gint row, gint colum static void on_editable_changed_enable_if_valid_xml_name(GtkEditable *editable, gpointer data); static void on_desktop_selection_changed(Inkscape::Selection *selection); -static void on_document_replaced(SPDesktop *dt, Document *document); -static void on_document_uri_set(gchar const *uri, Document *document); +static void on_document_replaced(SPDesktop *dt, SPDocument *document); +static void on_document_uri_set(gchar const *uri, SPDocument *document); static void on_clicked_get_editable_text(GtkWidget *widget, gpointer data); @@ -666,7 +666,7 @@ void set_tree_desktop(SPDesktop *desktop) -void set_tree_document(Document *document) +void set_tree_document(SPDocument *document) { if (document == current_document) { return; @@ -1262,7 +1262,7 @@ void on_desktop_selection_changed(Inkscape::Selection */*selection*/) blocked--; } -static void on_document_replaced(SPDesktop *dt, Document *doc) +static void on_document_replaced(SPDesktop *dt, SPDocument *doc) { if (current_desktop) sel_changed_connection.disconnect(); @@ -1271,7 +1271,7 @@ static void on_document_replaced(SPDesktop *dt, Document *doc) set_tree_document(doc); } -void on_document_uri_set(gchar const */*uri*/, Document *document) +void on_document_uri_set(gchar const */*uri*/, SPDocument *document) { gchar title[500]; sp_ui_dialog_title_string(Inkscape::Verb::get(SP_VERB_DIALOG_XML_EDITOR), title); diff --git a/src/display/canvas-axonomgrid.cpp b/src/display/canvas-axonomgrid.cpp index 90bac6053..a92e7cf5b 100644 --- a/src/display/canvas-axonomgrid.cpp +++ b/src/display/canvas-axonomgrid.cpp @@ -190,7 +190,7 @@ attach_all(Gtk::Table &table, Gtk::Widget const *const arr[], unsigned size, int } } -CanvasAxonomGrid::CanvasAxonomGrid (SPNamedView * nv, Inkscape::XML::Node * in_repr, Document * in_doc) +CanvasAxonomGrid::CanvasAxonomGrid (SPNamedView * nv, Inkscape::XML::Node * in_repr, SPDocument * in_doc) : CanvasGrid(nv, in_repr, in_doc, GRID_AXONOMETRIC) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); diff --git a/src/display/canvas-axonomgrid.h b/src/display/canvas-axonomgrid.h index b4a27c873..e36804d7c 100644 --- a/src/display/canvas-axonomgrid.h +++ b/src/display/canvas-axonomgrid.h @@ -31,7 +31,7 @@ namespace Inkscape { class CanvasAxonomGrid : public CanvasGrid { public: - CanvasAxonomGrid(SPNamedView * nv, Inkscape::XML::Node * in_repr, Document * in_doc); + CanvasAxonomGrid(SPNamedView * nv, Inkscape::XML::Node * in_repr, SPDocument * in_doc); virtual ~CanvasAxonomGrid(); void Update (Geom::Matrix const &affine, unsigned int flags); diff --git a/src/display/canvas-grid.cpp b/src/display/canvas-grid.cpp index 710074a97..5037c0375 100644 --- a/src/display/canvas-grid.cpp +++ b/src/display/canvas-grid.cpp @@ -155,7 +155,7 @@ grid_canvasitem_update (SPCanvasItem *item, Geom::Matrix const &affine, unsigned NULL /* order_changed */ }; -CanvasGrid::CanvasGrid(SPNamedView * nv, Inkscape::XML::Node * in_repr, Document *in_doc, GridType type) +CanvasGrid::CanvasGrid(SPNamedView * nv, Inkscape::XML::Node * in_repr, SPDocument *in_doc, GridType type) : visible(true), gridtype(type) { repr = in_repr; @@ -240,7 +240,7 @@ CanvasGrid::getGridTypeFromName(char const *typestr) * writes an child to repr. */ void -CanvasGrid::writeNewGridToRepr(Inkscape::XML::Node * repr, Document * doc, GridType gridtype) +CanvasGrid::writeNewGridToRepr(Inkscape::XML::Node * repr, SPDocument * doc, GridType gridtype) { if (!repr) return; if (gridtype > GRID_MAXTYPENR) return; @@ -262,7 +262,7 @@ CanvasGrid::writeNewGridToRepr(Inkscape::XML::Node * repr, Document * doc, GridT * Creates a new CanvasGrid object of type gridtype */ CanvasGrid* -CanvasGrid::NewGrid(SPNamedView * nv, Inkscape::XML::Node * repr, Document * doc, GridType gridtype) +CanvasGrid::NewGrid(SPNamedView * nv, Inkscape::XML::Node * repr, SPDocument * doc, GridType gridtype) { if (!repr) return NULL; if (!doc) { @@ -420,7 +420,7 @@ attach_all(Gtk::Table &table, Gtk::Widget const *const arr[], unsigned size, int } } -CanvasXYGrid::CanvasXYGrid (SPNamedView * nv, Inkscape::XML::Node * in_repr, Document * in_doc) +CanvasXYGrid::CanvasXYGrid (SPNamedView * nv, Inkscape::XML::Node * in_repr, SPDocument * in_doc) : CanvasGrid(nv, in_repr, in_doc, GRID_RECTANGULAR) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); diff --git a/src/display/canvas-grid.h b/src/display/canvas-grid.h index 058f88ef8..58cfbf735 100644 --- a/src/display/canvas-grid.h +++ b/src/display/canvas-grid.h @@ -26,7 +26,7 @@ struct SPDesktop; struct SPNamedView; -class Document; +class SPDocument; namespace Inkscape { @@ -73,8 +73,8 @@ public: static GridType getGridTypeFromSVGName(const char * typestr); static GridType getGridTypeFromName(const char * typestr); - static CanvasGrid* NewGrid(SPNamedView * nv, Inkscape::XML::Node * repr, Document *doc, GridType gridtype); - static void writeNewGridToRepr(Inkscape::XML::Node * repr, Document * doc, GridType gridtype); + static CanvasGrid* NewGrid(SPNamedView * nv, Inkscape::XML::Node * repr, SPDocument *doc, GridType gridtype); + static void writeNewGridToRepr(Inkscape::XML::Node * repr, SPDocument * doc, GridType gridtype); GridCanvasItem * createCanvasItem(SPDesktop * desktop); @@ -94,7 +94,7 @@ public: SPUnit const* gridunit; Inkscape::XML::Node * repr; - Document *doc; + SPDocument *doc; Inkscape::Snapper* snapper; @@ -104,7 +104,7 @@ public: bool isEnabled(); protected: - CanvasGrid(SPNamedView * nv, Inkscape::XML::Node * in_repr, Document *in_doc, GridType type); + CanvasGrid(SPNamedView * nv, Inkscape::XML::Node * in_repr, SPDocument *in_doc, GridType type); virtual Gtk::Widget * newSpecificWidget() = 0; @@ -125,7 +125,7 @@ private: class CanvasXYGrid : public CanvasGrid { public: - CanvasXYGrid(SPNamedView * nv, Inkscape::XML::Node * in_repr, Document * in_doc); + CanvasXYGrid(SPNamedView * nv, Inkscape::XML::Node * in_repr, SPDocument * in_doc); virtual ~CanvasXYGrid(); void Update (Geom::Matrix const &affine, unsigned int flags); diff --git a/src/display/nr-filter-image.cpp b/src/display/nr-filter-image.cpp index 4430907da..2b799f8d2 100644 --- a/src/display/nr-filter-image.cpp +++ b/src/display/nr-filter-image.cpp @@ -225,7 +225,7 @@ void FilterImage::set_href(const gchar *href){ feImageHref = (href) ? g_strdup (href) : NULL; } -void FilterImage::set_document(Document *doc){ +void FilterImage::set_document(SPDocument *doc){ document = doc; } diff --git a/src/display/nr-filter-image.h b/src/display/nr-filter-image.h index 6fbc5d7eb..f3565ef9f 100644 --- a/src/display/nr-filter-image.h +++ b/src/display/nr-filter-image.h @@ -29,14 +29,14 @@ public: virtual int render(FilterSlot &slot, FilterUnits const &units); virtual FilterTraits get_input_traits(); - void set_document( Document *document ); + void set_document( SPDocument *document ); void set_href(const gchar *href); void set_region(SVGLength x, SVGLength y, SVGLength width, SVGLength height); bool from_element; SPItem* SVGElem; private: - Document *document; + SPDocument *document; gchar *feImageHref; guint8* image_pixbuf; Glib::RefPtr image; diff --git a/src/document-private.h b/src/document-private.h index 221cfa17c..fa4754248 100644 --- a/src/document-private.h +++ b/src/document-private.h @@ -36,9 +36,9 @@ class Event; } -struct DocumentPrivate { - typedef std::map IDChangedSignalMap; - typedef std::map ResourcesChangedSignalMap; +struct SPDocumentPrivate { + typedef std::map IDChangedSignalMap; + typedef std::map ResourcesChangedSignalMap; GHashTable *iddef; /**< Dictionary of id -> SPObject mappings */ GHashTable *reprdef; /**< Dictionary of Inkscape::XML::Node -> SPObject mappings */ @@ -53,12 +53,12 @@ struct DocumentPrivate { GHashTable *resources; ResourcesChangedSignalMap resources_changed_signals; - Document::ModifiedSignal modified_signal; - Document::URISetSignal uri_set_signal; - Document::ResizedSignal resized_signal; - Document::ReconstructionStart _reconstruction_start_signal; - Document::ReconstructionFinish _reconstruction_finish_signal; - Document::CommitSignal commit_signal; + SPDocument::ModifiedSignal modified_signal; + SPDocument::URISetSignal uri_set_signal; + SPDocument::ResizedSignal resized_signal; + SPDocument::ReconstructionStart _reconstruction_start_signal; + SPDocument::ReconstructionFinish _reconstruction_finish_signal; + SPDocument::CommitSignal commit_signal; /* Undo/Redo state */ bool sensitive: true; /* If we save actions to undo stack */ diff --git a/src/document-subset.h b/src/document-subset.h index b7b724162..e424a289c 100644 --- a/src/document-subset.h +++ b/src/document-subset.h @@ -17,7 +17,7 @@ #include "gc-anchored.h" class SPObject; -class Document; +class SPDocument; namespace Inkscape { diff --git a/src/document-undo.cpp b/src/document-undo.cpp index 9dbf5db25..ae1c82e71 100644 --- a/src/document-undo.cpp +++ b/src/document-undo.cpp @@ -23,8 +23,8 @@ * stack. Two methods exist to indicate that the given action is completed: * * \verbatim - void sp_document_done (Document *document); - void sp_document_maybe_done (Document *document, const unsigned char *key) \endverbatim + void sp_document_done (SPDocument *document); + void sp_document_maybe_done (SPDocument *document, const unsigned char *key) \endverbatim * * Both move the recent action list into the undo stack and clear the * list afterwards. While the first method does an unconditional push, @@ -85,7 +85,7 @@ sp_document_set_undo_sensitive(document, saved); \endverbatim */ void -sp_document_set_undo_sensitive (Document *doc, bool sensitive) +sp_document_set_undo_sensitive (SPDocument *doc, bool sensitive) { g_assert (doc != NULL); g_assert (doc->priv != NULL); @@ -112,7 +112,7 @@ sp_document_set_undo_sensitive (Document *doc, bool sensitive) * the saved bools in a stack. Perhaps this is why the above solution is better. */ -bool sp_document_get_undo_sensitive(Document const *document) { +bool sp_document_get_undo_sensitive(SPDocument const *document) { g_assert(document != NULL); g_assert(document->priv != NULL); @@ -120,7 +120,7 @@ bool sp_document_get_undo_sensitive(Document const *document) { } void -sp_document_done (Document *doc, const unsigned int event_type, Glib::ustring event_description) +sp_document_done (SPDocument *doc, const unsigned int event_type, Glib::ustring event_description) { sp_document_maybe_done (doc, NULL, event_type, event_description); } @@ -128,7 +128,7 @@ sp_document_done (Document *doc, const unsigned int event_type, Glib::ustring ev void sp_document_reset_key (Inkscape::Application */*inkscape*/, SPDesktop */*desktop*/, GtkObject *base) { - Document *doc = (Document *) base; + SPDocument *doc = (SPDocument *) base; doc->actionkey = NULL; } @@ -145,7 +145,7 @@ typedef SimpleEvent InteractionEvent; class CommitEvent : public InteractionEvent { public: - CommitEvent(Document *doc, const gchar *key, const unsigned int type) + CommitEvent(SPDocument *doc, const gchar *key, const unsigned int type) : InteractionEvent(share_static_string("commit")) { _addProperty(share_static_string("timestamp"), timestamp()); @@ -165,7 +165,7 @@ public: } void -sp_document_maybe_done (Document *doc, const gchar *key, const unsigned int event_type, +sp_document_maybe_done (SPDocument *doc, const gchar *key, const unsigned int event_type, Glib::ustring event_description) { g_assert (doc != NULL); @@ -209,7 +209,7 @@ sp_document_maybe_done (Document *doc, const gchar *key, const unsigned int even } void -sp_document_cancel (Document *doc) +sp_document_cancel (SPDocument *doc) { g_assert (doc != NULL); g_assert (doc->priv != NULL); @@ -226,8 +226,8 @@ sp_document_cancel (Document *doc) sp_repr_begin_transaction (doc->rdoc); } -static void finish_incomplete_transaction(Document &doc) { - DocumentPrivate &priv=*doc.priv; +static void finish_incomplete_transaction(SPDocument &doc) { + SPDocumentPrivate &priv=*doc.priv; Inkscape::XML::Event *log=sp_repr_commit_undoable(doc.rdoc); if (log || priv.partial) { g_warning ("Incomplete undo transaction:"); @@ -241,7 +241,7 @@ static void finish_incomplete_transaction(Document &doc) { } gboolean -sp_document_undo (Document *doc) +sp_document_undo (SPDocument *doc) { using Inkscape::Debug::EventTracker; using Inkscape::Debug::SimpleEvent; @@ -287,7 +287,7 @@ sp_document_undo (Document *doc) } gboolean -sp_document_redo (Document *doc) +sp_document_redo (SPDocument *doc) { using Inkscape::Debug::EventTracker; using Inkscape::Debug::SimpleEvent; @@ -333,7 +333,7 @@ sp_document_redo (Document *doc) } void -sp_document_clear_undo (Document *doc) +sp_document_clear_undo (SPDocument *doc) { if (doc->priv->undo) doc->priv->undoStackObservers.notifyClearUndoEvent(); @@ -351,7 +351,7 @@ sp_document_clear_undo (Document *doc) } void -sp_document_clear_redo (Document *doc) +sp_document_clear_redo (SPDocument *doc) { if (doc->priv->redo) doc->priv->undoStackObservers.notifyClearRedoEvent(); diff --git a/src/document.cpp b/src/document.cpp index 4289205c1..288e52c6d 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -1,7 +1,7 @@ -#define __DOCUMENT_C__ +#define __SP_DOCUMENT_C__ /** \file - * Document manipulation + * SPDocument manipulation * * Authors: * Lauris Kaplinski @@ -15,17 +15,17 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -/** \class Document - * Document serves as the container of both model trees (agnostic XML +/** \class SPDocument + * SPDocument serves as the container of both model trees (agnostic XML * and typed object tree), and implements all of the document-level * functionality used by the program. Many document level operations, like - * load, save, print, export and so on, use Document as their basic datatype. + * load, save, print, export and so on, use SPDocument as their basic datatype. * - * Document implements undo and redo stacks and an id-based object + * SPDocument implements undo and redo stacks and an id-based object * dictionary. Thanks to unique id attributes, the latter can be used to * map from the XML tree back to the object tree. * - * Document performs the basic operations needed for asynchronous + * SPDocument performs the basic operations needed for asynchronous * update notification (SPObject ::modified virtual method), and implements * the 'modified' signal, as well. */ @@ -74,7 +74,7 @@ static gint doc_count = 0; static unsigned long next_serial = 0; -Document::Document() : +SPDocument::SPDocument() : keepalive(FALSE), virgin(TRUE), modified_since_save(FALSE), @@ -98,7 +98,7 @@ Document::Document() : // Don't use the Consolidate moves optimisation. router->ConsolidateMoves = false; - DocumentPrivate *p = new DocumentPrivate(); + SPDocumentPrivate *p = new SPDocumentPrivate(); p->serial = next_serial++; @@ -123,7 +123,7 @@ Document::Document() : priv->undoStackObservers.add(p->console_output_undo_observer); } -Document::~Document() { +SPDocument::~SPDocument() { collectOrphans(); // kill/unhook this first @@ -204,7 +204,7 @@ Document::~Document() { } -void Document::add_persp3d (Persp3D * const /*persp*/) +void SPDocument::add_persp3d (Persp3D * const /*persp*/) { SPDefs *defs = SP_ROOT(this->root)->defs; for (SPObject *i = sp_object_first_child(SP_OBJECT(defs)); i != NULL; i = SP_OBJECT_NEXT(i) ) { @@ -217,18 +217,18 @@ void Document::add_persp3d (Persp3D * const /*persp*/) persp3d_create_xml_element (this); } -void Document::remove_persp3d (Persp3D * const /*persp*/) +void SPDocument::remove_persp3d (Persp3D * const /*persp*/) { // TODO: Delete the repr, maybe perform a check if any boxes are still linked to the perspective. // Anything else? g_print ("Please implement deletion of perspectives here.\n"); } -unsigned long Document::serial() const { +unsigned long SPDocument::serial() const { return priv->serial; } -void Document::queueForOrphanCollection(SPObject *object) { +void SPDocument::queueForOrphanCollection(SPObject *object) { g_return_if_fail(object != NULL); g_return_if_fail(SP_OBJECT_DOCUMENT(object) == this); @@ -236,7 +236,7 @@ void Document::queueForOrphanCollection(SPObject *object) { _collection_queue = g_slist_prepend(_collection_queue, object); } -void Document::collectOrphans() { +void SPDocument::collectOrphans() { while (_collection_queue) { GSList *objects=_collection_queue; _collection_queue = NULL; @@ -249,25 +249,25 @@ void Document::collectOrphans() { } } -void Document::reset_key (void */*dummy*/) +void SPDocument::reset_key (void */*dummy*/) { actionkey = NULL; } -Document * +SPDocument * sp_document_create(Inkscape::XML::Document *rdoc, gchar const *uri, gchar const *base, gchar const *name, unsigned int keepalive) { - Document *document; + SPDocument *document; Inkscape::XML::Node *rroot; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); rroot = rdoc->root(); - document = new Document(); + document = new SPDocument(); document->keepalive = keepalive; @@ -389,8 +389,8 @@ sp_document_create(Inkscape::XML::Document *rdoc, G_CALLBACK(sp_document_reset_key), document); document->oldSignalsConnected = true; } else { - document->_selection_changed_connection = Inkscape::NSApplication::Editor::connectSelectionChanged (sigc::mem_fun (*document, &Document::reset_key)); - document->_desktop_activated_connection = Inkscape::NSApplication::Editor::connectDesktopActivated (sigc::mem_fun (*document, &Document::reset_key)); + document->_selection_changed_connection = Inkscape::NSApplication::Editor::connectSelectionChanged (sigc::mem_fun (*document, &SPDocument::reset_key)); + document->_desktop_activated_connection = Inkscape::NSApplication::Editor::connectDesktopActivated (sigc::mem_fun (*document, &SPDocument::reset_key)); document->oldSignalsConnected = false; } @@ -401,10 +401,10 @@ sp_document_create(Inkscape::XML::Document *rdoc, * Fetches document from URI, or creates new, if NULL; public document * appears in document list. */ -Document * +SPDocument * sp_document_new(gchar const *uri, unsigned int keepalive, bool make_new) { - Document *doc; + SPDocument *doc; Inkscape::XML::Document *rdoc; gchar *base = NULL; gchar *name = NULL; @@ -452,10 +452,10 @@ sp_document_new(gchar const *uri, unsigned int keepalive, bool make_new) return doc; } -Document * +SPDocument * sp_document_new_from_mem(gchar const *buffer, gint length, unsigned int keepalive) { - Document *doc; + SPDocument *doc; Inkscape::XML::Document *rdoc; Inkscape::XML::Node *rroot; gchar *name; @@ -477,23 +477,23 @@ sp_document_new_from_mem(gchar const *buffer, gint length, unsigned int keepaliv return doc; } -Document * -sp_document_ref(Document *doc) +SPDocument * +sp_document_ref(SPDocument *doc) { g_return_val_if_fail(doc != NULL, NULL); Inkscape::GC::anchor(doc); return doc; } -Document * -sp_document_unref(Document *doc) +SPDocument * +sp_document_unref(SPDocument *doc) { g_return_val_if_fail(doc != NULL, NULL); Inkscape::GC::release(doc); return NULL; } -gdouble sp_document_width(Document *document) +gdouble sp_document_width(SPDocument *document) { g_return_val_if_fail(document != NULL, 0.0); g_return_val_if_fail(document->priv != NULL, 0.0); @@ -507,7 +507,7 @@ gdouble sp_document_width(Document *document) } void -sp_document_set_width (Document *document, gdouble width, const SPUnit *unit) +sp_document_set_width (SPDocument *document, gdouble width, const SPUnit *unit) { SPRoot *root = SP_ROOT(document->root); @@ -533,7 +533,7 @@ sp_document_set_width (Document *document, gdouble width, const SPUnit *unit) SP_OBJECT (root)->updateRepr(); } -void sp_document_set_height (Document * document, gdouble height, const SPUnit *unit) +void sp_document_set_height (SPDocument * document, gdouble height, const SPUnit *unit) { SPRoot *root = SP_ROOT(document->root); @@ -559,7 +559,7 @@ void sp_document_set_height (Document * document, gdouble height, const SPUnit * SP_OBJECT (root)->updateRepr(); } -gdouble sp_document_height(Document *document) +gdouble sp_document_height(SPDocument *document) { g_return_val_if_fail(document != NULL, 0.0); g_return_val_if_fail(document->priv != NULL, 0.0); @@ -572,7 +572,7 @@ gdouble sp_document_height(Document *document) return root->height.computed; } -Geom::Point sp_document_dimensions(Document *doc) +Geom::Point sp_document_dimensions(SPDocument *doc) { return Geom::Point(sp_document_width(doc), sp_document_height(doc)); } @@ -582,7 +582,7 @@ Geom::Point sp_document_dimensions(Document *doc) * this function fits the canvas to that rect by resizing the canvas * and translating the document root into position. */ -void Document::fitToRect(Geom::Rect const &rect) +void SPDocument::fitToRect(Geom::Rect const &rect) { double const w = rect.width(); double const h = rect.height(); @@ -606,7 +606,7 @@ void Document::fitToRect(Geom::Rect const &rect) } static void -do_change_uri(Document *const document, gchar const *const filename, bool const rebase) +do_change_uri(SPDocument *const document, gchar const *const filename, bool const rebase) { g_return_if_fail(document != NULL); @@ -638,7 +638,7 @@ do_change_uri(Document *const document, gchar const *const filename, bool const sp_document_set_undo_sensitive(document, false); if (rebase) { - Inkscape::XML::rebase_hrefs((Inkscape::XML::Document *)document, new_base, true); + Inkscape::XML::rebase_hrefs(document, new_base, true); } repr->setAttribute("sodipodi:docname", document->name); @@ -662,7 +662,7 @@ do_change_uri(Document *const document, gchar const *const filename, bool const * * \see sp_document_change_uri_and_hrefs */ -void sp_document_set_uri(Document *document, gchar const *filename) +void sp_document_set_uri(SPDocument *document, gchar const *filename) { g_return_if_fail(document != NULL); @@ -675,7 +675,7 @@ void sp_document_set_uri(Document *document, gchar const *filename) * * \see sp_document_set_uri */ -void sp_document_change_uri_and_hrefs(Document *document, gchar const *filename) +void sp_document_change_uri_and_hrefs(SPDocument *document, gchar const *filename) { g_return_if_fail(document != NULL); @@ -683,36 +683,36 @@ void sp_document_change_uri_and_hrefs(Document *document, gchar const *filename) } void -sp_document_resized_signal_emit(Document *doc, gdouble width, gdouble height) +sp_document_resized_signal_emit(SPDocument *doc, gdouble width, gdouble height) { g_return_if_fail(doc != NULL); doc->priv->resized_signal.emit(width, height); } -sigc::connection Document::connectModified(Document::ModifiedSignal::slot_type slot) +sigc::connection SPDocument::connectModified(SPDocument::ModifiedSignal::slot_type slot) { return priv->modified_signal.connect(slot); } -sigc::connection Document::connectURISet(Document::URISetSignal::slot_type slot) +sigc::connection SPDocument::connectURISet(SPDocument::URISetSignal::slot_type slot) { return priv->uri_set_signal.connect(slot); } -sigc::connection Document::connectResized(Document::ResizedSignal::slot_type slot) +sigc::connection SPDocument::connectResized(SPDocument::ResizedSignal::slot_type slot) { return priv->resized_signal.connect(slot); } sigc::connection -Document::connectReconstructionStart(Document::ReconstructionStart::slot_type slot) +SPDocument::connectReconstructionStart(SPDocument::ReconstructionStart::slot_type slot) { return priv->_reconstruction_start_signal.connect(slot); } void -Document::emitReconstructionStart(void) +SPDocument::emitReconstructionStart(void) { // printf("Starting Reconstruction\n"); priv->_reconstruction_start_signal.emit(); @@ -720,33 +720,33 @@ Document::emitReconstructionStart(void) } sigc::connection -Document::connectReconstructionFinish(Document::ReconstructionFinish::slot_type slot) +SPDocument::connectReconstructionFinish(SPDocument::ReconstructionFinish::slot_type slot) { return priv->_reconstruction_finish_signal.connect(slot); } void -Document::emitReconstructionFinish(void) +SPDocument::emitReconstructionFinish(void) { // printf("Finishing Reconstruction\n"); priv->_reconstruction_finish_signal.emit(); return; } -sigc::connection Document::connectCommit(Document::CommitSignal::slot_type slot) +sigc::connection SPDocument::connectCommit(SPDocument::CommitSignal::slot_type slot) { return priv->commit_signal.connect(slot); } -void Document::_emitModified() { +void SPDocument::_emitModified() { static guint const flags = SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG | SP_OBJECT_PARENT_MODIFIED_FLAG; root->emitModified(0); priv->modified_signal.emit(flags); } -void Document::bindObjectToId(gchar const *id, SPObject *object) { +void SPDocument::bindObjectToId(gchar const *id, SPObject *object) { GQuark idq = g_quark_from_string(id); if (object) { @@ -757,7 +757,7 @@ void Document::bindObjectToId(gchar const *id, SPObject *object) { g_hash_table_remove(priv->iddef, GINT_TO_POINTER(idq)); } - DocumentPrivate::IDChangedSignalMap::iterator pos; + SPDocumentPrivate::IDChangedSignalMap::iterator pos; pos = priv->id_changed_signals.find(idq); if ( pos != priv->id_changed_signals.end() ) { @@ -770,31 +770,31 @@ void Document::bindObjectToId(gchar const *id, SPObject *object) { } void -Document::addUndoObserver(Inkscape::UndoStackObserver& observer) +SPDocument::addUndoObserver(Inkscape::UndoStackObserver& observer) { this->priv->undoStackObservers.add(observer); } void -Document::removeUndoObserver(Inkscape::UndoStackObserver& observer) +SPDocument::removeUndoObserver(Inkscape::UndoStackObserver& observer) { this->priv->undoStackObservers.remove(observer); } -SPObject *Document::getObjectById(gchar const *id) { +SPObject *SPDocument::getObjectById(gchar const *id) { g_return_val_if_fail(id != NULL, NULL); GQuark idq = g_quark_from_string(id); return (SPObject*)g_hash_table_lookup(priv->iddef, GINT_TO_POINTER(idq)); } -sigc::connection Document::connectIdChanged(gchar const *id, - Document::IDChangedSignal::slot_type slot) +sigc::connection SPDocument::connectIdChanged(gchar const *id, + SPDocument::IDChangedSignal::slot_type slot) { return priv->id_changed_signals[g_quark_from_string(id)].connect(slot); } -void Document::bindObjectToRepr(Inkscape::XML::Node *repr, SPObject *object) { +void SPDocument::bindObjectToRepr(Inkscape::XML::Node *repr, SPObject *object) { if (object) { g_assert(g_hash_table_lookup(priv->reprdef, repr) == NULL); g_hash_table_insert(priv->reprdef, repr, object); @@ -804,12 +804,12 @@ void Document::bindObjectToRepr(Inkscape::XML::Node *repr, SPObject *object) { } } -SPObject *Document::getObjectByRepr(Inkscape::XML::Node *repr) { +SPObject *SPDocument::getObjectByRepr(Inkscape::XML::Node *repr) { g_return_val_if_fail(repr != NULL, NULL); return (SPObject*)g_hash_table_lookup(priv->reprdef, repr); } -Glib::ustring Document::getLanguage() { +Glib::ustring SPDocument::getLanguage() { gchar const *document_language = rdf_get_work_entity(this, rdf_find_entity("language")); if (document_language) { while (isspace(*document_language)) @@ -841,7 +841,7 @@ Glib::ustring Document::getLanguage() { /* Object modification root handler */ void -sp_document_request_modified(Document *doc) +sp_document_request_modified(SPDocument *doc) { if (!doc->modified_id) { doc->modified_id = gtk_idle_add_priority(SP_DOCUMENT_UPDATE_PRIORITY, sp_document_idle_handler, doc); @@ -849,7 +849,7 @@ sp_document_request_modified(Document *doc) } void -sp_document_setup_viewport (Document *doc, SPItemCtx *ctx) +sp_document_setup_viewport (SPDocument *doc, SPItemCtx *ctx) { ctx->ctx.flags = 0; ctx->i2doc = Geom::identity(); @@ -874,7 +874,7 @@ sp_document_setup_viewport (Document *doc, SPItemCtx *ctx) * been brought fully up to date. */ bool -Document::_updateDocument() +SPDocument::_updateDocument() { /* Process updates */ if (this->root->uflags || this->root->mflags) { @@ -904,7 +904,7 @@ Document::_updateDocument() * since this typically indicates we're stuck in an update loop. */ gint -sp_document_ensure_up_to_date(Document *doc) +sp_document_ensure_up_to_date(SPDocument *doc) { int counter = 32; while (!doc->_updateDocument()) { @@ -930,7 +930,7 @@ sp_document_ensure_up_to_date(Document *doc) static gint sp_document_idle_handler(gpointer data) { - Document *doc = static_cast(data); + SPDocument *doc = static_cast(data); if (doc->_updateDocument()) { doc->modified_id = 0; return false; @@ -1106,7 +1106,7 @@ find_group_at_point(unsigned int dkey, SPGroup *group, Geom::Point const p) * */ -GSList *sp_document_items_in_box(Document *document, unsigned int dkey, Geom::Rect const &box) +GSList *sp_document_items_in_box(SPDocument *document, unsigned int dkey, Geom::Rect const &box) { g_return_val_if_fail(document != NULL, NULL); g_return_val_if_fail(document->priv != NULL, NULL); @@ -1121,7 +1121,7 @@ GSList *sp_document_items_in_box(Document *document, unsigned int dkey, Geom::Re * */ -GSList *sp_document_partial_items_in_box(Document *document, unsigned int dkey, Geom::Rect const &box) +GSList *sp_document_partial_items_in_box(SPDocument *document, unsigned int dkey, Geom::Rect const &box) { g_return_val_if_fail(document != NULL, NULL); g_return_val_if_fail(document->priv != NULL, NULL); @@ -1130,7 +1130,7 @@ GSList *sp_document_partial_items_in_box(Document *document, unsigned int dkey, } GSList * -sp_document_items_at_points(Document *document, unsigned const key, std::vector points) +sp_document_items_at_points(SPDocument *document, unsigned const key, std::vector points) { GSList *items = NULL; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); @@ -1155,7 +1155,7 @@ sp_document_items_at_points(Document *document, unsigned const key, std::vector< } SPItem * -sp_document_item_at_point(Document *document, unsigned const key, Geom::Point const p, +sp_document_item_at_point(SPDocument *document, unsigned const key, Geom::Point const p, gboolean const into_groups, SPItem *upto) { g_return_val_if_fail(document != NULL, NULL); @@ -1165,7 +1165,7 @@ sp_document_item_at_point(Document *document, unsigned const key, Geom::Point co } SPItem* -sp_document_group_at_point(Document *document, unsigned int key, Geom::Point const p) +sp_document_group_at_point(SPDocument *document, unsigned int key, Geom::Point const p) { g_return_val_if_fail(document != NULL, NULL); g_return_val_if_fail(document->priv != NULL, NULL); @@ -1177,7 +1177,7 @@ sp_document_group_at_point(Document *document, unsigned int key, Geom::Point con /* Resource management */ gboolean -sp_document_add_resource(Document *document, gchar const *key, SPObject *object) +sp_document_add_resource(SPDocument *document, gchar const *key, SPObject *object) { GSList *rlist; GQuark q = g_quark_from_string(key); @@ -1202,7 +1202,7 @@ sp_document_add_resource(Document *document, gchar const *key, SPObject *object) } gboolean -sp_document_remove_resource(Document *document, gchar const *key, SPObject *object) +sp_document_remove_resource(SPDocument *document, gchar const *key, SPObject *object) { GSList *rlist; GQuark q = g_quark_from_string(key); @@ -1228,7 +1228,7 @@ sp_document_remove_resource(Document *document, gchar const *key, SPObject *obje } GSList const * -sp_document_get_resource_list(Document *document, gchar const *key) +sp_document_get_resource_list(SPDocument *document, gchar const *key) { g_return_val_if_fail(document != NULL, NULL); g_return_val_if_fail(key != NULL, NULL); @@ -1237,9 +1237,9 @@ sp_document_get_resource_list(Document *document, gchar const *key) return (GSList*)g_hash_table_lookup(document->priv->resources, key); } -sigc::connection sp_document_resources_changed_connect(Document *document, +sigc::connection sp_document_resources_changed_connect(SPDocument *document, gchar const *key, - Document::ResourcesChangedSignal::slot_type slot) + SPDocument::ResourcesChangedSignal::slot_type slot) { GQuark q = g_quark_from_string(key); return document->priv->resources_changed_signals[q].connect(slot); @@ -1267,7 +1267,7 @@ count_objects_recursive(SPObject *obj, unsigned int count) } unsigned int -objects_in_document(Document *document) +objects_in_document(SPDocument *document) { return count_objects_recursive(SP_DOCUMENT_ROOT(document), 0); } @@ -1288,7 +1288,7 @@ vacuum_document_recursive(SPObject *obj) } unsigned int -vacuum_document(Document *document) +vacuum_document(SPDocument *document) { unsigned int start = objects_in_document(document); unsigned int end; @@ -1310,7 +1310,7 @@ vacuum_document(Document *document) return start - newend; } -bool Document::isSeeking() const { +bool SPDocument::isSeeking() const { return priv->seeking; } diff --git a/src/document.h b/src/document.h index cb83c4d0d..696e568ad 100644 --- a/src/document.h +++ b/src/document.h @@ -1,8 +1,8 @@ -#ifndef __DOCUMENT_H__ -#define __DOCUMENT_H__ +#ifndef __SP_DOCUMENT_H__ +#define __SP_DOCUMENT_H__ /** \file - * Document: Typed SVG document implementation + * SPDocument: Typed SVG document implementation */ /* Authors: * Lauris Kaplinski @@ -31,8 +31,6 @@ #include #include -#include "xml/document.h" - namespace Avoid { class Router; } @@ -62,14 +60,13 @@ namespace Proj { class TransfMat3x4; } -class DocumentPrivate; +class SPDocumentPrivate; /// Typed SVG document implementation. -class Document : public Inkscape::GC::Managed<>, +struct SPDocument : public Inkscape::GC::Managed<>, public Inkscape::GC::Finalized, public Inkscape::GC::Anchored { -public: typedef sigc::signal IDChangedSignal; typedef sigc::signal ResourcesChangedSignal; typedef sigc::signal ModifiedSignal; @@ -79,14 +76,14 @@ public: typedef sigc::signal ReconstructionFinish; typedef sigc::signal CommitSignal; - Document(); - virtual ~Document(); + SPDocument(); + virtual ~SPDocument(); unsigned int keepalive : 1; unsigned int virgin : 1; ///< Has the document never been touched? unsigned int modified_since_save : 1; - Inkscape::XML::DocumentTree *rdoc; ///< Our Inkscape::XML::Document + Inkscape::XML::Document *rdoc; ///< Our Inkscape::XML::Document Inkscape::XML::Node *rroot; ///< Root element of Inkscape::XML::Document SPObject *root; ///< Our SPRoot CRCascade *style_cascade; @@ -95,7 +92,7 @@ public: gchar *base; ///< To be used for resolving relative hrefs. gchar *name; ///< basename(uri) or other human-readable label for the document. - DocumentPrivate *priv; + SPDocumentPrivate *priv; /// Last action key const gchar *actionkey; @@ -151,8 +148,8 @@ sigc::connection connectCommit(CommitSignal::slot_type slot); } private: - Document(Document const &); // no copy - void operator=(Document const &); // no assign + SPDocument(SPDocument const &); // no copy + void operator=(SPDocument const &); // no assign public: sigc::connection connectReconstructionStart(ReconstructionStart::slot_type slot); @@ -168,14 +165,14 @@ public: void fitToRect(Geom::Rect const &rect); }; -Document *sp_document_new(const gchar *uri, unsigned int keepalive, bool make_new = false); -Document *sp_document_new_from_mem(const gchar *buffer, gint length, unsigned int keepalive); +SPDocument *sp_document_new(const gchar *uri, unsigned int keepalive, bool make_new = false); +SPDocument *sp_document_new_from_mem(const gchar *buffer, gint length, unsigned int keepalive); -Document *sp_document_ref(Document *doc); -Document *sp_document_unref(Document *doc); +SPDocument *sp_document_ref(SPDocument *doc); +SPDocument *sp_document_unref(SPDocument *doc); -Document *sp_document_create(Inkscape::XML::Document *rdoc, gchar const *uri, gchar const *base, gchar const *name, unsigned int keepalive); +SPDocument *sp_document_create(Inkscape::XML::Document *rdoc, gchar const *uri, gchar const *base, gchar const *name, unsigned int keepalive); /* * Access methods @@ -186,14 +183,14 @@ Document *sp_document_create(Inkscape::XML::Document *rdoc, gchar const *uri, gc #define sp_document_root(d) (d->root) #define SP_DOCUMENT_ROOT(d) (d->root) -gdouble sp_document_width(Document *document); -gdouble sp_document_height(Document *document); -Geom::Point sp_document_dimensions(Document *document); +gdouble sp_document_width(SPDocument *document); +gdouble sp_document_height(SPDocument *document); +Geom::Point sp_document_dimensions(SPDocument *document); struct SPUnit; -void sp_document_set_width(Document *document, gdouble width, const SPUnit *unit); -void sp_document_set_height(Document *document, gdouble height, const SPUnit *unit); +void sp_document_set_width(SPDocument *document, gdouble width, const SPUnit *unit); +void sp_document_set_height(SPDocument *document, gdouble height, const SPUnit *unit); #define SP_DOCUMENT_URI(d) (d->uri) #define SP_DOCUMENT_NAME(d) (d->name) @@ -207,39 +204,39 @@ void sp_document_set_height(Document *document, gdouble height, const SPUnit *un * Undo & redo */ -void sp_document_set_undo_sensitive(Document *document, bool sensitive); -bool sp_document_get_undo_sensitive(Document const *document); +void sp_document_set_undo_sensitive(SPDocument *document, bool sensitive); +bool sp_document_get_undo_sensitive(SPDocument const *document); -void sp_document_clear_undo(Document *document); -void sp_document_clear_redo(Document *document); +void sp_document_clear_undo(SPDocument *document); +void sp_document_clear_redo(SPDocument *document); -void sp_document_child_added(Document *doc, SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref); -void sp_document_child_removed(Document *doc, SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref); -void sp_document_attr_changed(Document *doc, SPObject *object, const gchar *key, const gchar *oldval, const gchar *newval); -void sp_document_content_changed(Document *doc, SPObject *object, const gchar *oldcontent, const gchar *newcontent); -void sp_document_order_changed(Document *doc, SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *oldref, Inkscape::XML::Node *newref); +void sp_document_child_added(SPDocument *doc, SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref); +void sp_document_child_removed(SPDocument *doc, SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref); +void sp_document_attr_changed(SPDocument *doc, SPObject *object, const gchar *key, const gchar *oldval, const gchar *newval); +void sp_document_content_changed(SPDocument *doc, SPObject *object, const gchar *oldcontent, const gchar *newcontent); +void sp_document_order_changed(SPDocument *doc, SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *oldref, Inkscape::XML::Node *newref); /* Object modification root handler */ -void sp_document_request_modified(Document *doc); -gint sp_document_ensure_up_to_date(Document *doc); +void sp_document_request_modified(SPDocument *doc); +gint sp_document_ensure_up_to_date(SPDocument *doc); /* Save all previous actions to stack, as one undo step */ -void sp_document_done(Document *document, unsigned int event_type, Glib::ustring event_description); -void sp_document_maybe_done(Document *document, const gchar *keyconst, unsigned int event_type, Glib::ustring event_description); +void sp_document_done(SPDocument *document, unsigned int event_type, Glib::ustring event_description); +void sp_document_maybe_done(SPDocument *document, const gchar *keyconst, unsigned int event_type, Glib::ustring event_description); void sp_document_reset_key(Inkscape::Application *inkscape, SPDesktop *desktop, GtkObject *base); /* Cancel (and revert) current unsaved actions */ -void sp_document_cancel(Document *document); +void sp_document_cancel(SPDocument *document); /* Undo and redo */ -gboolean sp_document_undo(Document *document); -gboolean sp_document_redo(Document *document); +gboolean sp_document_undo(SPDocument *document); +gboolean sp_document_redo(SPDocument *document); /* Resource management */ -gboolean sp_document_add_resource(Document *document, const gchar *key, SPObject *object); -gboolean sp_document_remove_resource(Document *document, const gchar *key, SPObject *object); -const GSList *sp_document_get_resource_list(Document *document, const gchar *key); -sigc::connection sp_document_resources_changed_connect(Document *document, const gchar *key, Document::ResourcesChangedSignal::slot_type slot); +gboolean sp_document_add_resource(SPDocument *document, const gchar *key, SPObject *object); +gboolean sp_document_remove_resource(SPDocument *document, const gchar *key, SPObject *object); +const GSList *sp_document_get_resource_list(SPDocument *document, const gchar *key); +sigc::connection sp_document_resources_changed_connect(SPDocument *document, const gchar *key, SPDocument::ResourcesChangedSignal::slot_type slot); /* @@ -260,19 +257,19 @@ sigc::connection sp_document_resources_changed_connect(Document *document, const * Misc */ -GSList *sp_document_items_in_box(Document *document, unsigned int dkey, Geom::Rect const &box); -GSList *sp_document_partial_items_in_box(Document *document, unsigned int dkey, Geom::Rect const &box); +GSList *sp_document_items_in_box(SPDocument *document, unsigned int dkey, Geom::Rect const &box); +GSList *sp_document_partial_items_in_box(SPDocument *document, unsigned int dkey, Geom::Rect const &box); SPItem *sp_document_item_from_list_at_point_bottom(unsigned int dkey, SPGroup *group, const GSList *list, Geom::Point const p, bool take_insensitive = false); -SPItem *sp_document_item_at_point (Document *document, unsigned int key, Geom::Point const p, gboolean into_groups, SPItem *upto = NULL); -GSList *sp_document_items_at_points(Document *document, unsigned const key, std::vector points); -SPItem *sp_document_group_at_point (Document *document, unsigned int key, Geom::Point const p); +SPItem *sp_document_item_at_point (SPDocument *document, unsigned int key, Geom::Point const p, gboolean into_groups, SPItem *upto = NULL); +GSList *sp_document_items_at_points(SPDocument *document, unsigned const key, std::vector points); +SPItem *sp_document_group_at_point (SPDocument *document, unsigned int key, Geom::Point const p); -void sp_document_set_uri(Document *document, gchar const *uri); -void sp_document_change_uri_and_hrefs(Document *document, gchar const *uri); +void sp_document_set_uri(SPDocument *document, gchar const *uri); +void sp_document_change_uri_and_hrefs(SPDocument *document, gchar const *uri); -void sp_document_resized_signal_emit(Document *doc, gdouble width, gdouble height); +void sp_document_resized_signal_emit(SPDocument *doc, gdouble width, gdouble height); -unsigned int vacuum_document(Document *document); +unsigned int vacuum_document(SPDocument *document); #endif diff --git a/src/doxygen-main.cpp b/src/doxygen-main.cpp index 47ef14987..fd8f4bb1a 100644 --- a/src/doxygen-main.cpp +++ b/src/doxygen-main.cpp @@ -288,7 +288,7 @@ namespace XML {} * - SPSVGView [\ref svg-view.cpp, \ref svg-view.h] * * SPDesktopWidget [\ref desktop-widget.h] SPSVGSPViewWidget [\ref svg-view.cpp] - * Document [\ref document.cpp, \ref document.h] + * SPDocument [\ref document.cpp, \ref document.h] * * SPDrawAnchor [\ref draw-anchor.cpp, \ref draw-anchor.h] * SPKnot [\ref knot.cpp, \ref knot.h, \ref knot-enums.h] diff --git a/src/draw-context.cpp b/src/draw-context.cpp index 89c2c454e..d2794f0c2 100644 --- a/src/draw-context.cpp +++ b/src/draw-context.cpp @@ -1,4 +1,4 @@ -#define __DRAW_CONTEXT_C__ +#define __SP_DRAW_CONTEXT_C__ /* * Generic drawing context @@ -664,7 +664,7 @@ spdc_flush_white(SPDrawContext *dc, SPCurve *gc) : SP_EVENT_CONTEXT_DESKTOP(dc)->dt2doc() ); SPDesktop *desktop = SP_EVENT_CONTEXT_DESKTOP(dc); - Document *doc = sp_desktop_document(desktop); + SPDocument *doc = sp_desktop_document(desktop); Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc); if ( c && !c->is_empty() ) { diff --git a/src/event-log.cpp b/src/event-log.cpp index d111c43e1..82de44696 100644 --- a/src/event-log.cpp +++ b/src/event-log.cpp @@ -19,7 +19,7 @@ namespace Inkscape { -EventLog::EventLog(Document* document) : +EventLog::EventLog(SPDocument* document) : UndoStackObserver(), _connected (false), _document (document), diff --git a/src/event-log.h b/src/event-log.h index bb17a19a4..9fcd01e1c 100644 --- a/src/event-log.h +++ b/src/event-log.h @@ -44,7 +44,7 @@ public: typedef Gtk::TreeModel::iterator iterator; typedef Gtk::TreeModel::const_iterator const_iterator; - EventLog(Document* document); + EventLog(SPDocument* document); virtual ~EventLog(); /** @@ -115,7 +115,7 @@ public: private: bool _connected; //< connected with dialog - Document *_document; //< document that is logged + SPDocument *_document; //< document that is logged const EventModelColumns _columns; diff --git a/src/extension/effect.cpp b/src/extension/effect.cpp index c6b731a84..afc0668a9 100644 --- a/src/extension/effect.cpp +++ b/src/extension/effect.cpp @@ -358,7 +358,7 @@ void Effect::EffectVerb::perform( SPAction *action, void * data, void */*pdata*/ ) { Inkscape::UI::View::View * current_view = sp_action_get_view(action); -// Document * current_document = current_view->doc; +// SPDocument * current_document = current_view->doc; Effect::EffectVerb * ev = reinterpret_cast(data); Effect * effect = ev->_effect; diff --git a/src/extension/effect.h b/src/extension/effect.h index 637d29c5c..c02ce542b 100644 --- a/src/extension/effect.h +++ b/src/extension/effect.h @@ -21,7 +21,7 @@ #include "prefdialog.h" #include "extension.h" -struct Document; +struct SPDocument; namespace Inkscape { namespace UI { diff --git a/src/extension/execution-env.cpp b/src/extension/execution-env.cpp index a87cc6b64..4a13890d7 100644 --- a/src/extension/execution-env.cpp +++ b/src/extension/execution-env.cpp @@ -179,7 +179,7 @@ ExecutionEnv::commit (void) { void ExecutionEnv::reselect (void) { if (_doc == NULL) { return; } - Document * doc = _doc->doc(); + SPDocument * doc = _doc->doc(); if (doc == NULL) { return; } SPDesktop *desktop = (SPDesktop *)_doc; diff --git a/src/extension/extension.cpp b/src/extension/extension.cpp index c8dc30d8b..52d5f5148 100644 --- a/src/extension/extension.cpp +++ b/src/extension/extension.cpp @@ -423,7 +423,7 @@ param_shared (const gchar * name, GSList * list) found parameter. */ const gchar * -Extension::get_param_string (const gchar * name, const Document * doc, const Inkscape::XML::Node * node) +Extension::get_param_string (const gchar * name, const SPDocument * doc, const Inkscape::XML::Node * node) { Parameter * param; @@ -432,7 +432,7 @@ Extension::get_param_string (const gchar * name, const Document * doc, const Ink } const gchar * -Extension::get_param_enum (const gchar * name, const Document * doc, const Inkscape::XML::Node * node) +Extension::get_param_enum (const gchar * name, const SPDocument * doc, const Inkscape::XML::Node * node) { Parameter* param = param_shared(name, parameters); return param->get_enum(doc, node); @@ -450,7 +450,7 @@ Extension::get_param_enum (const gchar * name, const Document * doc, const Inksc found parameter. */ bool -Extension::get_param_bool (const gchar * name, const Document * doc, const Inkscape::XML::Node * node) +Extension::get_param_bool (const gchar * name, const SPDocument * doc, const Inkscape::XML::Node * node) { Parameter * param; @@ -470,7 +470,7 @@ Extension::get_param_bool (const gchar * name, const Document * doc, const Inksc found parameter. */ int -Extension::get_param_int (const gchar * name, const Document * doc, const Inkscape::XML::Node * node) +Extension::get_param_int (const gchar * name, const SPDocument * doc, const Inkscape::XML::Node * node) { Parameter * param; @@ -490,7 +490,7 @@ Extension::get_param_int (const gchar * name, const Document * doc, const Inksca found parameter. */ float -Extension::get_param_float (const gchar * name, const Document * doc, const Inkscape::XML::Node * node) +Extension::get_param_float (const gchar * name, const SPDocument * doc, const Inkscape::XML::Node * node) { Parameter * param; param = param_shared(name, parameters); @@ -509,7 +509,7 @@ Extension::get_param_float (const gchar * name, const Document * doc, const Inks found parameter. */ guint32 -Extension::get_param_color (const gchar * name, const Document * doc, const Inkscape::XML::Node * node) +Extension::get_param_color (const gchar * name, const SPDocument * doc, const Inkscape::XML::Node * node) { Parameter* param = param_shared(name, parameters); return param->get_color(doc, node); @@ -528,7 +528,7 @@ Extension::get_param_color (const gchar * name, const Document * doc, const Inks found parameter. */ bool -Extension::set_param_bool (const gchar * name, bool value, Document * doc, Inkscape::XML::Node * node) +Extension::set_param_bool (const gchar * name, bool value, SPDocument * doc, Inkscape::XML::Node * node) { Parameter * param; param = param_shared(name, parameters); @@ -548,7 +548,7 @@ Extension::set_param_bool (const gchar * name, bool value, Document * doc, Inksc found parameter. */ int -Extension::set_param_int (const gchar * name, int value, Document * doc, Inkscape::XML::Node * node) +Extension::set_param_int (const gchar * name, int value, SPDocument * doc, Inkscape::XML::Node * node) { Parameter * param; param = param_shared(name, parameters); @@ -568,7 +568,7 @@ Extension::set_param_int (const gchar * name, int value, Document * doc, Inkscap found parameter. */ float -Extension::set_param_float (const gchar * name, float value, Document * doc, Inkscape::XML::Node * node) +Extension::set_param_float (const gchar * name, float value, SPDocument * doc, Inkscape::XML::Node * node) { Parameter * param; param = param_shared(name, parameters); @@ -588,7 +588,7 @@ Extension::set_param_float (const gchar * name, float value, Document * doc, Ink found parameter. */ const gchar * -Extension::set_param_string (const gchar * name, const gchar * value, Document * doc, Inkscape::XML::Node * node) +Extension::set_param_string (const gchar * name, const gchar * value, SPDocument * doc, Inkscape::XML::Node * node) { Parameter * param; param = param_shared(name, parameters); @@ -608,7 +608,7 @@ Extension::set_param_string (const gchar * name, const gchar * value, Document * found parameter. */ guint32 -Extension::set_param_color (const gchar * name, guint32 color, Document * doc, Inkscape::XML::Node * node) +Extension::set_param_color (const gchar * name, guint32 color, SPDocument * doc, Inkscape::XML::Node * node) { Parameter* param = param_shared(name, parameters); return param->set_color(color, doc, node); @@ -671,7 +671,7 @@ public: If all parameters are gui_visible = false NULL is returned as well. */ Gtk::Widget * -Extension::autogui (Document * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) +Extension::autogui (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) { if (param_visible_count() == 0) return NULL; diff --git a/src/extension/extension.h b/src/extension/extension.h index 8dcd1b393..48ca86cf7 100644 --- a/src/extension/extension.h +++ b/src/extension/extension.h @@ -72,7 +72,7 @@ #define INKSCAPE_EXTENSION_NS_NC "extension" #define INKSCAPE_EXTENSION_NS "extension:" -struct Document; +struct SPDocument; namespace Inkscape { namespace Extension { @@ -173,42 +173,42 @@ private: #endif public: bool get_param_bool (const gchar * name, - const Document * doc = NULL, + const SPDocument * doc = NULL, const Inkscape::XML::Node * node = NULL); int get_param_int (const gchar * name, - const Document * doc = NULL, + const SPDocument * doc = NULL, const Inkscape::XML::Node * node = NULL); float get_param_float (const gchar * name, - const Document * doc = NULL, + const SPDocument * doc = NULL, const Inkscape::XML::Node * node = NULL); const gchar * get_param_string (const gchar * name, - const Document * doc = NULL, + const SPDocument * doc = NULL, const Inkscape::XML::Node * node = NULL); guint32 get_param_color (const gchar * name, - const Document * doc = NULL, + const SPDocument * doc = NULL, const Inkscape::XML::Node * node = NULL); const gchar * get_param_enum (const gchar * name, - const Document * doc = NULL, + const SPDocument * doc = NULL, const Inkscape::XML::Node * node = NULL); bool set_param_bool (const gchar * name, bool value, - Document * doc = NULL, + SPDocument * doc = NULL, Inkscape::XML::Node * node = NULL); int set_param_int (const gchar * name, int value, - Document * doc = NULL, + SPDocument * doc = NULL, Inkscape::XML::Node * node = NULL); float set_param_float (const gchar * name, float value, - Document * doc = NULL, + SPDocument * doc = NULL, Inkscape::XML::Node * node = NULL); const gchar * set_param_string (const gchar * name, const gchar * value, - Document * doc = NULL, + SPDocument * doc = NULL, Inkscape::XML::Node * node = NULL); guint32 set_param_color (const gchar * name, guint32 color, - Document * doc = NULL, + SPDocument * doc = NULL, Inkscape::XML::Node * node = NULL); /* Error file handling */ @@ -217,7 +217,7 @@ public: static void error_file_close (void); public: - Gtk::Widget * autogui (Document * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal = NULL); + Gtk::Widget * autogui (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal = NULL); void paramListString (std::list & retlist); /* Extension editor dialog stuff */ diff --git a/src/extension/implementation/implementation.cpp b/src/extension/implementation/implementation.cpp index e3421b26d..6090b72d0 100644 --- a/src/extension/implementation/implementation.cpp +++ b/src/extension/implementation/implementation.cpp @@ -79,7 +79,7 @@ Implementation::prefs_input(Inkscape::Extension::Input *module, gchar const */*f return module->autogui(NULL, NULL); } /* Implementation::prefs_input */ -Document * +SPDocument * Implementation::open(Inkscape::Extension::Input */*module*/, gchar const */*filename*/) { /* throw open_failed(); */ return NULL; @@ -91,7 +91,7 @@ Implementation::prefs_output(Inkscape::Extension::Output *module) { } /* Implementation::prefs_output */ void -Implementation::save(Inkscape::Extension::Output */*module*/, Document */*doc*/, gchar const */*filename*/) { +Implementation::save(Inkscape::Extension::Output */*module*/, SPDocument */*doc*/, gchar const */*filename*/) { /* throw save_fail */ return; } /* Implementation::save */ @@ -100,7 +100,7 @@ Gtk::Widget * Implementation::prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View * view, sigc::signal * changeSignal, ImplementationDocumentCache * docCache) { if (module->param_visible_count() == 0) return NULL; - Document * current_document = view->doc(); + SPDocument * current_document = view->doc(); using Inkscape::Util::GSListConstIterator; GSListConstIterator selected = @@ -134,7 +134,7 @@ Implementation::set_preview(Inkscape::Extension::Print */*module*/) unsigned int -Implementation::begin(Inkscape::Extension::Print */*module*/, Document */*doc*/) +Implementation::begin(Inkscape::Extension::Print */*module*/, SPDocument */*doc*/) { return 0; } diff --git a/src/extension/implementation/implementation.h b/src/extension/implementation/implementation.h index 9f1894d95..9de70dce7 100644 --- a/src/extension/implementation/implementation.h +++ b/src/extension/implementation/implementation.h @@ -70,13 +70,13 @@ public: virtual Gtk::Widget *prefs_input(Inkscape::Extension::Input *module, gchar const *filename); - virtual Document *open(Inkscape::Extension::Input *module, + virtual SPDocument *open(Inkscape::Extension::Input *module, gchar const *filename); /* ----- Output functions ----- */ /** Find out information about the file. */ virtual Gtk::Widget *prefs_output(Inkscape::Extension::Output *module); - virtual void save(Inkscape::Extension::Output *module, Document *doc, gchar const *filename); + virtual void save(Inkscape::Extension::Output *module, SPDocument *doc, gchar const *filename); /* ----- Effect functions ----- */ /** Find out information about the file. */ @@ -93,7 +93,7 @@ public: virtual unsigned set_preview(Inkscape::Extension::Print *module); virtual unsigned begin(Inkscape::Extension::Print *module, - Document *doc); + SPDocument *doc); virtual unsigned finish(Inkscape::Extension::Print *module); virtual bool textToPath(Inkscape::Extension::Print *ext); virtual bool fontEmbedded(Inkscape::Extension::Print * ext); diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp index d207c1a19..e6ce40bc0 100644 --- a/src/extension/implementation/script.cpp +++ b/src/extension/implementation/script.cpp @@ -545,7 +545,7 @@ Script::prefs_output(Inkscape::Extension::Output *module) the incoming filename (so that it's not the temporary filename). That document is then returned from this function. */ -Document * +SPDocument * Script::open(Inkscape::Extension::Input *module, const gchar *filenameArg) { @@ -567,7 +567,7 @@ Script::open(Inkscape::Extension::Input *module, int data_read = execute(command, params, lfilename, fileout); fileout.toFile(tempfilename_out); - Document * mydoc = NULL; + SPDocument * mydoc = NULL; if (data_read > 10) { if (helper_extension.size()==0) { mydoc = Inkscape::Extension::open( @@ -623,7 +623,7 @@ Script::open(Inkscape::Extension::Input *module, */ void Script::save(Inkscape::Extension::Output *module, - Document *doc, + SPDocument *doc, const gchar *filenameArg) { std::list params; @@ -757,7 +757,7 @@ Script::effect(Inkscape::Extension::Effect *module, pump_events(); - Document * mydoc = NULL; + SPDocument * mydoc = NULL; if (data_read > 10) { mydoc = Inkscape::Extension::open( Inkscape::Extension::db.get(SP_MODULE_KEY_INPUT_SVG), diff --git a/src/extension/implementation/script.h b/src/extension/implementation/script.h index 0769c9a18..8e25fb351 100644 --- a/src/extension/implementation/script.h +++ b/src/extension/implementation/script.h @@ -73,7 +73,7 @@ public: /** * */ - virtual Document *open(Inkscape::Extension::Input *module, + virtual SPDocument *open(Inkscape::Extension::Input *module, gchar const *filename); /** @@ -85,7 +85,7 @@ public: * */ virtual void save(Inkscape::Extension::Output *module, - Document *doc, + SPDocument *doc, gchar const *filename); /** diff --git a/src/extension/implementation/xslt.cpp b/src/extension/implementation/xslt.cpp index 9eea2dbeb..f34fea64a 100644 --- a/src/extension/implementation/xslt.cpp +++ b/src/extension/implementation/xslt.cpp @@ -136,7 +136,7 @@ XSLT::unload(Inkscape::Extension::Extension *module) return; } -Document * +SPDocument * XSLT::open(Inkscape::Extension::Input */*module*/, gchar const *filename) { xmlDocPtr filein = xmlParseFile(filename); @@ -174,7 +174,7 @@ XSLT::open(Inkscape::Extension::Input */*module*/, gchar const *filename) } g_free(s); - Document * doc = sp_document_create(rdoc, filename, base, name, true); + SPDocument * doc = sp_document_create(rdoc, filename, base, name, true); g_free(base); g_free(name); @@ -182,7 +182,7 @@ XSLT::open(Inkscape::Extension::Input */*module*/, gchar const *filename) } void -XSLT::save(Inkscape::Extension::Output */*module*/, Document *doc, gchar const *filename) +XSLT::save(Inkscape::Extension::Output */*module*/, SPDocument *doc, gchar const *filename) { /* TODO: Should we assume filename to be in utf8 or to be a raw filename? * See JavaFXOutput::save for discussion. */ diff --git a/src/extension/implementation/xslt.h b/src/extension/implementation/xslt.h index df9467d9e..45befb529 100644 --- a/src/extension/implementation/xslt.h +++ b/src/extension/implementation/xslt.h @@ -44,9 +44,9 @@ public: bool check(Inkscape::Extension::Extension *module); - Document *open(Inkscape::Extension::Input *module, + SPDocument *open(Inkscape::Extension::Input *module, gchar const *filename); - void save(Inkscape::Extension::Output *module, Document *doc, gchar const *filename); + void save(Inkscape::Extension::Output *module, SPDocument *doc, gchar const *filename); }; } /* Inkscape */ diff --git a/src/extension/input.cpp b/src/extension/input.cpp index ca5fdc29f..689c1286f 100644 --- a/src/extension/input.cpp +++ b/src/extension/input.cpp @@ -145,7 +145,7 @@ Input::check (void) Adobe Illustrator file can be transparent (not recommended, but transparent). This is all done with undo being turned off. */ -Document * +SPDocument * Input::open (const gchar *uri) { if (!loaded()) { @@ -156,7 +156,7 @@ Input::open (const gchar *uri) } timer->touch(); - Document *const doc = imp->open(this, uri); + SPDocument *const doc = imp->open(this, uri); if (doc != NULL) { Inkscape::XML::Node * repr = sp_document_repr_root(doc); bool saved = sp_document_get_undo_sensitive(doc); diff --git a/src/extension/input.h b/src/extension/input.h index d2aac9376..55d807ce2 100644 --- a/src/extension/input.h +++ b/src/extension/input.h @@ -37,7 +37,7 @@ public: Implementation::Implementation * in_imp); virtual ~Input (void); virtual bool check (void); - Document * open (gchar const *uri); + SPDocument * open (gchar const *uri); gchar * get_mimetype (void); gchar * get_extension (void); gchar * get_filetypename (void); diff --git a/src/extension/internal/bitmap/imagemagick.cpp b/src/extension/internal/bitmap/imagemagick.cpp index 75d53927d..e907612fd 100644 --- a/src/extension/internal/bitmap/imagemagick.cpp +++ b/src/extension/internal/bitmap/imagemagick.cpp @@ -221,7 +221,7 @@ ImageMagick::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::Vi Gtk::Widget * ImageMagick::prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View * view, sigc::signal * changeSignal, Inkscape::Extension::Implementation::ImplementationDocumentCache * /*docCache*/) { - Document * current_document = view->doc(); + SPDocument * current_document = view->doc(); using Inkscape::Util::GSListConstIterator; GSListConstIterator selected = sp_desktop_selection((SPDesktop *)view)->itemList(); diff --git a/src/extension/internal/cairo-png-out.cpp b/src/extension/internal/cairo-png-out.cpp index d849755b7..c81fdd029 100644 --- a/src/extension/internal/cairo-png-out.cpp +++ b/src/extension/internal/cairo-png-out.cpp @@ -48,7 +48,7 @@ CairoRendererOutput::check (Inkscape::Extension::Extension * module) } static bool -png_render_document_to_file(Document *doc, gchar const *filename) +png_render_document_to_file(SPDocument *doc, gchar const *filename) { CairoRenderer *renderer; CairoRenderContext *ctx; @@ -92,7 +92,7 @@ png_render_document_to_file(Document *doc, gchar const *filename) \param uri Filename to save to (probably will end in .png) */ void -CairoRendererOutput::save(Inkscape::Extension::Output *mod, Document *doc, gchar const *filename) +CairoRendererOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *filename) { if (!png_render_document_to_file(doc, filename)) throw Inkscape::Extension::Output::save_failed(); diff --git a/src/extension/internal/cairo-png-out.h b/src/extension/internal/cairo-png-out.h index a062ec8df..9b9bd6ffe 100644 --- a/src/extension/internal/cairo-png-out.h +++ b/src/extension/internal/cairo-png-out.h @@ -27,7 +27,7 @@ class CairoRendererOutput : Inkscape::Extension::Implementation::Implementation public: bool check(Inkscape::Extension::Extension *module); void save(Inkscape::Extension::Output *mod, - Document *doc, + SPDocument *doc, gchar const *filename); static void init(); }; diff --git a/src/extension/internal/cairo-ps-out.cpp b/src/extension/internal/cairo-ps-out.cpp index d9cac666c..dff89c1ed 100644 --- a/src/extension/internal/cairo-ps-out.cpp +++ b/src/extension/internal/cairo-ps-out.cpp @@ -61,7 +61,7 @@ CairoEpsOutput::check (Inkscape::Extension::Extension * module) } static bool -ps_print_document_to_file(Document *doc, gchar const *filename, unsigned int level, bool texttopath, bool filtertobitmap, int resolution, const gchar * const exportId, bool exportDrawing, bool exportCanvas, bool eps = false) +ps_print_document_to_file(SPDocument *doc, gchar const *filename, unsigned int level, bool texttopath, bool filtertobitmap, int resolution, const gchar * const exportId, bool exportDrawing, bool exportCanvas, bool eps = false) { sp_document_ensure_up_to_date(doc); @@ -124,7 +124,7 @@ ps_print_document_to_file(Document *doc, gchar const *filename, unsigned int lev \param filename Filename to save to (probably will end in .ps) */ void -CairoPsOutput::save(Inkscape::Extension::Output *mod, Document *doc, gchar const *filename) +CairoPsOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *filename) { Inkscape::Extension::Extension * ext; unsigned int ret; @@ -188,7 +188,7 @@ CairoPsOutput::save(Inkscape::Extension::Output *mod, Document *doc, gchar const \param filename Filename to save to (probably will end in .ps) */ void -CairoEpsOutput::save(Inkscape::Extension::Output *mod, Document *doc, gchar const *filename) +CairoEpsOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *filename) { Inkscape::Extension::Extension * ext; unsigned int ret; diff --git a/src/extension/internal/cairo-ps-out.h b/src/extension/internal/cairo-ps-out.h index 862571f0b..019b6b810 100644 --- a/src/extension/internal/cairo-ps-out.h +++ b/src/extension/internal/cairo-ps-out.h @@ -28,7 +28,7 @@ class CairoPsOutput : Inkscape::Extension::Implementation::Implementation { public: bool check(Inkscape::Extension::Extension *module); void save(Inkscape::Extension::Output *mod, - Document *doc, + SPDocument *doc, gchar const *filename); static void init(); bool textToPath(Inkscape::Extension::Print *ext); @@ -40,7 +40,7 @@ class CairoEpsOutput : Inkscape::Extension::Implementation::Implementation { public: bool check(Inkscape::Extension::Extension *module); void save(Inkscape::Extension::Output *mod, - Document *doc, + SPDocument *doc, gchar const *uri); static void init(); bool textToPath(Inkscape::Extension::Print *ext); diff --git a/src/extension/internal/cairo-render-context.cpp b/src/extension/internal/cairo-render-context.cpp index 28cf406f2..d1462e52e 100644 --- a/src/extension/internal/cairo-render-context.cpp +++ b/src/extension/internal/cairo-render-context.cpp @@ -811,7 +811,7 @@ CairoRenderContext::_finishSurfaceSetup(cairo_surface_t *surface, cairo_matrix_t cairo_scale(_cr, PT_PER_PX, PT_PER_PX); } else if (cairo_surface_get_content(_surface) != CAIRO_CONTENT_ALPHA) { // set background color on non-alpha surfaces - // TODO: bgcolor should be derived from Document + // TODO: bgcolor should be derived from SPDocument cairo_set_source_rgb(_cr, 1.0, 1.0, 1.0); cairo_rectangle(_cr, 0, 0, _width, _height); cairo_fill(_cr); diff --git a/src/extension/internal/cairo-renderer-pdf-out.cpp b/src/extension/internal/cairo-renderer-pdf-out.cpp index 1e5404c50..b44e83449 100644 --- a/src/extension/internal/cairo-renderer-pdf-out.cpp +++ b/src/extension/internal/cairo-renderer-pdf-out.cpp @@ -47,7 +47,7 @@ CairoRendererPdfOutput::check (Inkscape::Extension::Extension * module) } static bool -pdf_render_document_to_file(Document *doc, gchar const *filename, unsigned int level, +pdf_render_document_to_file(SPDocument *doc, gchar const *filename, unsigned int level, bool texttopath, bool filtertobitmap, int resolution, const gchar * const exportId, bool exportDrawing, bool exportCanvas) { @@ -118,7 +118,7 @@ pdf_render_document_to_file(Document *doc, gchar const *filename, unsigned int l tell the printing system to save to file. */ void -CairoRendererPdfOutput::save(Inkscape::Extension::Output *mod, Document *doc, gchar const *filename) +CairoRendererPdfOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *filename) { Inkscape::Extension::Extension * ext; unsigned int ret; diff --git a/src/extension/internal/cairo-renderer-pdf-out.h b/src/extension/internal/cairo-renderer-pdf-out.h index f916eed49..d76ffb4d4 100644 --- a/src/extension/internal/cairo-renderer-pdf-out.h +++ b/src/extension/internal/cairo-renderer-pdf-out.h @@ -27,7 +27,7 @@ class CairoRendererPdfOutput : Inkscape::Extension::Implementation::Implementati public: bool check(Inkscape::Extension::Extension *module); void save(Inkscape::Extension::Output *mod, - Document *doc, + SPDocument *doc, gchar const *filename); static void init(); }; diff --git a/src/extension/internal/cairo-renderer.cpp b/src/extension/internal/cairo-renderer.cpp index 3414993e5..da88a5eae 100644 --- a/src/extension/internal/cairo-renderer.cpp +++ b/src/extension/internal/cairo-renderer.cpp @@ -460,7 +460,7 @@ static void sp_asbitmap_render(SPItem *item, CairoRenderContext *ctx) Geom::Matrix t = t_on_document * t_item.inverse(); // Do the export - Document *document = SP_OBJECT(item)->document; + SPDocument *document = SP_OBJECT(item)->document; GSList *items = NULL; items = g_slist_append(items, item); @@ -567,7 +567,7 @@ CairoRenderer::renderItem(CairoRenderContext *ctx, SPItem *item) } bool -CairoRenderer::setupDocument(CairoRenderContext *ctx, Document *doc, bool pageBoundingBox, SPItem *base) +CairoRenderer::setupDocument(CairoRenderContext *ctx, SPDocument *doc, bool pageBoundingBox, SPItem *base) { g_assert( ctx != NULL ); diff --git a/src/extension/internal/cairo-renderer.h b/src/extension/internal/cairo-renderer.h index 4197c6784..ab5d4cf58 100644 --- a/src/extension/internal/cairo-renderer.h +++ b/src/extension/internal/cairo-renderer.h @@ -50,9 +50,9 @@ public: void applyMask(CairoRenderContext *ctx, SPMask const *mask); /** Initializes the CairoRenderContext according to the specified - Document. A set*Target function can only be called on the context + SPDocument. A set*Target function can only be called on the context before setupDocument. */ - bool setupDocument(CairoRenderContext *ctx, Document *doc, bool pageBoundingBox, SPItem *base); + bool setupDocument(CairoRenderContext *ctx, SPDocument *doc, bool pageBoundingBox, SPItem *base); /** Traverses the object tree and invokes the render methods. */ void renderItem(CairoRenderContext *ctx, SPItem *item); diff --git a/src/extension/internal/emf-win32-inout.cpp b/src/extension/internal/emf-win32-inout.cpp index ffba5af81..f400a3649 100644 --- a/src/extension/internal/emf-win32-inout.cpp +++ b/src/extension/internal/emf-win32-inout.cpp @@ -101,7 +101,7 @@ EmfWin32::check (Inkscape::Extension::Extension * /*module*/) static void -emf_print_document_to_file(Document *doc, gchar const *filename) +emf_print_document_to_file(SPDocument *doc, gchar const *filename) { Inkscape::Extension::Print *mod; SPPrintContext context; @@ -147,7 +147,7 @@ emf_print_document_to_file(Document *doc, gchar const *filename) void -EmfWin32::save(Inkscape::Extension::Output *mod, Document *doc, gchar const *filename) +EmfWin32::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *filename) { Inkscape::Extension::Extension * ext; @@ -2162,7 +2162,7 @@ typedef struct #pragma pack( pop ) -Document * +SPDocument * EmfWin32::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri ) { EMF_CALLBACK_DATA d; @@ -2365,7 +2365,7 @@ EmfWin32::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri ) // std::cout << "SVG Output: " << std::endl << *(d.outsvg) << std::endl; - Document *doc = sp_document_new_from_mem(d.outsvg->c_str(), d.outsvg->length(), TRUE); + SPDocument *doc = sp_document_new_from_mem(d.outsvg->c_str(), d.outsvg->length(), TRUE); delete d.outsvg; delete d.path; diff --git a/src/extension/internal/emf-win32-inout.h b/src/extension/internal/emf-win32-inout.h index 544cd75db..c62d7a4e9 100644 --- a/src/extension/internal/emf-win32-inout.h +++ b/src/extension/internal/emf-win32-inout.h @@ -28,10 +28,10 @@ public: bool check(Inkscape::Extension::Extension *module); //Can this module load (always yes for now) void save(Inkscape::Extension::Output *mod, // Save the given document to the given filename - Document *doc, + SPDocument *doc, gchar const *filename); - virtual Document *open( Inkscape::Extension::Input *mod, + virtual SPDocument *open( Inkscape::Extension::Input *mod, const gchar *uri ); static void init(void);//Initialize the class diff --git a/src/extension/internal/emf-win32-print.cpp b/src/extension/internal/emf-win32-print.cpp index 822a0577b..d098f6466 100644 --- a/src/extension/internal/emf-win32-print.cpp +++ b/src/extension/internal/emf-win32-print.cpp @@ -116,7 +116,7 @@ PrintEmfWin32::setup (Inkscape::Extension::Print * /*mod*/) unsigned int -PrintEmfWin32::begin (Inkscape::Extension::Print *mod, Document *doc) +PrintEmfWin32::begin (Inkscape::Extension::Print *mod, SPDocument *doc) { gchar const *utf8_fn = mod->get_param_string("destination"); diff --git a/src/extension/internal/emf-win32-print.h b/src/extension/internal/emf-win32-print.h index bec3f9582..5c1d8439d 100644 --- a/src/extension/internal/emf-win32-print.h +++ b/src/extension/internal/emf-win32-print.h @@ -55,7 +55,7 @@ public: /* Print functions */ virtual unsigned int setup (Inkscape::Extension::Print * module); - virtual unsigned int begin (Inkscape::Extension::Print * module, Document *doc); + virtual unsigned int begin (Inkscape::Extension::Print * module, SPDocument *doc); virtual unsigned int finish (Inkscape::Extension::Print * module); /* Rendering methods */ diff --git a/src/extension/internal/gdkpixbuf-input.cpp b/src/extension/internal/gdkpixbuf-input.cpp index 2aea1cc64..64a099c8a 100644 --- a/src/extension/internal/gdkpixbuf-input.cpp +++ b/src/extension/internal/gdkpixbuf-input.cpp @@ -16,10 +16,10 @@ GdkPixbuf* pixbuf_new_from_file( char const *utf8name, GError **error ); namespace Extension { namespace Internal { -Document * +SPDocument * GdkpixbufInput::open(Inkscape::Extension::Input */*mod*/, char const *uri) { - Document *doc = NULL; + SPDocument *doc = NULL; GdkPixbuf *pb = Inkscape::IO::pixbuf_new_from_file( uri, NULL ); if (pb) { /* We are readable */ diff --git a/src/extension/internal/gdkpixbuf-input.h b/src/extension/internal/gdkpixbuf-input.h index 373d53da3..9d5e6ccf7 100644 --- a/src/extension/internal/gdkpixbuf-input.h +++ b/src/extension/internal/gdkpixbuf-input.h @@ -9,7 +9,7 @@ namespace Internal { class GdkpixbufInput : Inkscape::Extension::Implementation::Implementation { public: - Document *open(Inkscape::Extension::Input *mod, + SPDocument *open(Inkscape::Extension::Input *mod, gchar const *uri); static void init(); }; diff --git a/src/extension/internal/gimpgrad.cpp b/src/extension/internal/gimpgrad.cpp index 9510b5ebd..5b3e0c16e 100644 --- a/src/extension/internal/gimpgrad.cpp +++ b/src/extension/internal/gimpgrad.cpp @@ -95,7 +95,7 @@ stop_svg(ColorRGBA const in_color, double const location) } /** - \brief Actually open the gradient and turn it into an Document + \brief Actually open the gradient and turn it into an SPDocument \param module The input module being used \param filename The filename of the gradient to be opened \return A Document with the gradient in it. @@ -129,7 +129,7 @@ stop_svg(ColorRGBA const in_color, double const location) document using the \c sp_document_from_mem. That is then returned to Inkscape. */ -Document * +SPDocument * GimpGrad::open (Inkscape::Extension::Input */*module*/, gchar const *filename) { Inkscape::IO::dump_fopen_call(filename, "I"); diff --git a/src/extension/internal/gimpgrad.h b/src/extension/internal/gimpgrad.h index 21ccfa215..45b76dd6d 100644 --- a/src/extension/internal/gimpgrad.h +++ b/src/extension/internal/gimpgrad.h @@ -26,7 +26,7 @@ class GimpGrad : public Inkscape::Extension::Implementation::Implementation { public: bool load(Inkscape::Extension::Extension *module); void unload(Inkscape::Extension::Extension *module); - Document *open(Inkscape::Extension::Input *module, gchar const *filename); + SPDocument *open(Inkscape::Extension::Input *module, gchar const *filename); static void init(); }; diff --git a/src/extension/internal/grid.cpp b/src/extension/internal/grid.cpp index 5a0523ba8..d4b35b261 100644 --- a/src/extension/internal/grid.cpp +++ b/src/extension/internal/grid.cpp @@ -81,7 +81,7 @@ Grid::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View *doc Geom::Rect bounding_area = Geom::Rect(Geom::Point(0,0), Geom::Point(100,100)); if (selection->isEmpty()) { /* get page size */ - Document * doc = document->doc(); + SPDocument * doc = document->doc(); bounding_area = Geom::Rect( Geom::Point(0,0), Geom::Point(sp_document_width(doc), sp_document_height(doc)) ); } else { @@ -171,7 +171,7 @@ PrefAdjustment::val_changed (void) Gtk::Widget * Grid::prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View * view, sigc::signal * changeSignal, Inkscape::Extension::Implementation::ImplementationDocumentCache * /*docCache*/) { - Document * current_document = view->doc(); + SPDocument * current_document = view->doc(); using Inkscape::Util::GSListConstIterator; GSListConstIterator selected = sp_desktop_selection((SPDesktop *)view)->itemList(); diff --git a/src/extension/internal/javafx-out.cpp b/src/extension/internal/javafx-out.cpp index c1f057071..417755e19 100644 --- a/src/extension/internal/javafx-out.cpp +++ b/src/extension/internal/javafx-out.cpp @@ -701,7 +701,7 @@ bool JavaFXOutput::doCurve(SPItem *item, const String &id) /** * Output the tree data to buffer */ -bool JavaFXOutput::doTreeRecursive(Document *doc, SPObject *obj) +bool JavaFXOutput::doTreeRecursive(SPDocument *doc, SPObject *obj) { /** * Check the type of node and process @@ -749,7 +749,7 @@ bool JavaFXOutput::doTreeRecursive(Document *doc, SPObject *obj) /** * Output the curve data to buffer */ -bool JavaFXOutput::doTree(Document *doc) +bool JavaFXOutput::doTree(SPDocument *doc) { double bignum = 1000000.0; @@ -767,7 +767,7 @@ bool JavaFXOutput::doTree(Document *doc) } -bool JavaFXOutput::doBody(Document *doc, SPObject *obj) +bool JavaFXOutput::doBody(SPDocument *doc, SPObject *obj) { /** * Check the type of node and process @@ -842,7 +842,7 @@ void JavaFXOutput::reset() /** * Saves the of an Inkscape SVG file as JavaFX spline definitions */ -bool JavaFXOutput::saveDocument(Document *doc, gchar const *filename_utf8) +bool JavaFXOutput::saveDocument(SPDocument *doc, gchar const *filename_utf8) { reset(); @@ -918,7 +918,7 @@ bool JavaFXOutput::saveDocument(Document *doc, gchar const *filename_utf8) */ void JavaFXOutput::save(Inkscape::Extension::Output */*mod*/, - Document *doc, gchar const *filename_utf8) + SPDocument *doc, gchar const *filename_utf8) { /* N.B. The name `filename_utf8' represents the fact that we want it to be in utf8; whereas in * fact we know that some callers of Extension::save pass something in the filesystem's diff --git a/src/extension/internal/javafx-out.h b/src/extension/internal/javafx-out.h index 246172c23..9c1c8778b 100644 --- a/src/extension/internal/javafx-out.h +++ b/src/extension/internal/javafx-out.h @@ -56,7 +56,7 @@ public: * API call to perform the output to a file */ virtual void save(Inkscape::Extension::Output *mod, - Document *doc, gchar const *filename); + SPDocument *doc, gchar const *filename); /** * Inkscape runtime startup call. @@ -109,10 +109,10 @@ private: * Output the SVG document's curve data as JavaFX geometry types */ bool doCurve(SPItem *item, const String &id); - bool doTreeRecursive(Document *doc, SPObject *obj); - bool doTree(Document *doc); + bool doTreeRecursive(SPDocument *doc, SPObject *obj); + bool doTree(SPDocument *doc); - bool doBody(Document *doc, SPObject *obj); + bool doBody(SPDocument *doc, SPObject *obj); /** * Output the file footer @@ -124,7 +124,7 @@ private: /** * Actual method to save document */ - bool saveDocument(Document *doc, gchar const *filename); + bool saveDocument(SPDocument *doc, gchar const *filename); //For statistics int nrNodes; diff --git a/src/extension/internal/latex-pstricks-out.cpp b/src/extension/internal/latex-pstricks-out.cpp index 924f9697e..4a469a750 100644 --- a/src/extension/internal/latex-pstricks-out.cpp +++ b/src/extension/internal/latex-pstricks-out.cpp @@ -47,7 +47,7 @@ LatexOutput::check (Inkscape::Extension::Extension * module) void -LatexOutput::save(Inkscape::Extension::Output *mod2, Document *doc, gchar const *filename) +LatexOutput::save(Inkscape::Extension::Output *mod2, SPDocument *doc, gchar const *filename) { Inkscape::Extension::Print *mod; SPPrintContext context; diff --git a/src/extension/internal/latex-pstricks-out.h b/src/extension/internal/latex-pstricks-out.h index a9910f4cc..a12cdc3c1 100644 --- a/src/extension/internal/latex-pstricks-out.h +++ b/src/extension/internal/latex-pstricks-out.h @@ -27,7 +27,7 @@ public: bool check(Inkscape::Extension::Extension *module); //Can this module load (always yes for now) void save(Inkscape::Extension::Output *mod, // Save the given document to the given filename - Document *doc, + SPDocument *doc, gchar const *filename); static void init(void);//Initialize the class diff --git a/src/extension/internal/latex-pstricks.cpp b/src/extension/internal/latex-pstricks.cpp index afc985e14..789e5ea34 100644 --- a/src/extension/internal/latex-pstricks.cpp +++ b/src/extension/internal/latex-pstricks.cpp @@ -64,7 +64,7 @@ PrintLatex::setup (Inkscape::Extension::Print *mod) } unsigned int -PrintLatex::begin (Inkscape::Extension::Print *mod, Document *doc) +PrintLatex::begin (Inkscape::Extension::Print *mod, SPDocument *doc) { Inkscape::SVGOStringStream os; int res; diff --git a/src/extension/internal/latex-pstricks.h b/src/extension/internal/latex-pstricks.h index 4e310d6fd..a33e169e8 100644 --- a/src/extension/internal/latex-pstricks.h +++ b/src/extension/internal/latex-pstricks.h @@ -43,7 +43,7 @@ public: /* Print functions */ virtual unsigned int setup (Inkscape::Extension::Print * module); - virtual unsigned int begin (Inkscape::Extension::Print * module, Document *doc); + virtual unsigned int begin (Inkscape::Extension::Print * module, SPDocument *doc); virtual unsigned int finish (Inkscape::Extension::Print * module); /* Rendering methods */ diff --git a/src/extension/internal/odf.cpp b/src/extension/internal/odf.cpp index e7e22414a..cc8489302 100644 --- a/src/extension/internal/odf.cpp +++ b/src/extension/internal/odf.cpp @@ -2367,7 +2367,7 @@ OdfOutput::reset() * Descends into the SVG tree, mapping things to ODF when appropriate */ void -OdfOutput::save(Inkscape::Extension::Output */*mod*/, Document *doc, gchar const *filename) +OdfOutput::save(Inkscape::Extension::Output */*mod*/, SPDocument *doc, gchar const *filename) { reset(); diff --git a/src/extension/internal/odf.h b/src/extension/internal/odf.h index 5ad1f1137..3854ddfe1 100644 --- a/src/extension/internal/odf.h +++ b/src/extension/internal/odf.h @@ -272,7 +272,7 @@ public: bool check (Inkscape::Extension::Extension * module); void save (Inkscape::Extension::Output *mod, - Document *doc, + SPDocument *doc, gchar const *filename); static void init (void); diff --git a/src/extension/internal/pdf-input-cairo.cpp b/src/extension/internal/pdf-input-cairo.cpp index 76759259d..937fefb11 100644 --- a/src/extension/internal/pdf-input-cairo.cpp +++ b/src/extension/internal/pdf-input-cairo.cpp @@ -32,7 +32,7 @@ namespace Internal { static cairo_status_t _write_ustring_cb(void *closure, const unsigned char *data, unsigned int length); -Document * +SPDocument * PdfInputCairo::open(Inkscape::Extension::Input * /*mod*/, const gchar * uri) { printf("Attempting to open using PdfInputCairo\n"); @@ -58,7 +58,7 @@ PdfInputCairo::open(Inkscape::Extension::Input * /*mod*/, const gchar * uri) { cairo_destroy(cr); cairo_surface_destroy(surface); - Document * doc = sp_document_new_from_mem(output->c_str(), output->length(), TRUE); + SPDocument * doc = sp_document_new_from_mem(output->c_str(), output->length(), TRUE); delete output; g_object_unref(page); diff --git a/src/extension/internal/pdf-input-cairo.h b/src/extension/internal/pdf-input-cairo.h index 15080bc14..5715b57c9 100644 --- a/src/extension/internal/pdf-input-cairo.h +++ b/src/extension/internal/pdf-input-cairo.h @@ -27,7 +27,7 @@ namespace Internal { class PdfInputCairo: public Inkscape::Extension::Implementation::Implementation { PdfInputCairo () { }; public: - Document *open( Inkscape::Extension::Input *mod, + SPDocument *open( Inkscape::Extension::Input *mod, const gchar *uri ); static void init( void ); diff --git a/src/extension/internal/pdfinput/pdf-input.cpp b/src/extension/internal/pdfinput/pdf-input.cpp index 476f0daf6..c2d417f2c 100644 --- a/src/extension/internal/pdfinput/pdf-input.cpp +++ b/src/extension/internal/pdfinput/pdf-input.cpp @@ -589,7 +589,7 @@ void PdfImportDialog::_setPreviewPage(int page) { /** * Parses the selected page of the given PDF document using PdfParser. */ -Document * +SPDocument * PdfInput::open(::Inkscape::Extension::Input * /*mod*/, const gchar * uri) { // Initialize the globalParams variable for poppler @@ -661,7 +661,7 @@ PdfInput::open(::Inkscape::Extension::Input * /*mod*/, const gchar * uri) { Catalog *catalog = pdf_doc->getCatalog(); Page *page = catalog->getPage(page_num); - Document *doc = sp_document_new(NULL, TRUE, TRUE); + SPDocument *doc = sp_document_new(NULL, TRUE, TRUE); bool saved = sp_document_get_undo_sensitive(doc); sp_document_set_undo_sensitive(doc, false); // No need to undo in this temporary document diff --git a/src/extension/internal/pdfinput/pdf-input.h b/src/extension/internal/pdfinput/pdf-input.h index 968114ef3..6bf0f11a2 100644 --- a/src/extension/internal/pdfinput/pdf-input.h +++ b/src/extension/internal/pdfinput/pdf-input.h @@ -113,7 +113,7 @@ private: class PdfInput: public Inkscape::Extension::Implementation::Implementation { PdfInput () { }; public: - Document *open( Inkscape::Extension::Input *mod, + SPDocument *open( Inkscape::Extension::Input *mod, const gchar *uri ); static void init( void ); diff --git a/src/extension/internal/pdfinput/svg-builder.cpp b/src/extension/internal/pdfinput/svg-builder.cpp index 686e44bb1..00bd8fa4d 100644 --- a/src/extension/internal/pdfinput/svg-builder.cpp +++ b/src/extension/internal/pdfinput/svg-builder.cpp @@ -77,7 +77,7 @@ struct SvgTransparencyGroup { * */ -SvgBuilder::SvgBuilder(Document *document, gchar *docname, XRef *xref) { +SvgBuilder::SvgBuilder(SPDocument *document, gchar *docname, XRef *xref) { _is_top_level = true; _doc = document; _docname = docname; diff --git a/src/extension/internal/pdfinput/svg-builder.h b/src/extension/internal/pdfinput/svg-builder.h index 1f84ffcc3..3b9192d31 100644 --- a/src/extension/internal/pdfinput/svg-builder.h +++ b/src/extension/internal/pdfinput/svg-builder.h @@ -18,7 +18,7 @@ #ifdef HAVE_POPPLER -class Document; +class SPDocument; namespace Inkscape { namespace XML { class Document; @@ -95,7 +95,7 @@ struct SvgGlyph { */ class SvgBuilder { public: - SvgBuilder(Document *document, gchar *docname, XRef *xref); + SvgBuilder(SPDocument *document, gchar *docname, XRef *xref); SvgBuilder(SvgBuilder *parent, Inkscape::XML::Node *root); virtual ~SvgBuilder(); @@ -220,7 +220,7 @@ private: std::vector _availableFontNames; // Full names, used for matching font names (Bug LP #179589). bool _is_top_level; // Whether this SvgBuilder is the top-level one - Document *_doc; + SPDocument *_doc; gchar *_docname; // Basename of the URI from which this document is created XRef *_xref; // Cross-reference table from the PDF doc we're converting from Inkscape::XML::Document *_xml_doc; diff --git a/src/extension/internal/pov-out.cpp b/src/extension/internal/pov-out.cpp index d3ed39d1f..f30cbc317 100644 --- a/src/extension/internal/pov-out.cpp +++ b/src/extension/internal/pov-out.cpp @@ -417,7 +417,7 @@ bool PovOutput::doCurve(SPItem *item, const String &id) /** * Descend the svg tree recursively, translating data */ -bool PovOutput::doTreeRecursive(Document *doc, SPObject *obj) +bool PovOutput::doTreeRecursive(SPDocument *doc, SPObject *obj) { String id; @@ -454,7 +454,7 @@ bool PovOutput::doTreeRecursive(Document *doc, SPObject *obj) /** * Output the curve data to buffer */ -bool PovOutput::doTree(Document *doc) +bool PovOutput::doTree(SPDocument *doc) { double bignum = 1000000.0; minx = bignum; @@ -576,7 +576,7 @@ void PovOutput::reset() /** * Saves the Shapes of an Inkscape SVG file as PovRay spline definitions */ -void PovOutput::saveDocument(Document *doc, gchar const *filename_utf8) +void PovOutput::saveDocument(SPDocument *doc, gchar const *filename_utf8) { reset(); @@ -641,7 +641,7 @@ void PovOutput::saveDocument(Document *doc, gchar const *filename_utf8) */ void PovOutput::save(Inkscape::Extension::Output */*mod*/, - Document *doc, gchar const *filename_utf8) + SPDocument *doc, gchar const *filename_utf8) { /* See comments in JavaFSOutput::save re the name `filename_utf8'. */ saveDocument(doc, filename_utf8); diff --git a/src/extension/internal/pov-out.h b/src/extension/internal/pov-out.h index 02ba6da82..0c3b73a7f 100644 --- a/src/extension/internal/pov-out.h +++ b/src/extension/internal/pov-out.h @@ -57,7 +57,7 @@ public: * API call to perform the output to a file */ void save(Inkscape::Extension::Output *mod, - Document *doc, gchar const *filename); + SPDocument *doc, gchar const *filename); /** * Inkscape runtime startup call. @@ -120,13 +120,13 @@ private: * Output the SVG document's curve data as POV curves */ bool doCurve(SPItem *item, const String &id); - bool doTreeRecursive(Document *doc, SPObject *obj); - bool doTree(Document *doc); + bool doTreeRecursive(SPDocument *doc, SPObject *obj); + bool doTree(SPDocument *doc); /** * Actual method to save document */ - void saveDocument(Document *doc, gchar const *filename); + void saveDocument(SPDocument *doc, gchar const *filename); /** diff --git a/src/extension/internal/svg.cpp b/src/extension/internal/svg.cpp index 317811088..a3589e905 100644 --- a/src/extension/internal/svg.cpp +++ b/src/extension/internal/svg.cpp @@ -138,13 +138,13 @@ _load_uri (const gchar *uri) /** \return A new document just for you! \brief This function takes in a filename of a SVG document and - turns it into a Document. + turns it into a SPDocument. \param mod Module to use \param uri The path to the file (UTF-8) This function is really simple, it just calls sp_document_new... */ -Document * +SPDocument * Svg::open (Inkscape::Extension::Input */*mod*/, const gchar *uri) { #ifdef WITH_GNOME_VFS @@ -157,7 +157,7 @@ Svg::open (Inkscape::Extension::Input */*mod*/, const gchar *uri) g_warning("Error: Could not open file '%s' with VFS\n", uri); return NULL; } - Document * doc = sp_document_new_from_mem(buffer, strlen(buffer), 1); + SPDocument * doc = sp_document_new_from_mem(buffer, strlen(buffer), 1); g_free(buffer); return doc; @@ -191,7 +191,7 @@ Svg::open (Inkscape::Extension::Input */*mod*/, const gchar *uri) all of this code. I just stole it. */ void -Svg::save(Inkscape::Extension::Output *mod, Document *doc, gchar const *filename) +Svg::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *filename) { g_return_if_fail(doc != NULL); g_return_if_fail(filename != NULL); diff --git a/src/extension/internal/svg.h b/src/extension/internal/svg.h index 48b57c8c5..b97735dd8 100644 --- a/src/extension/internal/svg.h +++ b/src/extension/internal/svg.h @@ -25,9 +25,9 @@ class Svg : public Inkscape::Extension::Implementation::Implementation { public: virtual void save( Inkscape::Extension::Output *mod, - Document *doc, + SPDocument *doc, gchar const *filename ); - virtual Document *open( Inkscape::Extension::Input *mod, + virtual SPDocument *open( Inkscape::Extension::Input *mod, const gchar *uri ); static void init( void ); diff --git a/src/extension/internal/win32.cpp b/src/extension/internal/win32.cpp index f272292b5..21f278858 100644 --- a/src/extension/internal/win32.cpp +++ b/src/extension/internal/win32.cpp @@ -215,7 +215,7 @@ PrintWin32::setup (Inkscape::Extension::Print *mod) } unsigned int -PrintWin32::begin (Inkscape::Extension::Print *mod, Document *doc) +PrintWin32::begin (Inkscape::Extension::Print *mod, SPDocument *doc) { DOCINFO di = { sizeof (DOCINFO), diff --git a/src/extension/internal/win32.h b/src/extension/internal/win32.h index 7f4b9352d..9462115c6 100644 --- a/src/extension/internal/win32.h +++ b/src/extension/internal/win32.h @@ -65,7 +65,7 @@ public: virtual unsigned int setup (Inkscape::Extension::Print * module); //virtual unsigned int set_preview (Inkscape::Extension::Print * module); - virtual unsigned int begin (Inkscape::Extension::Print * module, Document *doc); + virtual unsigned int begin (Inkscape::Extension::Print * module, SPDocument *doc); virtual unsigned int finish (Inkscape::Extension::Print * module); /* Rendering methods */ diff --git a/src/extension/internal/wpg-input.cpp b/src/extension/internal/wpg-input.cpp index e7177e5e3..c37d5705b 100644 --- a/src/extension/internal/wpg-input.cpp +++ b/src/extension/internal/wpg-input.cpp @@ -59,7 +59,7 @@ namespace Extension { namespace Internal { -Document * +SPDocument * WpgInput::open(Inkscape::Extension::Input * mod, const gchar * uri) { WPXInputStream* input = new libwpg::WPGFileStream(uri); if (input->isOLEStream()) { @@ -86,7 +86,7 @@ WpgInput::open(Inkscape::Extension::Input * mod, const gchar * uri) { //printf("I've got a doc: \n%s", painter.document.c_str()); - Document * doc = sp_document_new_from_mem(output.cstr(), strlen(output.cstr()), TRUE); + SPDocument * doc = sp_document_new_from_mem(output.cstr(), strlen(output.cstr()), TRUE); delete input; return doc; } diff --git a/src/extension/internal/wpg-input.h b/src/extension/internal/wpg-input.h index e5c2838d5..ca882039b 100644 --- a/src/extension/internal/wpg-input.h +++ b/src/extension/internal/wpg-input.h @@ -24,7 +24,7 @@ namespace Internal { class WpgInput : public Inkscape::Extension::Implementation::Implementation { WpgInput () { }; public: - Document *open( Inkscape::Extension::Input *mod, + SPDocument *open( Inkscape::Extension::Input *mod, const gchar *uri ); static void init( void ); diff --git a/src/extension/output.cpp b/src/extension/output.cpp index 8e2fa5486..742e938de 100644 --- a/src/extension/output.cpp +++ b/src/extension/output.cpp @@ -212,7 +212,7 @@ Output::prefs (void) could be changed, and old files will still work properly. */ void -Output::save(Document *doc, gchar const *filename) +Output::save(SPDocument *doc, gchar const *filename) { try { imp->save(this, doc, filename); diff --git a/src/extension/output.h b/src/extension/output.h index 455b4a8ae..b52a96211 100644 --- a/src/extension/output.h +++ b/src/extension/output.h @@ -15,7 +15,7 @@ #include #include "extension.h" -struct Document; +struct SPDocument; namespace Inkscape { namespace Extension { @@ -36,7 +36,7 @@ public: Implementation::Implementation * in_imp); virtual ~Output (void); virtual bool check (void); - void save (Document *doc, + void save (SPDocument *doc, gchar const *uri); bool prefs (void); gchar * get_mimetype(void); diff --git a/src/extension/param/bool.cpp b/src/extension/param/bool.cpp index 07170587a..1dda3d73f 100644 --- a/src/extension/param/bool.cpp +++ b/src/extension/param/bool.cpp @@ -53,7 +53,7 @@ ParamBool::ParamBool (const gchar * name, const gchar * guitext, const gchar * d and \c pref_name() are used. */ bool -ParamBool::set( bool in, Document * /*doc*/, Inkscape::XML::Node * /*node*/ ) +ParamBool::set( bool in, SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/ ) { _value = in; @@ -67,7 +67,7 @@ ParamBool::set( bool in, Document * /*doc*/, Inkscape::XML::Node * /*node*/ ) /** \brief Returns \c _value */ bool -ParamBool::get (const Document * doc, const Inkscape::XML::Node * node) +ParamBool::get (const SPDocument * doc, const Inkscape::XML::Node * node) { return _value; } @@ -79,7 +79,7 @@ class ParamBoolCheckButton : public Gtk::CheckButton { private: /** \brief Param to change */ ParamBool * _pref; - Document * _doc; + SPDocument * _doc; Inkscape::XML::Node * _node; sigc::signal * _changeSignal; public: @@ -89,7 +89,7 @@ public: This function sets the value of the checkbox to be that of the parameter, and then sets up a callback to \c on_toggle. */ - ParamBoolCheckButton (ParamBool * param, Document * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) : + ParamBoolCheckButton (ParamBool * param, SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) : Gtk::CheckButton(), _pref(param), _doc(doc), _node(node), _changeSignal(changeSignal) { this->set_active(_pref->get(NULL, NULL) /**\todo fix */); this->signal_toggled().connect(sigc::mem_fun(this, &ParamBoolCheckButton::on_toggle)); @@ -132,7 +132,7 @@ ParamBool::string (std::string &string) Builds a hbox with a label and a check button in it. */ Gtk::Widget * -ParamBool::get_widget (Document * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) +ParamBool::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) { if (_gui_hidden) return NULL; Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4)); diff --git a/src/extension/param/bool.h b/src/extension/param/bool.h index 23b15596d..a1cd4ce4a 100644 --- a/src/extension/param/bool.h +++ b/src/extension/param/bool.h @@ -22,9 +22,9 @@ private: bool _value; public: ParamBool(const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml); - bool get (const Document * doc, const Inkscape::XML::Node * node); - bool set (bool in, Document * doc, Inkscape::XML::Node * node); - Gtk::Widget * get_widget(Document * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); + bool get (const SPDocument * doc, const Inkscape::XML::Node * node); + bool set (bool in, SPDocument * doc, Inkscape::XML::Node * node); + Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); void string (std::string &string); }; diff --git a/src/extension/param/color.cpp b/src/extension/param/color.cpp index 080356e71..58db85748 100644 --- a/src/extension/param/color.cpp +++ b/src/extension/param/color.cpp @@ -41,7 +41,7 @@ ParamColor::~ParamColor(void) } guint32 -ParamColor::set( guint32 in, Document * /*doc*/, Inkscape::XML::Node * /*node*/ ) +ParamColor::set( guint32 in, SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/ ) { _value = in; @@ -87,7 +87,7 @@ ParamColor::string (std::string &string) } Gtk::Widget * -ParamColor::get_widget( Document * /*doc*/, Inkscape::XML::Node * /*node*/, sigc::signal * changeSignal ) +ParamColor::get_widget( SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/, sigc::signal * changeSignal ) { if (_gui_hidden) return NULL; diff --git a/src/extension/param/color.h b/src/extension/param/color.h index 89aac7be7..e6b44fbcb 100644 --- a/src/extension/param/color.h +++ b/src/extension/param/color.h @@ -23,9 +23,9 @@ public: ParamColor(const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml); virtual ~ParamColor(void); /** \brief Returns \c _value, with a \i const to protect it. */ - guint32 get( const Document * /*doc*/, const Inkscape::XML::Node * /*node*/ ) { return _value; } - guint32 set (guint32 in, Document * doc, Inkscape::XML::Node * node); - Gtk::Widget * get_widget(Document * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); + guint32 get( const SPDocument * /*doc*/, const Inkscape::XML::Node * /*node*/ ) { return _value; } + guint32 set (guint32 in, SPDocument * doc, Inkscape::XML::Node * node); + Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); void string (std::string &string); sigc::signal * _changeSignal; }; /* class ParamColor */ diff --git a/src/extension/param/description.cpp b/src/extension/param/description.cpp index 3641695cc..656e58c49 100644 --- a/src/extension/param/description.cpp +++ b/src/extension/param/description.cpp @@ -46,7 +46,7 @@ ParamDescription::ParamDescription (const gchar * name, const gchar * guitext, c /** \brief Create a label for the description */ Gtk::Widget * -ParamDescription::get_widget (Document * /*doc*/, Inkscape::XML::Node * /*node*/, sigc::signal * /*changeSignal*/) +ParamDescription::get_widget (SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/, sigc::signal * /*changeSignal*/) { if (_gui_hidden) return NULL; diff --git a/src/extension/param/description.h b/src/extension/param/description.h index 42441e5a9..c305ea6df 100644 --- a/src/extension/param/description.h +++ b/src/extension/param/description.h @@ -23,7 +23,7 @@ private: gchar * _value; public: ParamDescription(const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml); - Gtk::Widget * get_widget(Document * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); + Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); }; } /* namespace Extension */ diff --git a/src/extension/param/enum.cpp b/src/extension/param/enum.cpp index 9de3f60dd..03c1f839b 100644 --- a/src/extension/param/enum.cpp +++ b/src/extension/param/enum.cpp @@ -129,7 +129,7 @@ ParamComboBox::~ParamComboBox (void) the passed in value is duplicated using \c g_strdup(). */ const gchar * -ParamComboBox::set (const gchar * in, Document * /*doc*/, Inkscape::XML::Node * /*node*/) +ParamComboBox::set (const gchar * in, SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/) { if (in == NULL) return NULL; /* Can't have NULL string */ @@ -177,7 +177,7 @@ ParamComboBox::string (std::string &string) class ParamComboBoxEntry : public Gtk::ComboBoxText { private: ParamComboBox * _pref; - Document * _doc; + SPDocument * _doc; Inkscape::XML::Node * _node; sigc::signal * _changeSignal; public: @@ -185,7 +185,7 @@ public: \param pref Where to get the string from, and where to put it when it changes. */ - ParamComboBoxEntry (ParamComboBox * pref, Document * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) : + ParamComboBoxEntry (ParamComboBox * pref, SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) : Gtk::ComboBoxText(), _pref(pref), _doc(doc), _node(node), _changeSignal(changeSignal) { this->signal_changed().connect(sigc::mem_fun(this, &ParamComboBoxEntry::changed)); }; @@ -211,7 +211,7 @@ ParamComboBoxEntry::changed (void) \brief Creates a combobox widget for an enumeration parameter */ Gtk::Widget * -ParamComboBox::get_widget (Document * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) +ParamComboBox::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) { if (_gui_hidden) return NULL; diff --git a/src/extension/param/enum.h b/src/extension/param/enum.h index e1af8fd2b..3f9707c34 100644 --- a/src/extension/param/enum.h +++ b/src/extension/param/enum.h @@ -39,11 +39,11 @@ private: public: ParamComboBox(const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml); virtual ~ParamComboBox(void); - Gtk::Widget * get_widget(Document * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); + Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); void string (std::string &string); - const gchar * get (const Document * /*doc*/, const Inkscape::XML::Node * /*node*/) { return _value; } - const gchar * set (const gchar * in, Document * doc, Inkscape::XML::Node * node); + const gchar * get (const SPDocument * /*doc*/, const Inkscape::XML::Node * /*node*/) { return _value; } + const gchar * set (const gchar * in, SPDocument * doc, Inkscape::XML::Node * node); void changed (void); }; /* class ParamComboBox */ diff --git a/src/extension/param/float.cpp b/src/extension/param/float.cpp index 516249c3c..11e3a8d97 100644 --- a/src/extension/param/float.cpp +++ b/src/extension/param/float.cpp @@ -75,7 +75,7 @@ ParamFloat::ParamFloat (const gchar * name, const gchar * guitext, const gchar * and \c pref_name() are used. */ float -ParamFloat::set (float in, Document * /*doc*/, Inkscape::XML::Node * /*node*/) +ParamFloat::set (float in, SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/) { _value = in; if (_value > _max) _value = _max; @@ -103,13 +103,13 @@ ParamFloat::string (std::string &string) class ParamFloatAdjustment : public Gtk::Adjustment { /** The parameter to adjust */ ParamFloat * _pref; - Document * _doc; + SPDocument * _doc; Inkscape::XML::Node * _node; sigc::signal * _changeSignal; public: /** \brief Make the adjustment using an extension and the string describing the parameter. */ - ParamFloatAdjustment (ParamFloat * param, Document * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) : + ParamFloatAdjustment (ParamFloat * param, SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) : Gtk::Adjustment(0.0, param->min(), param->max(), 0.1, 0), _pref(param), _doc(doc), _node(node), _changeSignal(changeSignal) { this->set_value(_pref->get(NULL, NULL) /* \todo fix */); this->signal_value_changed().connect(sigc::mem_fun(this, &ParamFloatAdjustment::val_changed)); @@ -142,7 +142,7 @@ ParamFloatAdjustment::val_changed (void) Builds a hbox with a label and a float adjustment in it. */ Gtk::Widget * -ParamFloat::get_widget (Document * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) +ParamFloat::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) { if (_gui_hidden) return NULL; diff --git a/src/extension/param/float.h b/src/extension/param/float.h index 32ab7a796..f105d8f0e 100644 --- a/src/extension/param/float.h +++ b/src/extension/param/float.h @@ -26,12 +26,12 @@ private: public: ParamFloat (const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml); /** \brief Returns \c _value */ - float get (const Document * /*doc*/, const Inkscape::XML::Node * /*node*/) { return _value; } - float set (float in, Document * doc, Inkscape::XML::Node * node); + float get (const SPDocument * /*doc*/, const Inkscape::XML::Node * /*node*/) { return _value; } + float set (float in, SPDocument * doc, Inkscape::XML::Node * node); float max (void) { return _max; } float min (void) { return _min; } float precision (void) { return _precision; } - Gtk::Widget * get_widget(Document * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); + Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); void string (std::string &string); }; diff --git a/src/extension/param/int.cpp b/src/extension/param/int.cpp index 2818bb57b..301d54ed0 100644 --- a/src/extension/param/int.cpp +++ b/src/extension/param/int.cpp @@ -70,7 +70,7 @@ ParamInt::ParamInt (const gchar * name, const gchar * guitext, const gchar * des and \c pref_name() are used. */ int -ParamInt::set (int in, Document * /*doc*/, Inkscape::XML::Node * /*node*/) +ParamInt::set (int in, SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/) { _value = in; if (_value > _max) _value = _max; @@ -88,13 +88,13 @@ ParamInt::set (int in, Document * /*doc*/, Inkscape::XML::Node * /*node*/) class ParamIntAdjustment : public Gtk::Adjustment { /** The parameter to adjust */ ParamInt * _pref; - Document * _doc; + SPDocument * _doc; Inkscape::XML::Node * _node; sigc::signal * _changeSignal; public: /** \brief Make the adjustment using an extension and the string describing the parameter. */ - ParamIntAdjustment (ParamInt * param, Document * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) : + ParamIntAdjustment (ParamInt * param, SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) : Gtk::Adjustment(0.0, param->min(), param->max(), 1.0, 0), _pref(param), _doc(doc), _node(node), _changeSignal(changeSignal) { this->set_value(_pref->get(NULL, NULL) /* \todo fix */); this->signal_value_changed().connect(sigc::mem_fun(this, &ParamIntAdjustment::val_changed)); @@ -127,7 +127,7 @@ ParamIntAdjustment::val_changed (void) Builds a hbox with a label and a int adjustment in it. */ Gtk::Widget * -ParamInt::get_widget (Document * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) +ParamInt::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) { if (_gui_hidden) return NULL; diff --git a/src/extension/param/int.h b/src/extension/param/int.h index 6d44a10b3..a4eb54c81 100644 --- a/src/extension/param/int.h +++ b/src/extension/param/int.h @@ -25,11 +25,11 @@ private: public: ParamInt (const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml); /** \brief Returns \c _value */ - int get (const Document * /*doc*/, const Inkscape::XML::Node * /*node*/) { return _value; } - int set (int in, Document * doc, Inkscape::XML::Node * node); + int get (const SPDocument * /*doc*/, const Inkscape::XML::Node * /*node*/) { return _value; } + int set (int in, SPDocument * doc, Inkscape::XML::Node * node); int max (void) { return _max; } int min (void) { return _min; } - Gtk::Widget * get_widget(Document * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); + Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); void string (std::string &string); }; diff --git a/src/extension/param/notebook.cpp b/src/extension/param/notebook.cpp index 6ad338ffa..1c30b7e0e 100644 --- a/src/extension/param/notebook.cpp +++ b/src/extension/param/notebook.cpp @@ -54,7 +54,7 @@ public: ParamNotebookPage(const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml); ~ParamNotebookPage(void); - Gtk::Widget * get_widget(Document * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); + Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); void paramString (std::list &list); gchar * get_guitext (void) {return _text;}; @@ -196,7 +196,7 @@ ParamNotebookPage::makepage (Inkscape::XML::Node * in_repr, Inkscape::Extension: Builds a notebook page (a vbox) and puts parameters on it. */ Gtk::Widget * -ParamNotebookPage::get_widget (Document * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) +ParamNotebookPage::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) { if (_gui_hidden) return NULL; @@ -295,7 +295,7 @@ ParamNotebook::~ParamNotebook (void) the passed in value is duplicated using \c g_strdup(). */ const gchar * -ParamNotebook::set (const int in, Document * /*doc*/, Inkscape::XML::Node * /*node*/) +ParamNotebook::set (const int in, SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/) { ParamNotebookPage * page = NULL; int i = 0; @@ -347,14 +347,14 @@ ParamNotebook::string (std::list &list) class ParamNotebookWdg : public Gtk::Notebook { private: ParamNotebook * _pref; - Document * _doc; + SPDocument * _doc; Inkscape::XML::Node * _node; public: /** \brief Build a notebookpage preference for the given parameter \param pref Where to get the string (pagename) from, and where to put it when it changes. */ - ParamNotebookWdg (ParamNotebook * pref, Document * doc, Inkscape::XML::Node * node) : + ParamNotebookWdg (ParamNotebook * pref, SPDocument * doc, Inkscape::XML::Node * node) : Gtk::Notebook(), _pref(pref), _doc(doc), _node(node), activated(false) { // don't have to set the correct page: this is done in ParamNotebook::get_widget. // hook function @@ -389,7 +389,7 @@ ParamNotebookWdg::changed_page(GtkNotebookPage */*page*/, Builds a notebook and puts pages in it. */ Gtk::Widget * -ParamNotebook::get_widget (Document * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) +ParamNotebook::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) { if (_gui_hidden) return NULL; diff --git a/src/extension/param/notebook.h b/src/extension/param/notebook.h index 6efd3c5f1..24d4ebfc1 100644 --- a/src/extension/param/notebook.h +++ b/src/extension/param/notebook.h @@ -40,11 +40,11 @@ private: public: ParamNotebook(const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml); virtual ~ParamNotebook(void); - Gtk::Widget * get_widget(Document * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); + Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); void string (std::list &list); - const gchar * get (const Document * /*doc*/, const Inkscape::XML::Node * /*node*/) { return _value; } - const gchar * set (const int in, Document * doc, Inkscape::XML::Node * node); + const gchar * get (const SPDocument * /*doc*/, const Inkscape::XML::Node * /*node*/) { return _value; } + const gchar * set (const int in, SPDocument * doc, Inkscape::XML::Node * node); }; /* class ParamNotebook */ diff --git a/src/extension/param/parameter.cpp b/src/extension/param/parameter.cpp index 1094a5d3f..2773af61d 100644 --- a/src/extension/param/parameter.cpp +++ b/src/extension/param/parameter.cpp @@ -156,7 +156,7 @@ Parameter::make (Inkscape::XML::Node * in_repr, Inkscape::Extension::Extension * /** \brief Wrapper to cast to the object and use it's function. */ bool -Parameter::get_bool (const Document * doc, const Inkscape::XML::Node * node) +Parameter::get_bool (const SPDocument * doc, const Inkscape::XML::Node * node) { ParamBool * boolpntr = dynamic_cast(this); if (boolpntr == NULL) @@ -166,7 +166,7 @@ Parameter::get_bool (const Document * doc, const Inkscape::XML::Node * node) /** \brief Wrapper to cast to the object and use it's function. */ int -Parameter::get_int (const Document * doc, const Inkscape::XML::Node * node) +Parameter::get_int (const SPDocument * doc, const Inkscape::XML::Node * node) { ParamInt * intpntr = dynamic_cast(this); if (intpntr == NULL) @@ -176,7 +176,7 @@ Parameter::get_int (const Document * doc, const Inkscape::XML::Node * node) /** \brief Wrapper to cast to the object and use it's function. */ float -Parameter::get_float (const Document * doc, const Inkscape::XML::Node * node) +Parameter::get_float (const SPDocument * doc, const Inkscape::XML::Node * node) { ParamFloat * floatpntr = dynamic_cast(this); if (floatpntr == NULL) @@ -186,7 +186,7 @@ Parameter::get_float (const Document * doc, const Inkscape::XML::Node * node) /** \brief Wrapper to cast to the object and use it's function. */ const gchar * -Parameter::get_string (const Document * doc, const Inkscape::XML::Node * node) +Parameter::get_string (const SPDocument * doc, const Inkscape::XML::Node * node) { ParamString * stringpntr = dynamic_cast(this); if (stringpntr == NULL) @@ -196,7 +196,7 @@ Parameter::get_string (const Document * doc, const Inkscape::XML::Node * node) /** \brief Wrapper to cast to the object and use it's function. */ const gchar * -Parameter::get_enum (const Document * doc, const Inkscape::XML::Node * node) +Parameter::get_enum (const SPDocument * doc, const Inkscape::XML::Node * node) { ParamComboBox * param = dynamic_cast(this); if (param == NULL) @@ -205,7 +205,7 @@ Parameter::get_enum (const Document * doc, const Inkscape::XML::Node * node) } guint32 -Parameter::get_color(const Document* doc, const Inkscape::XML::Node* node) +Parameter::get_color(const SPDocument* doc, const Inkscape::XML::Node* node) { ParamColor* param = dynamic_cast(this); if (param == NULL) @@ -215,7 +215,7 @@ Parameter::get_color(const Document* doc, const Inkscape::XML::Node* node) /** \brief Wrapper to cast to the object and use it's function. */ bool -Parameter::set_bool (bool in, Document * doc, Inkscape::XML::Node * node) +Parameter::set_bool (bool in, SPDocument * doc, Inkscape::XML::Node * node) { ParamBool * boolpntr = dynamic_cast(this); if (boolpntr == NULL) @@ -225,7 +225,7 @@ Parameter::set_bool (bool in, Document * doc, Inkscape::XML::Node * node) /** \brief Wrapper to cast to the object and use it's function. */ int -Parameter::set_int (int in, Document * doc, Inkscape::XML::Node * node) +Parameter::set_int (int in, SPDocument * doc, Inkscape::XML::Node * node) { ParamInt * intpntr = dynamic_cast(this); if (intpntr == NULL) @@ -235,7 +235,7 @@ Parameter::set_int (int in, Document * doc, Inkscape::XML::Node * node) /** \brief Wrapper to cast to the object and use it's function. */ float -Parameter::set_float (float in, Document * doc, Inkscape::XML::Node * node) +Parameter::set_float (float in, SPDocument * doc, Inkscape::XML::Node * node) { ParamFloat * floatpntr; floatpntr = dynamic_cast(this); @@ -246,7 +246,7 @@ Parameter::set_float (float in, Document * doc, Inkscape::XML::Node * node) /** \brief Wrapper to cast to the object and use it's function. */ const gchar * -Parameter::set_string (const gchar * in, Document * doc, Inkscape::XML::Node * node) +Parameter::set_string (const gchar * in, SPDocument * doc, Inkscape::XML::Node * node) { ParamString * stringpntr = dynamic_cast(this); if (stringpntr == NULL) @@ -255,7 +255,7 @@ Parameter::set_string (const gchar * in, Document * doc, Inkscape::XML::Node * n } /** \brief Wrapper to cast to the object and use it's function. */ guint32 -Parameter::set_color (guint32 in, Document * doc, Inkscape::XML::Node * node) +Parameter::set_color (guint32 in, SPDocument * doc, Inkscape::XML::Node * node) { ParamColor* param = dynamic_cast(this); if (param == NULL) @@ -323,7 +323,7 @@ Parameter::new_child (Inkscape::XML::Node * parent) } Inkscape::XML::Node * -Parameter::document_param_node (Document * doc) +Parameter::document_param_node (SPDocument * doc) { Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc); Inkscape::XML::Node * defs = SP_OBJECT_REPR(SP_DOCUMENT_DEFS(doc)); @@ -353,7 +353,7 @@ Parameter::document_param_node (Document * doc) /** \brief Basically, if there is no widget pass a NULL. */ Gtk::Widget * -Parameter::get_widget (Document * /*doc*/, Inkscape::XML::Node * /*node*/, sigc::signal * /*changeSignal*/) +Parameter::get_widget (SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/, sigc::signal * /*changeSignal*/) { return NULL; } diff --git a/src/extension/param/parameter.h b/src/extension/param/parameter.h index a79b2fd6b..54249c12e 100644 --- a/src/extension/param/parameter.h +++ b/src/extension/param/parameter.h @@ -68,7 +68,7 @@ protected: /* **** funcs **** */ gchar * pref_name (void); Inkscape::XML::Node * find_child (Inkscape::XML::Node * adult); - Inkscape::XML::Node * document_param_node (Document * doc); + Inkscape::XML::Node * document_param_node (SPDocument * doc); Inkscape::XML::Node * new_child (Inkscape::XML::Node * parent); public: @@ -85,29 +85,29 @@ public: Parameter(name, guitext, NULL, Parameter::SCOPE_USER, false, NULL, ext); }; virtual ~Parameter (void); - bool get_bool (const Document * doc, + bool get_bool (const SPDocument * doc, const Inkscape::XML::Node * node); - int get_int (const Document * doc, + int get_int (const SPDocument * doc, const Inkscape::XML::Node * node); - float get_float (const Document * doc, + float get_float (const SPDocument * doc, const Inkscape::XML::Node * node); - const gchar * get_string (const Document * doc, + const gchar * get_string (const SPDocument * doc, const Inkscape::XML::Node * node); - guint32 get_color (const Document * doc, + guint32 get_color (const SPDocument * doc, const Inkscape::XML::Node * node); - const gchar * get_enum (const Document * doc, + const gchar * get_enum (const SPDocument * doc, const Inkscape::XML::Node * node); - bool set_bool (bool in, Document * doc, Inkscape::XML::Node * node); - int set_int (int in, Document * doc, Inkscape::XML::Node * node); - float set_float (float in, Document * doc, Inkscape::XML::Node * node); - const gchar * set_string (const gchar * in, Document * doc, Inkscape::XML::Node * node); - guint32 set_color (guint32 in, Document * doc, Inkscape::XML::Node * node); + bool set_bool (bool in, SPDocument * doc, Inkscape::XML::Node * node); + int set_int (int in, SPDocument * doc, Inkscape::XML::Node * node); + float set_float (float in, SPDocument * doc, Inkscape::XML::Node * node); + const gchar * set_string (const gchar * in, SPDocument * doc, Inkscape::XML::Node * node); + guint32 set_color (guint32 in, SPDocument * doc, Inkscape::XML::Node * node); const gchar * name (void) {return _name;} static Parameter * make (Inkscape::XML::Node * in_repr, Inkscape::Extension::Extension * in_ext); - virtual Gtk::Widget * get_widget (Document * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); + virtual Gtk::Widget * get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); gchar const * get_tooltip (void) { return _desc; } diff --git a/src/extension/param/radiobutton.cpp b/src/extension/param/radiobutton.cpp index 315984e17..c17839001 100644 --- a/src/extension/param/radiobutton.cpp +++ b/src/extension/param/radiobutton.cpp @@ -149,7 +149,7 @@ ParamRadioButton::~ParamRadioButton (void) the passed in value is duplicated using \c g_strdup(). */ const gchar * -ParamRadioButton::set (const gchar * in, Document * /*doc*/, Inkscape::XML::Node * /*node*/) +ParamRadioButton::set (const gchar * in, SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/) { if (in == NULL) return NULL; /* Can't have NULL string */ @@ -189,7 +189,7 @@ ParamRadioButton::string (std::string &string) class ParamRadioButtonWdg : public Gtk::RadioButton { private: ParamRadioButton * _pref; - Document * _doc; + SPDocument * _doc; Inkscape::XML::Node * _node; sigc::signal * _changeSignal; public: @@ -197,12 +197,12 @@ public: \param pref Where to put the radiobutton's string when it is selected. */ ParamRadioButtonWdg ( Gtk::RadioButtonGroup& group, const Glib::ustring& label, - ParamRadioButton * pref, Document * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal ) : + ParamRadioButton * pref, SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal ) : Gtk::RadioButton(group, label), _pref(pref), _doc(doc), _node(node), _changeSignal(changeSignal) { add_changesignal(); }; ParamRadioButtonWdg ( const Glib::ustring& label, - ParamRadioButton * pref, Document * doc, Inkscape::XML::Node * node , sigc::signal * changeSignal) : + ParamRadioButton * pref, SPDocument * doc, Inkscape::XML::Node * node , sigc::signal * changeSignal) : Gtk::RadioButton(label), _pref(pref), _doc(doc), _node(node), _changeSignal(changeSignal) { add_changesignal(); }; @@ -232,7 +232,7 @@ ParamRadioButtonWdg::changed (void) class ComboWdg : public Gtk::ComboBoxText { public: - ComboWdg(ParamRadioButton* base, Document * doc, Inkscape::XML::Node * node) : + ComboWdg(ParamRadioButton* base, SPDocument * doc, Inkscape::XML::Node * node) : Gtk::ComboBoxText(), base(base), doc(doc), @@ -243,7 +243,7 @@ public: protected: ParamRadioButton* base; - Document* doc; + SPDocument* doc; Inkscape::XML::Node* node; virtual void on_changed() { @@ -257,7 +257,7 @@ protected: \brief Creates a combobox widget for an enumeration parameter */ Gtk::Widget * -ParamRadioButton::get_widget (Document * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) +ParamRadioButton::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) { if (_gui_hidden) return NULL; diff --git a/src/extension/param/radiobutton.h b/src/extension/param/radiobutton.h index ec35c2c53..ea8440de2 100644 --- a/src/extension/param/radiobutton.h +++ b/src/extension/param/radiobutton.h @@ -43,11 +43,11 @@ public: Inkscape::XML::Node * xml, AppearanceMode mode); virtual ~ParamRadioButton(void); - Gtk::Widget * get_widget(Document * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); + Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); void string (std::string &string); - const gchar * get (const Document * /*doc*/, const Inkscape::XML::Node * /*node*/) { return _value; } - const gchar * set (const gchar * in, Document * doc, Inkscape::XML::Node * node); + const gchar * get (const SPDocument * /*doc*/, const Inkscape::XML::Node * /*node*/) { return _value; } + const gchar * set (const gchar * in, SPDocument * doc, Inkscape::XML::Node * node); private: /** \brief Internal value. This should point to a string that has diff --git a/src/extension/param/string.cpp b/src/extension/param/string.cpp index 6427f6f76..e32224332 100644 --- a/src/extension/param/string.cpp +++ b/src/extension/param/string.cpp @@ -42,7 +42,7 @@ ParamString::~ParamString(void) the passed in value is duplicated using \c g_strdup(). */ const gchar * -ParamString::set (const gchar * in, Document * /*doc*/, Inkscape::XML::Node * /*node*/) +ParamString::set (const gchar * in, SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/) { if (in == NULL) return NULL; /* Can't have NULL string */ @@ -96,7 +96,7 @@ ParamString::ParamString (const gchar * name, const gchar * guitext, const gchar class ParamStringEntry : public Gtk::Entry { private: ParamString * _pref; - Document * _doc; + SPDocument * _doc; Inkscape::XML::Node * _node; sigc::signal * _changeSignal; public: @@ -104,7 +104,7 @@ public: \param pref Where to get the string from, and where to put it when it changes. */ - ParamStringEntry (ParamString * pref, Document * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) : + ParamStringEntry (ParamString * pref, SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) : Gtk::Entry(), _pref(pref), _doc(doc), _node(node), _changeSignal(changeSignal) { if (_pref->get(NULL, NULL) != NULL) this->set_text(Glib::ustring(_pref->get(NULL, NULL))); @@ -137,7 +137,7 @@ ParamStringEntry::changed_text (void) Builds a hbox with a label and a text box in it. */ Gtk::Widget * -ParamString::get_widget (Document * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) +ParamString::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) { if (_gui_hidden) return NULL; diff --git a/src/extension/param/string.h b/src/extension/param/string.h index 0eb116a53..10f45e5ac 100644 --- a/src/extension/param/string.h +++ b/src/extension/param/string.h @@ -28,9 +28,9 @@ public: ParamString(const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml); virtual ~ParamString(void); /** \brief Returns \c _value, with a \i const to protect it. */ - const gchar * get (const Document * /*doc*/, const Inkscape::XML::Node * /*node*/) { return _value; } - const gchar * set (const gchar * in, Document * doc, Inkscape::XML::Node * node); - Gtk::Widget * get_widget(Document * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); + const gchar * get (const SPDocument * /*doc*/, const Inkscape::XML::Node * /*node*/) { return _value; } + const gchar * set (const gchar * in, SPDocument * doc, Inkscape::XML::Node * node); + Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); void string (std::string &string); void setMaxLength(int maxLenght) { _max_length = maxLenght; } int getMaxLength(void) { return _max_length; } diff --git a/src/extension/patheffect.cpp b/src/extension/patheffect.cpp index f6fa84f5b..8e3fc13f1 100644 --- a/src/extension/patheffect.cpp +++ b/src/extension/patheffect.cpp @@ -28,14 +28,14 @@ PathEffect::~PathEffect (void) } void -PathEffect::processPath (Document * /*doc*/, Inkscape::XML::Node * /*path*/, Inkscape::XML::Node * /*def*/) +PathEffect::processPath (SPDocument * /*doc*/, Inkscape::XML::Node * /*path*/, Inkscape::XML::Node * /*def*/) { } void -PathEffect::processPathEffects (Document * doc, Inkscape::XML::Node * path) +PathEffect::processPathEffects (SPDocument * doc, Inkscape::XML::Node * path) { gchar const * patheffectlist = path->attribute("inkscape:path-effects"); if (patheffectlist == NULL) diff --git a/src/extension/patheffect.h b/src/extension/patheffect.h index 7ad875048..0c00ae093 100644 --- a/src/extension/patheffect.h +++ b/src/extension/patheffect.h @@ -22,10 +22,10 @@ public: PathEffect (Inkscape::XML::Node * in_repr, Implementation::Implementation * in_imp); virtual ~PathEffect (void); - void processPath (Document * doc, + void processPath (SPDocument * doc, Inkscape::XML::Node * path, Inkscape::XML::Node * def); - static void processPathEffects (Document * doc, + static void processPathEffects (SPDocument * doc, Inkscape::XML::Node * path); }; /* PathEffect */ diff --git a/src/extension/print.cpp b/src/extension/print.cpp index f6f6bb1e5..2d4177d60 100644 --- a/src/extension/print.cpp +++ b/src/extension/print.cpp @@ -49,7 +49,7 @@ Print::set_preview (void) } unsigned int -Print::begin (Document *doc) +Print::begin (SPDocument *doc) { return imp->begin(this, doc); } diff --git a/src/extension/print.h b/src/extension/print.h index 3240942d7..8ae71b8e6 100644 --- a/src/extension/print.h +++ b/src/extension/print.h @@ -36,7 +36,7 @@ public: unsigned int setup (void); unsigned int set_preview (void); - unsigned int begin (Document *doc); + unsigned int begin (SPDocument *doc); unsigned int finish (void); /* Rendering methods */ diff --git a/src/extension/system.cpp b/src/extension/system.cpp index ad49c3d2a..d7e0eebf3 100644 --- a/src/extension/system.cpp +++ b/src/extension/system.cpp @@ -59,7 +59,7 @@ static Extension *build_from_reprdoc(Inkscape::XML::Document *doc, Implementatio * * Lastly, the open function is called in the module itself. */ -Document * +SPDocument * open(Extension *key, gchar const *filename) { Input *imod = NULL; @@ -91,7 +91,7 @@ open(Extension *key, gchar const *filename) if (!imod->prefs(filename)) return NULL; - Document *doc = imod->open(filename); + SPDocument *doc = imod->open(filename); if (!doc) { throw Input::open_failed(); } @@ -184,7 +184,7 @@ open_internal(Extension *in_plug, gpointer in_data) * Lastly, the save function is called in the module itself. */ void -save(Extension *key, Document *doc, gchar const *filename, bool setextension, bool check_overwrite, bool official) +save(Extension *key, SPDocument *doc, gchar const *filename, bool setextension, bool check_overwrite, bool official) { Output *omod; if (key == NULL) { diff --git a/src/extension/system.h b/src/extension/system.h index ada5f799c..6c23b2f0d 100644 --- a/src/extension/system.h +++ b/src/extension/system.h @@ -21,8 +21,8 @@ namespace Inkscape { namespace Extension { -Document *open(Extension *key, gchar const *filename); -void save(Extension *key, Document *doc, gchar const *filename, +SPDocument *open(Extension *key, gchar const *filename); +void save(Extension *key, SPDocument *doc, gchar const *filename, bool setextension, bool check_overwrite, bool official); Print *get_print(gchar const *key); Extension *build_from_file(gchar const *filename); diff --git a/src/file.cpp b/src/file.cpp index 22425547e..049c1acb4 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -1,4 +1,3 @@ - /** @file * @brief File/Print operations */ @@ -66,14 +65,6 @@ #include "uri.h" #include "xml/rebase-hrefs.h" -#include "streams-handles.h" -#include "streams-webdav.h" -#include "streams-ftp.h" -#include "streams-http.h" - -//#include "buffersystem.h" -#include - #ifdef WITH_GNOME_VFS # include #endif @@ -128,7 +119,7 @@ sp_file_new(const Glib::ustring &templ) char *templName = NULL; if (templ.size()>0) templName = (char *)templ.c_str(); - Document *doc = sp_document_new(templName, TRUE, true); + SPDocument *doc = sp_document_new(templName, TRUE, true); g_return_val_if_fail(doc != NULL, NULL); SPDesktop *dt; @@ -210,7 +201,7 @@ sp_file_open(const Glib::ustring &uri, if (desktop) desktop->setWaitingCursor(); - Document *doc = NULL; + SPDocument *doc = NULL; try { doc = Inkscape::Extension::open(key, uri.c_str()); } catch (Inkscape::Extension::Input::no_extension_found &e) { @@ -223,7 +214,7 @@ sp_file_open(const Glib::ustring &uri, desktop->clearWaitingCursor(); if (doc) { - Document *existing = desktop ? sp_desktop_document(desktop) : NULL; + SPDocument *existing = desktop ? sp_desktop_document(desktop) : NULL; if (existing && existing->virgin && replace_empty) { // If the current desktop is empty, open the document there @@ -263,137 +254,6 @@ sp_file_open(const Glib::ustring &uri, } } - - - -//NOTE1 -bool -sp_file_open_uri(const Inkscape::URI &uri, - Inkscape::Extension::Extension *key, - bool add_to_recent, bool replace_empty) -{ - Document *doc = NULL; - try { - doc = Inkscape::Extension::open(key, uri.toNativeFilename()); - } catch (Inkscape::Extension::Input::no_extension_found &e) { - doc = NULL; - } catch (Inkscape::Extension::Input::open_failed &e) { - doc = NULL; - } - - //FIXME1 KLUDGE switch - - //WebDAV - /* - if (std::strstr(uri.toString(), "http") != NULL) - { - if (strcmp(uri.toString(), "/http") >= 5//FIXME3 skip begining '/' - || - strcmp(uri.toString(), "http") >= 4 - ) - { - - std::cout<<"+++ 'http' uri.toString->"< FTP , HTTP etc."<= 4//FIXME3 skip begining '/' - || - strcmp(uri.toString(), "ftp") >= 3 - ) - { - std::cout<<"+++ 'ftp' uri.toString->"<> buf; - std::cout<<"buf->"<= 5//FIXME3 skip begining '/' - || - strcmp(uri.toString(), "http") >= 4 - ) - { - std::cout<<"+++ 'http' uri.toString->"<> buf; - std::cout<<"buf->"<virgin && replace_empty) { - // If the current desktop is empty, open the document there - sp_document_ensure_up_to_date (doc); - desktop->change_document(doc); - sp_document_resized_signal_emit (doc, sp_document_width(doc), sp_document_height(doc)); - } else { - if (!Inkscape::NSApplication::Application::getNewGui()) { - // create a whole new desktop and window - SPViewWidget *dtw = sp_desktop_widget_new(sp_document_namedview(doc, NULL)); - sp_create_window(dtw, TRUE); - desktop = static_cast(dtw->view); - } else { - desktop = Inkscape::NSApplication::Editor::createDesktop (doc); - } - } - - doc->virgin = FALSE; - // everyone who cares now has a reference, get rid of ours - sp_document_unref(doc); - // resize the window to match the document properties - sp_namedview_window_from_document(desktop); - sp_namedview_update_layers_from_document(desktop); - - if (add_to_recent) { -//--tullarisc prefs_set_recent_file(SP_DOCUMENT_URI(doc), SP_DOCUMENT_NAME(doc)); - } - - return TRUE; - } else { - //FIXME 1 - //gchar *safeUri = Inkscape::IO::sanitizeString(uri.toNativeFilename()); - //gchar *text = g_strdup_printf(_("Failed to load the requested file %s"), safeUri); - //sp_ui_error_dialog(text); - //g_free(text); - //g_free(safeUri); - return FALSE; - } -} - - /** * Handle prompting user for "do you want to revert"? Revert on "OK" */ @@ -403,7 +263,7 @@ sp_file_revert_dialog() SPDesktop *desktop = SP_ACTIVE_DESKTOP; g_assert(desktop != NULL); - Document *doc = sp_desktop_document(desktop); + SPDocument *doc = sp_desktop_document(desktop); g_assert(doc != NULL); Inkscape::XML::Node *repr = sp_document_repr_root(doc); @@ -537,7 +397,6 @@ void dump_ustr(Glib::ustring const &ustr) /** * Display an file Open selector. Open a document if OK is pressed. * Can select single or multiple files for opening. - * NOTE1 */ void sp_file_open_dialog(Gtk::Window &parentWindow, gpointer /*object*/, gpointer /*data*/) @@ -662,7 +521,7 @@ sp_file_open_dialog(Gtk::Window &parentWindow, gpointer /*object*/, gpointer /*d open_path.append(G_DIR_SEPARATOR_S); prefs->setString("/dialogs/open/path", open_path); - sp_file_open_uri(Inkscape::URI(fileName.c_str()), selection); + sp_file_open(fileName, selection); } return; @@ -681,7 +540,7 @@ sp_file_open_dialog(Gtk::Window &parentWindow, gpointer /*object*/, gpointer /*d void sp_file_vacuum() { - Document *doc = SP_ACTIVE_DOCUMENT; + SPDocument *doc = SP_ACTIVE_DOCUMENT; unsigned int diff = vacuum_document (doc); @@ -713,7 +572,7 @@ sp_file_vacuum() * document; is true for normal save, false for temporary saves */ static bool -file_save(Gtk::Window &parentWindow, Document *doc, const Glib::ustring &uri, +file_save(Gtk::Window &parentWindow, SPDocument *doc, const Glib::ustring &uri, Inkscape::Extension::Extension *key, bool saveas, bool official) { if (!doc || uri.size()<1) //Safety check @@ -755,7 +614,7 @@ file_save(Gtk::Window &parentWindow, Document *doc, const Glib::ustring &uri, * Used only for remote saving using VFS and a specific uri. Gets the file at the /tmp. */ bool -file_save_remote(Document */*doc*/, +file_save_remote(SPDocument */*doc*/, #ifdef WITH_GNOME_VFS const Glib::ustring &uri, #else @@ -843,7 +702,7 @@ file_save_remote(Document */*doc*/, * \param ascopy (optional) wether to set the documents->uri to the new filename or not */ bool -sp_file_save_dialog(Gtk::Window &parentWindow, Document *doc, bool is_copy) +sp_file_save_dialog(Gtk::Window &parentWindow, SPDocument *doc, bool is_copy) { Inkscape::XML::Node *repr = sp_document_repr_root(doc); @@ -978,7 +837,7 @@ sp_file_save_dialog(Gtk::Window &parentWindow, Document *doc, bool is_copy) * Save a document, displaying a SaveAs dialog if necessary. */ bool -sp_file_save_document(Gtk::Window &parentWindow, Document *doc) +sp_file_save_document(Gtk::Window &parentWindow, SPDocument *doc) { bool success = true; @@ -1054,13 +913,13 @@ sp_file_save_a_copy(Gtk::Window &parentWindow, gpointer /*object*/, gpointer /*d * Import a resource. Called by sp_file_import() */ void -file_import(Document *in_doc, const Glib::ustring &uri, +file_import(SPDocument *in_doc, const Glib::ustring &uri, Inkscape::Extension::Extension *key) { SPDesktop *desktop = SP_ACTIVE_DESKTOP; //DEBUG_MESSAGE( fileImport, "file_import( in_doc:%p uri:[%s], key:%p", in_doc, uri, key ); - Document *doc; + SPDocument *doc; try { doc = Inkscape::Extension::open(key, uri.c_str()); } catch (Inkscape::Extension::Input::no_extension_found &e) { @@ -1070,7 +929,7 @@ file_import(Document *in_doc, const Glib::ustring &uri, } if (doc != NULL) { - Inkscape::XML::rebase_hrefs((Inkscape::XML::Document *)doc, in_doc->base, true); + Inkscape::XML::rebase_hrefs(doc, in_doc->base, true); Inkscape::XML::Document *xml_in_doc = sp_document_repr_doc(in_doc); prevent_id_clashes(doc, in_doc); @@ -1191,7 +1050,7 @@ sp_file_import(Gtk::Window &parentWindow) { static Glib::ustring import_path; - Document *doc = SP_ACTIVE_DOCUMENT; + SPDocument *doc = SP_ACTIVE_DOCUMENT; if (!doc) return; @@ -1274,7 +1133,7 @@ bool sp_file_export_dialog(void *widget) { //# temp hack for 'doc' until we can switch to this dialog - Document *doc = SP_ACTIVE_DOCUMENT; + SPDocument *doc = SP_ACTIVE_DOCUMENT; Glib::ustring export_path; Glib::ustring export_loc; @@ -1410,7 +1269,7 @@ sp_file_export_to_ocal_dialog(Gtk::Window &parentWindow) if (!SP_ACTIVE_DOCUMENT) return false; - Document *doc = SP_ACTIVE_DOCUMENT; + SPDocument *doc = SP_ACTIVE_DOCUMENT; Glib::ustring export_path; Glib::ustring export_loc; @@ -1568,7 +1427,7 @@ sp_file_import_from_ocal(Gtk::Window &parentWindow) { static Glib::ustring import_path; - Document *doc = SP_ACTIVE_DOCUMENT; + SPDocument *doc = SP_ACTIVE_DOCUMENT; if (!doc) return; @@ -1626,7 +1485,7 @@ sp_file_import_from_ocal(Gtk::Window &parentWindow) void sp_file_print(Gtk::Window& parentWindow) { - Document *doc = SP_ACTIVE_DOCUMENT; + SPDocument *doc = SP_ACTIVE_DOCUMENT; if (doc) sp_print_document(parentWindow, doc); } @@ -1639,7 +1498,7 @@ void sp_file_print_preview(gpointer /*object*/, gpointer /*data*/) { - Document *doc = SP_ACTIVE_DOCUMENT; + SPDocument *doc = SP_ACTIVE_DOCUMENT; if (doc) sp_print_preview_document(doc); diff --git a/src/file.h b/src/file.h index 2eaace640..ce75a61a7 100644 --- a/src/file.h +++ b/src/file.h @@ -21,15 +21,8 @@ #include "extension/extension-forward.h" -#include -#include -#include - -#include "uri.h" -#include "streams-webdav.h" - struct SPDesktop; -struct Document; +struct SPDocument; namespace Inkscape { namespace Extension { @@ -71,17 +64,6 @@ bool sp_file_open( bool replace_empty = true ); -//NOTE1 -/* - * Opens a new file and window from the given URI (class) - */ -bool sp_file_open_uri( - const Inkscape::URI &uri, - Inkscape::Extension::Extension *key, - bool add_to_recent = true, - bool replace_empty = true - ); - /** * Displays a file open dialog. Calls sp_file_open on * an OK. @@ -101,7 +83,7 @@ void sp_file_revert_dialog (); * Added to make only the remote savings. */ -bool file_save_remote(Document *doc, const Glib::ustring &uri, +bool file_save_remote(SPDocument *doc, const Glib::ustring &uri, Inkscape::Extension::Extension *key, bool saveas, bool official); /** @@ -126,10 +108,10 @@ bool sp_file_save_a_copy (Gtk::Window &parentWindow, gpointer object, gpointer d * Saves the given document. Displays a file select dialog * if needed. */ -bool sp_file_save_document (Gtk::Window &parentWindow, Document *document); +bool sp_file_save_document (Gtk::Window &parentWindow, SPDocument *document); /* Do the saveas dialog with a document as the parameter */ -bool sp_file_save_dialog (Gtk::Window &parentWindow, Document *doc, bool bAsCopy = FALSE); +bool sp_file_save_dialog (Gtk::Window &parentWindow, SPDocument *doc, bool bAsCopy = FALSE); /*###################### @@ -145,7 +127,7 @@ void sp_file_import (Gtk::Window &parentWindow); /** * Imports a resource */ -void file_import(Document *in_doc, const Glib::ustring &uri, +void file_import(SPDocument *in_doc, const Glib::ustring &uri, Inkscape::Extension::Extension *key); /*###################### @@ -217,15 +199,6 @@ void sp_file_vacuum (); #endif -//namespace Inkscape { -//namespace Net { - - - -//} -//} -// #endif - /* Local Variables: mode:c++ diff --git a/src/filter-chemistry.cpp b/src/filter-chemistry.cpp index d40347889..363663ac3 100644 --- a/src/filter-chemistry.cpp +++ b/src/filter-chemistry.cpp @@ -88,7 +88,7 @@ static void set_filter_area(Inkscape::XML::Node *repr, gdouble radius, } } -SPFilter *new_filter(Document *document) +SPFilter *new_filter(SPDocument *document) { g_return_val_if_fail(document != NULL, NULL); @@ -184,7 +184,7 @@ filter_add_primitive(SPFilter *filter, const Inkscape::Filters::FilterPrimitiveT * Creates a filter with blur primitive of specified radius for an item with the given matrix expansion, width and height */ SPFilter * -new_filter_gaussian_blur (Document *document, gdouble radius, double expansion, double expansionX, double expansionY, double width, double height) +new_filter_gaussian_blur (SPDocument *document, gdouble radius, double expansion, double expansionX, double expansionY, double width, double height) { g_return_val_if_fail(document != NULL, NULL); @@ -238,7 +238,7 @@ new_filter_gaussian_blur (Document *document, gdouble radius, double expansion, * an item with the given matrix expansion, width and height */ SPFilter * -new_filter_blend_gaussian_blur (Document *document, const char *blendmode, gdouble radius, double expansion, +new_filter_blend_gaussian_blur (SPDocument *document, const char *blendmode, gdouble radius, double expansion, double expansionX, double expansionY, double width, double height) { g_return_val_if_fail(document != NULL, NULL); @@ -317,7 +317,7 @@ new_filter_blend_gaussian_blur (Document *document, const char *blendmode, gdoub * specified mode and radius, respectively */ SPFilter * -new_filter_simple_from_item (Document *document, SPItem *item, const char *mode, gdouble radius) +new_filter_simple_from_item (SPDocument *document, SPItem *item, const char *mode, gdouble radius) { Geom::OptRect const r = sp_item_bbox_desktop(item, SPItem::GEOMETRIC_BBOX); @@ -345,7 +345,7 @@ new_filter_simple_from_item (Document *document, SPItem *item, const char *mode, */ /* TODO: this should be made more generic, not just for blurs */ SPFilter * -modify_filter_gaussian_blur_from_item(Document *document, SPItem *item, +modify_filter_gaussian_blur_from_item(SPDocument *document, SPItem *item, gdouble radius) { if (!item->style || !item->style->filter.set) { diff --git a/src/filter-chemistry.h b/src/filter-chemistry.h index ee249d6f2..1b18ec11a 100644 --- a/src/filter-chemistry.h +++ b/src/filter-chemistry.h @@ -18,10 +18,10 @@ #include "sp-filter.h" SPFilterPrimitive *filter_add_primitive(SPFilter *filter, Inkscape::Filters::FilterPrimitiveType); -SPFilter *new_filter (Document *document); -SPFilter *new_filter_gaussian_blur (Document *document, gdouble stdDeviation, double expansion, double expansionX, double expansionY, double width, double height); -SPFilter *new_filter_simple_from_item (Document *document, SPItem *item, const char *mode, gdouble stdDeviation); -SPFilter *modify_filter_gaussian_blur_from_item (Document *document, SPItem *item, gdouble stdDeviation); +SPFilter *new_filter (SPDocument *document); +SPFilter *new_filter_gaussian_blur (SPDocument *document, gdouble stdDeviation, double expansion, double expansionX, double expansionY, double width, double height); +SPFilter *new_filter_simple_from_item (SPDocument *document, SPItem *item, const char *mode, gdouble stdDeviation); +SPFilter *modify_filter_gaussian_blur_from_item (SPDocument *document, SPItem *item, gdouble stdDeviation); void remove_filter (SPObject *item, bool recursive); void remove_filter_gaussian_blur (SPObject *item); bool filter_is_single_gaussian_blur(SPFilter *filter); diff --git a/src/filters/blend.cpp b/src/filters/blend.cpp index 26db781a0..5998d7be3 100644 --- a/src/filters/blend.cpp +++ b/src/filters/blend.cpp @@ -35,7 +35,7 @@ static void sp_feBlend_class_init(SPFeBlendClass *klass); static void sp_feBlend_init(SPFeBlend *feBlend); -static void sp_feBlend_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_feBlend_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_feBlend_release(SPObject *object); static void sp_feBlend_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feBlend_update(SPObject *object, SPCtx *ctx, guint flags); @@ -94,7 +94,7 @@ sp_feBlend_init(SPFeBlend *feBlend) * sp-object-repr.cpp's repr_name_entries array. */ static void -sp_feBlend_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +sp_feBlend_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { SPFeBlend *blend = SP_FEBLEND(object); diff --git a/src/filters/colormatrix.cpp b/src/filters/colormatrix.cpp index f3c336d71..55cfcbeb7 100644 --- a/src/filters/colormatrix.cpp +++ b/src/filters/colormatrix.cpp @@ -34,7 +34,7 @@ static void sp_feColorMatrix_class_init(SPFeColorMatrixClass *klass); static void sp_feColorMatrix_init(SPFeColorMatrix *feColorMatrix); -static void sp_feColorMatrix_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_feColorMatrix_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_feColorMatrix_release(SPObject *object); static void sp_feColorMatrix_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feColorMatrix_update(SPObject *object, SPCtx *ctx, guint flags); @@ -91,7 +91,7 @@ sp_feColorMatrix_init(SPFeColorMatrix */*feColorMatrix*/) * sp-object-repr.cpp's repr_name_entries array. */ static void -sp_feColorMatrix_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +sp_feColorMatrix_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) feColorMatrix_parent_class)->build) { ((SPObjectClass *) feColorMatrix_parent_class)->build(object, document, repr); diff --git a/src/filters/componenttransfer-funcnode.cpp b/src/filters/componenttransfer-funcnode.cpp index f74da8154..e66f85e70 100644 --- a/src/filters/componenttransfer-funcnode.cpp +++ b/src/filters/componenttransfer-funcnode.cpp @@ -36,7 +36,7 @@ static void sp_fefuncnode_class_init(SPFeFuncNodeClass *klass); static void sp_fefuncnode_init(SPFeFuncNode *fefuncnode); -static void sp_fefuncnode_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_fefuncnode_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_fefuncnode_release(SPObject *object); static void sp_fefuncnode_set(SPObject *object, unsigned int key, gchar const *value); static void sp_fefuncnode_update(SPObject *object, SPCtx *ctx, guint flags); @@ -161,7 +161,7 @@ sp_fefuncnode_init(SPFeFuncNode *fefuncnode) * sp-object-repr.cpp's repr_name_entries array. */ static void -sp_fefuncnode_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +sp_fefuncnode_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) feFuncNode_parent_class)->build) { ((SPObjectClass *) feFuncNode_parent_class)->build(object, document, repr); diff --git a/src/filters/componenttransfer.cpp b/src/filters/componenttransfer.cpp index fbfca3a35..557d884e0 100644 --- a/src/filters/componenttransfer.cpp +++ b/src/filters/componenttransfer.cpp @@ -32,7 +32,7 @@ static void sp_feComponentTransfer_class_init(SPFeComponentTransferClass *klass); static void sp_feComponentTransfer_init(SPFeComponentTransfer *feComponentTransfer); -static void sp_feComponentTransfer_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_feComponentTransfer_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_feComponentTransfer_release(SPObject *object); static void sp_feComponentTransfer_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feComponentTransfer_update(SPObject *object, SPCtx *ctx, guint flags); @@ -91,7 +91,7 @@ sp_feComponentTransfer_init(SPFeComponentTransfer */*feComponentTransfer*/) * sp-object-repr.cpp's repr_name_entries array. */ static void -sp_feComponentTransfer_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +sp_feComponentTransfer_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) feComponentTransfer_parent_class)->build) { ((SPObjectClass *) feComponentTransfer_parent_class)->build(object, document, repr); diff --git a/src/filters/composite.cpp b/src/filters/composite.cpp index 8265a611c..93c692f94 100644 --- a/src/filters/composite.cpp +++ b/src/filters/composite.cpp @@ -29,7 +29,7 @@ static void sp_feComposite_class_init(SPFeCompositeClass *klass); static void sp_feComposite_init(SPFeComposite *feComposite); -static void sp_feComposite_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_feComposite_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_feComposite_release(SPObject *object); static void sp_feComposite_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feComposite_update(SPObject *object, SPCtx *ctx, guint flags); @@ -93,7 +93,7 @@ sp_feComposite_init(SPFeComposite *feComposite) * sp-object-repr.cpp's repr_name_entries array. */ static void -sp_feComposite_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +sp_feComposite_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) feComposite_parent_class)->build) { ((SPObjectClass *) feComposite_parent_class)->build(object, document, repr); diff --git a/src/filters/convolvematrix.cpp b/src/filters/convolvematrix.cpp index cc9d62f8f..3e1c36f0a 100644 --- a/src/filters/convolvematrix.cpp +++ b/src/filters/convolvematrix.cpp @@ -34,7 +34,7 @@ static void sp_feConvolveMatrix_class_init(SPFeConvolveMatrixClass *klass); static void sp_feConvolveMatrix_init(SPFeConvolveMatrix *feConvolveMatrix); -static void sp_feConvolveMatrix_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_feConvolveMatrix_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_feConvolveMatrix_release(SPObject *object); static void sp_feConvolveMatrix_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feConvolveMatrix_update(SPObject *object, SPCtx *ctx, guint flags); @@ -103,7 +103,7 @@ sp_feConvolveMatrix_init(SPFeConvolveMatrix *feConvolveMatrix) * sp-object-repr.cpp's repr_name_entries array. */ static void -sp_feConvolveMatrix_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +sp_feConvolveMatrix_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) feConvolveMatrix_parent_class)->build) { ((SPObjectClass *) feConvolveMatrix_parent_class)->build(object, document, repr); diff --git a/src/filters/diffuselighting.cpp b/src/filters/diffuselighting.cpp index e494e8ccd..bdc569083 100644 --- a/src/filters/diffuselighting.cpp +++ b/src/filters/diffuselighting.cpp @@ -32,7 +32,7 @@ static void sp_feDiffuseLighting_class_init(SPFeDiffuseLightingClass *klass); static void sp_feDiffuseLighting_init(SPFeDiffuseLighting *feDiffuseLighting); -static void sp_feDiffuseLighting_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_feDiffuseLighting_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_feDiffuseLighting_release(SPObject *object); static void sp_feDiffuseLighting_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feDiffuseLighting_update(SPObject *object, SPCtx *ctx, guint flags); @@ -111,7 +111,7 @@ sp_feDiffuseLighting_init(SPFeDiffuseLighting *feDiffuseLighting) * sp-object-repr.cpp's repr_name_entries array. */ static void -sp_feDiffuseLighting_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +sp_feDiffuseLighting_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) feDiffuseLighting_parent_class)->build) { ((SPObjectClass *) feDiffuseLighting_parent_class)->build(object, document, repr); diff --git a/src/filters/displacementmap.cpp b/src/filters/displacementmap.cpp index b05ee4db1..baa17d785 100644 --- a/src/filters/displacementmap.cpp +++ b/src/filters/displacementmap.cpp @@ -29,7 +29,7 @@ static void sp_feDisplacementMap_class_init(SPFeDisplacementMapClass *klass); static void sp_feDisplacementMap_init(SPFeDisplacementMap *feDisplacementMap); -static void sp_feDisplacementMap_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_feDisplacementMap_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_feDisplacementMap_release(SPObject *object); static void sp_feDisplacementMap_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feDisplacementMap_update(SPObject *object, SPCtx *ctx, guint flags); @@ -90,7 +90,7 @@ sp_feDisplacementMap_init(SPFeDisplacementMap *feDisplacementMap) * sp-object-repr.cpp's repr_name_entries array. */ static void -sp_feDisplacementMap_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +sp_feDisplacementMap_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) feDisplacementMap_parent_class)->build) { ((SPObjectClass *) feDisplacementMap_parent_class)->build(object, document, repr); diff --git a/src/filters/distantlight.cpp b/src/filters/distantlight.cpp index f25094798..41584c4a4 100644 --- a/src/filters/distantlight.cpp +++ b/src/filters/distantlight.cpp @@ -35,7 +35,7 @@ static void sp_fedistantlight_class_init(SPFeDistantLightClass *klass); static void sp_fedistantlight_init(SPFeDistantLight *fedistantlight); -static void sp_fedistantlight_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_fedistantlight_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_fedistantlight_release(SPObject *object); static void sp_fedistantlight_set(SPObject *object, unsigned int key, gchar const *value); static void sp_fedistantlight_update(SPObject *object, SPCtx *ctx, guint flags); @@ -94,7 +94,7 @@ sp_fedistantlight_init(SPFeDistantLight *fedistantlight) * sp-object-repr.cpp's repr_name_entries array. */ static void -sp_fedistantlight_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +sp_fedistantlight_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) feDistantLight_parent_class)->build) { ((SPObjectClass *) feDistantLight_parent_class)->build(object, document, repr); diff --git a/src/filters/flood.cpp b/src/filters/flood.cpp index 941f36113..625e35d42 100644 --- a/src/filters/flood.cpp +++ b/src/filters/flood.cpp @@ -29,7 +29,7 @@ static void sp_feFlood_class_init(SPFeFloodClass *klass); static void sp_feFlood_init(SPFeFlood *feFlood); -static void sp_feFlood_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_feFlood_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_feFlood_release(SPObject *object); static void sp_feFlood_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feFlood_update(SPObject *object, SPCtx *ctx, guint flags); @@ -87,7 +87,7 @@ sp_feFlood_init(SPFeFlood *feFlood) * sp-object-repr.cpp's repr_name_entries array. */ static void -sp_feFlood_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +sp_feFlood_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) feFlood_parent_class)->build) { ((SPObjectClass *) feFlood_parent_class)->build(object, document, repr); diff --git a/src/filters/image.cpp b/src/filters/image.cpp index bdfbadee0..0002ef94c 100644 --- a/src/filters/image.cpp +++ b/src/filters/image.cpp @@ -34,7 +34,7 @@ static void sp_feImage_class_init(SPFeImageClass *klass); static void sp_feImage_init(SPFeImage *feImage); -static void sp_feImage_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_feImage_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_feImage_release(SPObject *object); static void sp_feImage_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feImage_update(SPObject *object, SPCtx *ctx, guint flags); @@ -92,7 +92,7 @@ sp_feImage_init(SPFeImage */*feImage*/) * sp-object-repr.cpp's repr_name_entries array. */ static void -sp_feImage_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +sp_feImage_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { // Save document reference so we can load images with relative paths. SPFeImage *feImage = SP_FEIMAGE(object); diff --git a/src/filters/image.h b/src/filters/image.h index 74352db80..7207918e1 100644 --- a/src/filters/image.h +++ b/src/filters/image.h @@ -27,7 +27,7 @@ struct SPFeImage : public SPFilterPrimitive { /** IMAGE ATTRIBUTES HERE */ gchar *href; SVGLength x, y, height, width; - Document *document; + SPDocument *document; bool from_element; SPItem* SVGElem; Inkscape::URIReference* SVGElemRef; diff --git a/src/filters/merge.cpp b/src/filters/merge.cpp index 9d82da7ae..437cb4b55 100644 --- a/src/filters/merge.cpp +++ b/src/filters/merge.cpp @@ -30,7 +30,7 @@ static void sp_feMerge_class_init(SPFeMergeClass *klass); static void sp_feMerge_init(SPFeMerge *feMerge); -static void sp_feMerge_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_feMerge_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_feMerge_release(SPObject *object); static void sp_feMerge_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feMerge_update(SPObject *object, SPCtx *ctx, guint flags); @@ -88,7 +88,7 @@ sp_feMerge_init(SPFeMerge */*feMerge*/) * sp-object-repr.cpp's repr_name_entries array. */ static void -sp_feMerge_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +sp_feMerge_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) feMerge_parent_class)->build) { ((SPObjectClass *) feMerge_parent_class)->build(object, document, repr); diff --git a/src/filters/mergenode.cpp b/src/filters/mergenode.cpp index 42b4bc8db..8a4e0dd0a 100644 --- a/src/filters/mergenode.cpp +++ b/src/filters/mergenode.cpp @@ -26,7 +26,7 @@ static void sp_feMergeNode_class_init(SPFeMergeNodeClass *klass); static void sp_feMergeNode_init(SPFeMergeNode *skeleton); -static void sp_feMergeNode_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_feMergeNode_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_feMergeNode_release(SPObject *object); static void sp_feMergeNode_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feMergeNode_update(SPObject *object, SPCtx *ctx, guint flags); @@ -82,7 +82,7 @@ sp_feMergeNode_init(SPFeMergeNode *feMergeNode) * sp-object-repr.cpp's repr_name_entries array. */ static void -sp_feMergeNode_build(SPObject *object, Document */*document*/, Inkscape::XML::Node */*repr*/) +sp_feMergeNode_build(SPObject *object, SPDocument */*document*/, Inkscape::XML::Node */*repr*/) { sp_object_read_attr(object, "in"); } diff --git a/src/filters/morphology.cpp b/src/filters/morphology.cpp index 6d91d9905..9a34bbccb 100644 --- a/src/filters/morphology.cpp +++ b/src/filters/morphology.cpp @@ -31,7 +31,7 @@ static void sp_feMorphology_class_init(SPFeMorphologyClass *klass); static void sp_feMorphology_init(SPFeMorphology *feMorphology); -static void sp_feMorphology_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_feMorphology_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_feMorphology_release(SPObject *object); static void sp_feMorphology_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feMorphology_update(SPObject *object, SPCtx *ctx, guint flags); @@ -90,7 +90,7 @@ sp_feMorphology_init(SPFeMorphology *feMorphology) * sp-object-repr.cpp's repr_name_entries array. */ static void -sp_feMorphology_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +sp_feMorphology_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) feMorphology_parent_class)->build) { ((SPObjectClass *) feMorphology_parent_class)->build(object, document, repr); diff --git a/src/filters/offset.cpp b/src/filters/offset.cpp index 3ae6994ce..61ea45ff2 100644 --- a/src/filters/offset.cpp +++ b/src/filters/offset.cpp @@ -30,7 +30,7 @@ static void sp_feOffset_class_init(SPFeOffsetClass *klass); static void sp_feOffset_init(SPFeOffset *feOffset); -static void sp_feOffset_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_feOffset_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_feOffset_release(SPObject *object); static void sp_feOffset_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feOffset_update(SPObject *object, SPCtx *ctx, guint flags); @@ -90,7 +90,7 @@ sp_feOffset_init(SPFeOffset *feOffset) * sp-object-repr.cpp's repr_name_entries array. */ static void -sp_feOffset_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +sp_feOffset_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) feOffset_parent_class)->build) { ((SPObjectClass *) feOffset_parent_class)->build(object, document, repr); diff --git a/src/filters/pointlight.cpp b/src/filters/pointlight.cpp index cc56b5f01..ce58cf13e 100644 --- a/src/filters/pointlight.cpp +++ b/src/filters/pointlight.cpp @@ -35,7 +35,7 @@ static void sp_fepointlight_class_init(SPFePointLightClass *klass); static void sp_fepointlight_init(SPFePointLight *fepointlight); -static void sp_fepointlight_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_fepointlight_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_fepointlight_release(SPObject *object); static void sp_fepointlight_set(SPObject *object, unsigned int key, gchar const *value); static void sp_fepointlight_update(SPObject *object, SPCtx *ctx, guint flags); @@ -97,7 +97,7 @@ sp_fepointlight_init(SPFePointLight *fepointlight) * sp-object-repr.cpp's repr_name_entries array. */ static void -sp_fepointlight_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +sp_fepointlight_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) fePointLight_parent_class)->build) { ((SPObjectClass *) fePointLight_parent_class)->build(object, document, repr); diff --git a/src/filters/specularlighting.cpp b/src/filters/specularlighting.cpp index 9a3ac6811..03a0c7f96 100644 --- a/src/filters/specularlighting.cpp +++ b/src/filters/specularlighting.cpp @@ -32,7 +32,7 @@ static void sp_feSpecularLighting_class_init(SPFeSpecularLightingClass *klass); static void sp_feSpecularLighting_init(SPFeSpecularLighting *feSpecularLighting); -static void sp_feSpecularLighting_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_feSpecularLighting_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_feSpecularLighting_release(SPObject *object); static void sp_feSpecularLighting_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feSpecularLighting_update(SPObject *object, SPCtx *ctx, guint flags); @@ -113,7 +113,7 @@ sp_feSpecularLighting_init(SPFeSpecularLighting *feSpecularLighting) * sp-object-repr.cpp's repr_name_entries array. */ static void -sp_feSpecularLighting_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +sp_feSpecularLighting_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) feSpecularLighting_parent_class)->build) { ((SPObjectClass *) feSpecularLighting_parent_class)->build(object, document, repr); diff --git a/src/filters/spotlight.cpp b/src/filters/spotlight.cpp index bd5d06f73..3b518f0b4 100644 --- a/src/filters/spotlight.cpp +++ b/src/filters/spotlight.cpp @@ -35,7 +35,7 @@ static void sp_fespotlight_class_init(SPFeSpotLightClass *klass); static void sp_fespotlight_init(SPFeSpotLight *fespotlight); -static void sp_fespotlight_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_fespotlight_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_fespotlight_release(SPObject *object); static void sp_fespotlight_set(SPObject *object, unsigned int key, gchar const *value); static void sp_fespotlight_update(SPObject *object, SPCtx *ctx, guint flags); @@ -107,7 +107,7 @@ sp_fespotlight_init(SPFeSpotLight *fespotlight) * sp-object-repr.cpp's repr_name_entries array. */ static void -sp_fespotlight_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +sp_fespotlight_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) feSpotLight_parent_class)->build) { ((SPObjectClass *) feSpotLight_parent_class)->build(object, document, repr); diff --git a/src/filters/tile.cpp b/src/filters/tile.cpp index 7bf03cde3..877f70b27 100644 --- a/src/filters/tile.cpp +++ b/src/filters/tile.cpp @@ -28,7 +28,7 @@ static void sp_feTile_class_init(SPFeTileClass *klass); static void sp_feTile_init(SPFeTile *feTile); -static void sp_feTile_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_feTile_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_feTile_release(SPObject *object); static void sp_feTile_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feTile_update(SPObject *object, SPCtx *ctx, guint flags); @@ -85,7 +85,7 @@ sp_feTile_init(SPFeTile */*feTile*/) * sp-object-repr.cpp's repr_name_entries array. */ static void -sp_feTile_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +sp_feTile_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) feTile_parent_class)->build) { ((SPObjectClass *) feTile_parent_class)->build(object, document, repr); diff --git a/src/filters/turbulence.cpp b/src/filters/turbulence.cpp index e348f796f..f3c143056 100644 --- a/src/filters/turbulence.cpp +++ b/src/filters/turbulence.cpp @@ -34,7 +34,7 @@ static void sp_feTurbulence_class_init(SPFeTurbulenceClass *klass); static void sp_feTurbulence_init(SPFeTurbulence *feTurbulence); -static void sp_feTurbulence_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_feTurbulence_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_feTurbulence_release(SPObject *object); static void sp_feTurbulence_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feTurbulence_update(SPObject *object, SPCtx *ctx, guint flags); @@ -93,7 +93,7 @@ sp_feTurbulence_init(SPFeTurbulence *feTurbulence) * sp-object-repr.cpp's repr_name_entries array. */ static void -sp_feTurbulence_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +sp_feTurbulence_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) feTurbulence_parent_class)->build) { ((SPObjectClass *) feTurbulence_parent_class)->build(object, document, repr); diff --git a/src/flood-context.cpp b/src/flood-context.cpp index 9855c42f1..7b6223384 100644 --- a/src/flood-context.cpp +++ b/src/flood-context.cpp @@ -394,7 +394,7 @@ inline static bool check_if_pixel_is_paintable(guchar *px, unsigned char *trace_ * \param union_with_selection If true, merge the final SVG path with the current selection. */ static void do_trace(bitmap_coords_info bci, guchar *trace_px, SPDesktop *desktop, Geom::Matrix transform, unsigned int min_x, unsigned int max_x, unsigned int min_y, unsigned int max_y, bool union_with_selection) { - Document *document = sp_desktop_document(desktop); + SPDocument *document = sp_desktop_document(desktop); unsigned char *trace_t; @@ -770,7 +770,7 @@ static bool sort_fill_queue_horizontal(Geom::Point a, Geom::Point b) { */ static void sp_flood_do_flood_fill(SPEventContext *event_context, GdkEvent *event, bool union_with_selection, bool is_point_fill, bool is_touch_fill) { SPDesktop *desktop = event_context->desktop; - Document *document = sp_desktop_document(desktop); + SPDocument *document = sp_desktop_document(desktop); /* Create new arena */ NRArena *arena = NRArena::create(); diff --git a/src/forward.h b/src/forward.h index 4ac08c126..d4a98fbff 100644 --- a/src/forward.h +++ b/src/forward.h @@ -20,10 +20,6 @@ namespace Inkscape { struct Application; struct ApplicationClass; -namespace XML { -class Document; -class DocumentTree; -} } /* Editing window */ @@ -47,10 +43,11 @@ GType sp_event_context_get_type (); /* Document tree */ +class SPDocument; class SPDocumentClass; #define SP_TYPE_DOCUMENT (sp_document_get_type ()) -#define SP_DOCUMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_DOCUMENT, Document)) +#define SP_DOCUMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_DOCUMENT, SPDocument)) #define SP_IS_DOCUMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_DOCUMENT)) GType sp_document_get_type (); diff --git a/src/gradient-chemistry.cpp b/src/gradient-chemistry.cpp index 85e4e2c55..4abd7483f 100644 --- a/src/gradient-chemistry.cpp +++ b/src/gradient-chemistry.cpp @@ -92,7 +92,7 @@ sp_gradient_ensure_vector_normalized(SPGradient *gr) */ static SPGradient * -sp_gradient_get_private_normalized(Document *document, SPGradient *vector, SPGradientType type) +sp_gradient_get_private_normalized(SPDocument *document, SPGradient *vector, SPGradientType type) { g_return_val_if_fail(document != NULL, NULL); g_return_val_if_fail(vector != NULL, NULL); @@ -199,7 +199,7 @@ sp_gradient_fork_private_if_necessary(SPGradient *gr, SPGradient *vector, return gr; } - Document *doc = SP_OBJECT_DOCUMENT(gr); + SPDocument *doc = SP_OBJECT_DOCUMENT(gr); SPObject *defs = SP_DOCUMENT_DEFS(doc); if ((gr->has_stops) || @@ -245,7 +245,7 @@ sp_gradient_fork_vector_if_necessary (SPGradient *gr) return gr; if (SP_OBJECT_HREFCOUNT(gr) > 1) { - Document *doc = SP_OBJECT_DOCUMENT(gr); + SPDocument *doc = SP_OBJECT_DOCUMENT(gr); Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc); Inkscape::XML::Node *repr = SP_OBJECT_REPR (gr)->duplicate(xml_doc); @@ -1210,7 +1210,7 @@ sp_gradient_repr_set_link(Inkscape::XML::Node *repr, SPGradient *link) */ SPGradient * -sp_document_default_gradient_vector(Document *document, guint32 color) +sp_document_default_gradient_vector(SPDocument *document, guint32 color) { SPDefs *defs = (SPDefs *) SP_DOCUMENT_DEFS(document); Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document); @@ -1271,7 +1271,7 @@ Return the preferred vector for \a o, made from (in order of preference) its cur current fill or stroke color, or from desktop style if \a o is NULL or doesn't have style. */ SPGradient * -sp_gradient_vector_for_object(Document *const doc, SPDesktop *const desktop, +sp_gradient_vector_for_object(SPDocument *const doc, SPDesktop *const desktop, SPObject *const o, bool const is_fill) { guint32 rgba = 0; diff --git a/src/gradient-chemistry.h b/src/gradient-chemistry.h index 94351d483..73b9893bc 100644 --- a/src/gradient-chemistry.h +++ b/src/gradient-chemistry.h @@ -41,8 +41,8 @@ SPGradient *sp_item_set_gradient (SPItem *item, SPGradient *gr, SPGradientType t * Get default normalized gradient vector of document, create if there is none */ -SPGradient *sp_document_default_gradient_vector (Document *document, guint32 color = 0); -SPGradient *sp_gradient_vector_for_object (Document *doc, SPDesktop *desktop, SPObject *o, bool is_fill); +SPGradient *sp_document_default_gradient_vector (SPDocument *document, guint32 color = 0); +SPGradient *sp_gradient_vector_for_object (SPDocument *doc, SPDesktop *desktop, SPObject *o, bool is_fill); void sp_object_ensure_fill_gradient_normalized (SPObject *object); void sp_object_ensure_stroke_gradient_normalized (SPObject *object); diff --git a/src/gradient-context.cpp b/src/gradient-context.cpp index 64a836b8f..fc5c1af44 100644 --- a/src/gradient-context.cpp +++ b/src/gradient-context.cpp @@ -346,7 +346,7 @@ sp_gradient_context_get_stop_intervals (GrDrag *drag, GSList **these_stops, GSLi static void sp_gradient_context_add_stops_between_selected_stops (SPGradientContext *rc) { - Document *doc = NULL; + SPDocument *doc = NULL; GrDrag *drag = rc->_grdrag; GSList *these_stops = NULL; @@ -403,7 +403,7 @@ double sqr(double x) {return x*x;} static void sp_gradient_simplify(SPGradientContext *rc, double tolerance) { - Document *doc = NULL; + SPDocument *doc = NULL; GrDrag *drag = rc->_grdrag; GSList *these_stops = NULL; @@ -861,7 +861,7 @@ static void sp_gradient_drag(SPGradientContext &rc, Geom::Point const pt, guint { SPDesktop *desktop = SP_EVENT_CONTEXT(&rc)->desktop; Inkscape::Selection *selection = sp_desktop_selection(desktop); - Document *document = sp_desktop_document(desktop); + SPDocument *document = sp_desktop_document(desktop); SPEventContext *ec = SP_EVENT_CONTEXT(&rc); if (!selection->isEmpty()) { diff --git a/src/gradient-drag.cpp b/src/gradient-drag.cpp index 65f310e6a..c16ed2456 100644 --- a/src/gradient-drag.cpp +++ b/src/gradient-drag.cpp @@ -1914,7 +1914,7 @@ GrDrag::deleteSelected (bool just_one) { if (!selected) return; - Document *document = false; + SPDocument *document = false; struct StructStopInfo { SPStop * spstop; diff --git a/src/helper/action.cpp b/src/helper/action.cpp index 8c2705e45..84d150615 100644 --- a/src/helper/action.cpp +++ b/src/helper/action.cpp @@ -132,7 +132,7 @@ public: { _addProperty(share_static_string("timestamp"), timestamp()); if (action->view) { - Document *document = action->view->doc(); + SPDocument *document = action->view->doc(); if (document) { _addProperty(share_static_string("document"), document->serial()); } diff --git a/src/helper/pixbuf-ops.cpp b/src/helper/pixbuf-ops.cpp index 1e364a37c..f41342e42 100644 --- a/src/helper/pixbuf-ops.cpp +++ b/src/helper/pixbuf-ops.cpp @@ -66,7 +66,7 @@ hide_other_items_recursively(SPObject *o, GSList *list, unsigned dkey) // to the call for the interface to the png writing. bool -sp_export_jpg_file(Document *doc, gchar const *filename, +sp_export_jpg_file(SPDocument *doc, gchar const *filename, double x0, double y0, double x1, double y1, unsigned width, unsigned height, double xdpi, double ydpi, unsigned long bgcolor, double quality,GSList *items) @@ -90,7 +90,7 @@ sp_export_jpg_file(Document *doc, gchar const *filename, } GdkPixbuf* -sp_generate_internal_bitmap(Document *doc, gchar const */*filename*/, +sp_generate_internal_bitmap(SPDocument *doc, gchar const */*filename*/, double x0, double y0, double x1, double y1, unsigned width, unsigned height, double xdpi, double ydpi, unsigned long bgcolor, diff --git a/src/helper/pixbuf-ops.h b/src/helper/pixbuf-ops.h index de6a80181..a985be297 100644 --- a/src/helper/pixbuf-ops.h +++ b/src/helper/pixbuf-ops.h @@ -14,12 +14,12 @@ #include -struct Document; +struct SPDocument; -bool sp_export_jpg_file (Document *doc, gchar const *filename, double x0, double y0, double x1, double y1, +bool sp_export_jpg_file (SPDocument *doc, gchar const *filename, double x0, double y0, double x1, double y1, unsigned int width, unsigned int height, double xdpi, double ydpi, unsigned long bgcolor, double quality, GSList *items_only = NULL); -GdkPixbuf* sp_generate_internal_bitmap(Document *doc, gchar const *filename, +GdkPixbuf* sp_generate_internal_bitmap(SPDocument *doc, gchar const *filename, double x0, double y0, double x1, double y1, unsigned width, unsigned height, double xdpi, double ydpi, unsigned long bgcolor, GSList *items_only = NULL); diff --git a/src/helper/png-write.cpp b/src/helper/png-write.cpp index ad1b43c55..3ac900680 100644 --- a/src/helper/png-write.cpp +++ b/src/helper/png-write.cpp @@ -120,7 +120,7 @@ void PngTextList::add(gchar const* key, gchar const* text) } static bool -sp_png_write_rgba_striped(Document *doc, +sp_png_write_rgba_striped(SPDocument *doc, gchar const *filename, unsigned long int width, unsigned long int height, double xdpi, double ydpi, int (* get_rows)(guchar const **rows, int row, int num_rows, void *data), void *data) @@ -388,7 +388,7 @@ hide_other_items_recursively(SPObject *o, GSList *list, unsigned dkey) * * \return true if succeeded (or if no action was taken), false if an error occurred. */ -bool sp_export_png_file (Document *doc, gchar const *filename, +bool sp_export_png_file (SPDocument *doc, gchar const *filename, double x0, double y0, double x1, double y1, unsigned long int width, unsigned long int height, double xdpi, double ydpi, unsigned long bgcolor, @@ -400,7 +400,7 @@ bool sp_export_png_file (Document *doc, gchar const *filename, width, height, xdpi, ydpi, bgcolor, status, data, force_overwrite, items_only); } bool -sp_export_png_file(Document *doc, gchar const *filename, +sp_export_png_file(SPDocument *doc, gchar const *filename, Geom::Rect const &area, unsigned long width, unsigned long height, double xdpi, double ydpi, unsigned long bgcolor, diff --git a/src/helper/png-write.h b/src/helper/png-write.h index f7e372e0b..83321aa4e 100644 --- a/src/helper/png-write.h +++ b/src/helper/png-write.h @@ -14,14 +14,14 @@ #include #include <2geom/forward.h> -struct Document; +struct SPDocument; -bool sp_export_png_file (Document *doc, gchar const *filename, +bool sp_export_png_file (SPDocument *doc, gchar const *filename, double x0, double y0, double x1, double y1, unsigned long int width, unsigned long int height, double xdpi, double ydpi, unsigned long bgcolor, unsigned int (*status) (float, void *), void *data, bool force_overwrite = false, GSList *items_only = NULL); -bool sp_export_png_file (Document *doc, gchar const *filename, +bool sp_export_png_file (SPDocument *doc, gchar const *filename, Geom::Rect const &area, unsigned long int width, unsigned long int height, double xdpi, double ydpi, unsigned long bgcolor, diff --git a/src/helper/stock-items.cpp b/src/helper/stock-items.cpp index 936397480..575197fee 100644 --- a/src/helper/stock-items.cpp +++ b/src/helper/stock-items.cpp @@ -35,9 +35,9 @@ -static SPObject *sp_gradient_load_from_svg(gchar const *name, Document *current_doc); -static SPObject *sp_marker_load_from_svg(gchar const *name, Document *current_doc); -static SPObject *sp_gradient_load_from_svg(gchar const *name, Document *current_doc); +static SPObject *sp_gradient_load_from_svg(gchar const *name, SPDocument *current_doc); +static SPObject *sp_marker_load_from_svg(gchar const *name, SPDocument *current_doc); +static SPObject *sp_gradient_load_from_svg(gchar const *name, SPDocument *current_doc); // FIXME: these should be merged with the icon loading code so they @@ -45,9 +45,9 @@ static SPObject *sp_gradient_load_from_svg(gchar const *name, Document *current_ // take the dir to look in, and the file to check for, and cache // against that, rather than the existing copy/paste code seen here. -static SPObject * sp_marker_load_from_svg(gchar const *name, Document *current_doc) +static SPObject * sp_marker_load_from_svg(gchar const *name, SPDocument *current_doc) { - static Document *doc = NULL; + static SPDocument *doc = NULL; static unsigned int edoc = FALSE; if (!current_doc) { return NULL; @@ -83,9 +83,9 @@ static SPObject * sp_marker_load_from_svg(gchar const *name, Document *current_d static SPObject * -sp_pattern_load_from_svg(gchar const *name, Document *current_doc) +sp_pattern_load_from_svg(gchar const *name, SPDocument *current_doc) { - static Document *doc = NULL; + static SPDocument *doc = NULL; static unsigned int edoc = FALSE; if (!current_doc) { return NULL; @@ -126,9 +126,9 @@ sp_pattern_load_from_svg(gchar const *name, Document *current_doc) static SPObject * -sp_gradient_load_from_svg(gchar const *name, Document *current_doc) +sp_gradient_load_from_svg(gchar const *name, SPDocument *current_doc) { - static Document *doc = NULL; + static SPDocument *doc = NULL; static unsigned int edoc = FALSE; if (!current_doc) { return NULL; @@ -194,7 +194,7 @@ SPObject *get_stock_item(gchar const *urn) gchar * base = g_strndup(e, a); SPDesktop *desktop = inkscape_active_desktop(); - Document *doc = sp_desktop_document(desktop); + SPDocument *doc = sp_desktop_document(desktop); SPDefs *defs= (SPDefs *) SP_DOCUMENT_DEFS(doc); SPObject *object = NULL; @@ -263,7 +263,7 @@ SPObject *get_stock_item(gchar const *urn) else { SPDesktop *desktop = inkscape_active_desktop(); - Document *doc = sp_desktop_document(desktop); + SPDocument *doc = sp_desktop_document(desktop); SPObject *object = doc->getObjectById(urn); return object; diff --git a/src/id-clash.cpp b/src/id-clash.cpp index e739c4e4c..b215576a4 100644 --- a/src/id-clash.cpp +++ b/src/id-clash.cpp @@ -177,7 +177,7 @@ find_references(SPObject *elem, refmap_type *refmap) * a list of those changes that will require fixing up references. */ static void -change_clashing_ids(Document *imported_doc, Document *current_doc, +change_clashing_ids(SPDocument *imported_doc, SPDocument *current_doc, SPObject *elem, const refmap_type *refmap, id_changelist_type *id_changes) { @@ -259,7 +259,7 @@ fix_up_refs(const refmap_type *refmap, const id_changelist_type &id_changes) * those IDs are updated accordingly. */ void -prevent_id_clashes(Document *imported_doc, Document *current_doc) +prevent_id_clashes(SPDocument *imported_doc, SPDocument *current_doc) { refmap_type *refmap = new refmap_type; id_changelist_type id_changes; diff --git a/src/id-clash.h b/src/id-clash.h index 1abd1dd83..418642738 100644 --- a/src/id-clash.h +++ b/src/id-clash.h @@ -3,7 +3,7 @@ #include "document.h" -void prevent_id_clashes(Document *imported_doc, Document *current_doc); +void prevent_id_clashes(SPDocument *imported_doc, SPDocument *current_doc); #endif /* !SEEN_ID_CLASH_H */ diff --git a/src/inkscape-private.h b/src/inkscape-private.h index 001d1201a..cb7f98729 100644 --- a/src/inkscape-private.h +++ b/src/inkscape-private.h @@ -47,8 +47,8 @@ void inkscape_add_desktop (SPDesktop * desktop); void inkscape_remove_desktop (SPDesktop * desktop); void inkscape_activate_desktop (SPDesktop * desktop); void inkscape_reactivate_desktop (SPDesktop * desktop); -void inkscape_add_document (Document *document); -bool inkscape_remove_document (Document *document); +void inkscape_add_document (SPDocument *document); +bool inkscape_remove_document (SPDocument *document); void inkscape_set_color (SPColor *color, float opacity); diff --git a/src/inkscape.cpp b/src/inkscape.cpp index c2c45d3bb..60ab895ed 100644 --- a/src/inkscape.cpp +++ b/src/inkscape.cpp @@ -105,7 +105,7 @@ static void inkscape_deactivate_desktop_private (Inkscape::Application *inkscape struct Inkscape::Application { GObject object; Inkscape::XML::Document *menus; - std::map document_set; + std::map document_set; GSList *desktops; gchar *argv0; gboolean dialogs_toggle; @@ -126,7 +126,7 @@ struct Inkscape::ApplicationClass { void (* set_eventcontext) (Inkscape::Application * inkscape, SPEventContext * eventcontext); void (* activate_desktop) (Inkscape::Application * inkscape, SPDesktop * desktop); void (* deactivate_desktop) (Inkscape::Application * inkscape, SPDesktop * desktop); - void (* destroy_document) (Inkscape::Application *inkscape, Document *doc); + void (* destroy_document) (Inkscape::Application *inkscape, SPDocument *doc); void (* color_set) (Inkscape::Application *inkscape, SPColor *color, double opacity); void (* shut_down) (Inkscape::Application *inkscape); void (* dialogs_hide) (Inkscape::Application *inkscape); @@ -326,11 +326,11 @@ static gint inkscape_autosave(gpointer) gint docnum = 0; SP_ACTIVE_DESKTOP->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Autosaving documents...")); - for (std::map::iterator iter = inkscape->document_set.begin(); + for (std::map::iterator iter = inkscape->document_set.begin(); iter != inkscape->document_set.end(); ++iter) { - Document *doc = iter->first; + SPDocument *doc = iter->first; ++docnum; @@ -463,7 +463,7 @@ inkscape_init (SPObject * object) g_assert_not_reached (); } - new (&inkscape->document_set) std::map(); + new (&inkscape->document_set) std::map(); inkscape->menus = sp_repr_read_mem (_(menus_skeleton), MENUS_SKELETON_SIZE, NULL); inkscape->desktops = NULL; @@ -597,10 +597,10 @@ inkscape_crash_handler (int /*signum*/) gint count = 0; GSList *savednames = NULL; GSList *failednames = NULL; - for (std::map::iterator iter = inkscape->document_set.begin(); + for (std::map::iterator iter = inkscape->document_set.begin(); iter != inkscape->document_set.end(); ++iter) { - Document *doc = iter->first; + SPDocument *doc = iter->first; Inkscape::XML::Node *repr; repr = sp_document_repr_root (doc); if (doc->isModifiedSinceSave()) { @@ -1219,7 +1219,7 @@ inkscape_external_change () * fixme: These need probably signals too */ void -inkscape_add_document (Document *document) +inkscape_add_document (SPDocument *document) { g_return_if_fail (document != NULL); @@ -1228,7 +1228,7 @@ inkscape_add_document (Document *document) // try to insert the pair into the list if (!(inkscape->document_set.insert(std::make_pair(document, 1)).second)) { //insert failed, this key (document) is already in the list - for (std::map::iterator iter = inkscape->document_set.begin(); + for (std::map::iterator iter = inkscape->document_set.begin(); iter != inkscape->document_set.end(); ++iter) { if (iter->first == document) { @@ -1247,13 +1247,13 @@ inkscape_add_document (Document *document) // returns true if this was last reference to this document, so you can delete it bool -inkscape_remove_document (Document *document) +inkscape_remove_document (SPDocument *document) { g_return_val_if_fail (document != NULL, false); if (!Inkscape::NSApplication::Application::getNewGui()) { - for (std::map::iterator iter = inkscape->document_set.begin(); + for (std::map::iterator iter = inkscape->document_set.begin(); iter != inkscape->document_set.end(); ++iter) { if (iter->first == document) { @@ -1290,7 +1290,7 @@ inkscape_active_desktop (void) return (SPDesktop *) inkscape->desktops->data; } -Document * +SPDocument * inkscape_active_document (void) { if (Inkscape::NSApplication::Application::getNewGui()) @@ -1304,13 +1304,13 @@ inkscape_active_document (void) } bool inkscape_is_sole_desktop_for_document(SPDesktop const &desktop) { - Document const* document = desktop.doc(); + SPDocument const* document = desktop.doc(); if (!document) { return false; } for ( GSList *iter = inkscape->desktops ; iter ; iter = iter->next ) { SPDesktop *other_desktop=(SPDesktop *)iter->data; - Document *other_document=other_desktop->doc(); + SPDocument *other_document=other_desktop->doc(); if ( other_document == document && other_desktop != &desktop ) { return false; } diff --git a/src/inkscape.h b/src/inkscape.h index e611af49b..ca2894227 100644 --- a/src/inkscape.h +++ b/src/inkscape.h @@ -16,7 +16,7 @@ #include struct SPDesktop; -struct Document; +struct SPDocument; struct SPEventContext; namespace Inkscape { @@ -46,7 +46,7 @@ Inkscape::Application *inkscape_get_instance(); SPEventContext * inkscape_active_event_context (void); #define SP_ACTIVE_DOCUMENT inkscape_active_document () -Document * inkscape_active_document (void); +SPDocument * inkscape_active_document (void); #define SP_ACTIVE_DESKTOP inkscape_active_desktop () SPDesktop * inkscape_active_desktop (void); diff --git a/src/inkview.cpp b/src/inkview.cpp index 0278d3029..5cfde2c81 100644 --- a/src/inkview.cpp +++ b/src/inkview.cpp @@ -84,7 +84,7 @@ struct SPSlideShow { int size; int length; int current; - Document *doc; + SPDocument *doc; GtkWidget *view; GtkWidget *window; bool fullscreen; @@ -441,7 +441,7 @@ sp_svgview_normal_cursor(struct SPSlideShow *ss) } static void -sp_svgview_set_document(struct SPSlideShow *ss, Document *doc, int current) +sp_svgview_set_document(struct SPSlideShow *ss, SPDocument *doc, int current) { if (doc && doc != ss->doc) { sp_document_ensure_up_to_date (doc); @@ -459,7 +459,7 @@ sp_svgview_show_next (struct SPSlideShow *ss) { sp_svgview_waiting_cursor(ss); - Document *doc = NULL; + SPDocument *doc = NULL; int current = ss->current; while (!doc && (current < ss->length - 1)) { doc = sp_document_new (ss->slides[++current], TRUE, false); @@ -475,7 +475,7 @@ sp_svgview_show_prev (struct SPSlideShow *ss) { sp_svgview_waiting_cursor(ss); - Document *doc = NULL; + SPDocument *doc = NULL; int current = ss->current; while (!doc && (current > 0)) { doc = sp_document_new (ss->slides[--current], TRUE, false); @@ -491,7 +491,7 @@ sp_svgview_goto_first (struct SPSlideShow *ss) { sp_svgview_waiting_cursor(ss); - Document *doc = NULL; + SPDocument *doc = NULL; int current = 0; while ( !doc && (current < ss->length - 1)) { if (current == ss->current) @@ -509,7 +509,7 @@ sp_svgview_goto_last (struct SPSlideShow *ss) { sp_svgview_waiting_cursor(ss); - Document *doc = NULL; + SPDocument *doc = NULL; int current = ss->length - 1; while (!doc && (current >= 0)) { if (current == ss->current) @@ -555,8 +555,8 @@ static void usage() Inkscape::Application *inkscape_get_instance() { return NULL; } void inkscape_ref (void) {} void inkscape_unref (void) {} -void inkscape_add_document (Document *document) {} -void inkscape_remove_document (Document *document) {} +void inkscape_add_document (SPDocument *document) {} +void inkscape_remove_document (SPDocument *document) {} #endif diff --git a/src/interface.cpp b/src/interface.cpp index 475ecdf16..cf7072064 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -271,7 +271,7 @@ sp_create_window(SPViewWidget *vw, gboolean editable) void sp_ui_new_view() { - Document *document; + SPDocument *document; SPViewWidget *dtw; document = SP_ACTIVE_DOCUMENT; @@ -290,7 +290,7 @@ sp_ui_new_view() void sp_ui_new_view_preview() { - Document *document; + SPDocument *document; SPViewWidget *dtw; document = SP_ACTIVE_DOCUMENT; @@ -1125,7 +1125,7 @@ sp_ui_drag_data_received(GtkWidget *widget, guint /*event_time*/, gpointer /*user_data*/) { - Document *doc = SP_ACTIVE_DOCUMENT; + SPDocument *doc = SP_ACTIVE_DOCUMENT; SPDesktop *desktop = SP_ACTIVE_DESKTOP; switch (info) { @@ -1508,7 +1508,7 @@ void sp_ui_drag_motion( GtkWidget */*widget*/, guint /*event_time*/, gpointer /*user_data*/) { -// Document *doc = SP_ACTIVE_DOCUMENT; +// SPDocument *doc = SP_ACTIVE_DOCUMENT; // SPDesktop *desktop = SP_ACTIVE_DESKTOP; @@ -1546,7 +1546,7 @@ sp_ui_import_one_file_with_check(gpointer filename, gpointer /*unused*/) static void sp_ui_import_one_file(char const *filename) { - Document *doc = SP_ACTIVE_DOCUMENT; + SPDocument *doc = SP_ACTIVE_DOCUMENT; if (!doc) return; if (filename == NULL) return; diff --git a/src/jabber_whiteboard/node-tracker.h b/src/jabber_whiteboard/node-tracker.h index 01087d04e..66814c5ca 100644 --- a/src/jabber_whiteboard/node-tracker.h +++ b/src/jabber_whiteboard/node-tracker.h @@ -168,7 +168,7 @@ public: const Glib::ustring &name); /** - * Returns whether or not the given node is the root node of the Document associated + * Returns whether or not the given node is the root node of the SPDocument associated * with an XMLNodeTracker's SessionManager. * * \param Reference to an XML::Node to test. diff --git a/src/jabber_whiteboard/session-manager.cpp b/src/jabber_whiteboard/session-manager.cpp index b6d236be9..a04ab05f0 100644 --- a/src/jabber_whiteboard/session-manager.cpp +++ b/src/jabber_whiteboard/session-manager.cpp @@ -95,7 +95,7 @@ void SessionManager::initialiseSession(Glib::ustring const& to, State::SessionType type) { - Document* doc = makeInkboardDocument(g_quark_from_static_string("xml"), "svg:svg", type, to); + SPDocument* doc = makeInkboardDocument(g_quark_from_static_string("xml"), "svg:svg", type, to); InkboardDocument* inkdoc = dynamic_cast< InkboardDocument* >(doc->rdoc); if(inkdoc == NULL) return; @@ -317,7 +317,7 @@ SessionManager::checkInvitationQueue() Dialog::DialogReply reply = static_cast< Dialog::DialogReply >(dialog.run()); - Document* doc = makeInkboardDocument(g_quark_from_static_string("xml"), "svg:svg", State::WHITEBOARD_PEER, from); + SPDocument* doc = makeInkboardDocument(g_quark_from_static_string("xml"), "svg:svg", State::WHITEBOARD_PEER, from); InkboardDocument* inkdoc = dynamic_cast< InkboardDocument* >(doc->rdoc); if(inkdoc == NULL) return true; @@ -350,10 +350,10 @@ SessionManager::checkInvitationQueue() //# HELPER FUNCTIONS //######################################################################### -Document* +SPDocument* makeInkboardDocument(int code, gchar const* rootname, State::SessionType type, Glib::ustring const& to) { - Document* doc; + SPDocument* doc; InkboardDocument* rdoc = new InkboardDocument(g_quark_from_static_string("xml"), type, to); rdoc->setAttribute("version", "1.0"); @@ -382,7 +382,7 @@ makeInkboardDocument(int code, gchar const* rootname, State::SessionType type, G // // \see sp_file_new SPDesktop* -makeInkboardDesktop(Document* doc) +makeInkboardDesktop(SPDocument* doc) { SPDesktop* dt; diff --git a/src/jabber_whiteboard/session-manager.h b/src/jabber_whiteboard/session-manager.h index 48e912265..53cc8f5b4 100644 --- a/src/jabber_whiteboard/session-manager.h +++ b/src/jabber_whiteboard/session-manager.h @@ -26,7 +26,7 @@ #include "gc-alloc.h" -class Document; +class SPDocument; class SPDesktop; @@ -118,10 +118,10 @@ private: }; -Document* makeInkboardDocument(int code, gchar const* rootname, +SPDocument* makeInkboardDocument(int code, gchar const* rootname, State::SessionType type, Glib::ustring const& to); -SPDesktop* makeInkboardDesktop(Document* doc); +SPDesktop* makeInkboardDesktop(SPDocument* doc); } // namespace Whiteboard diff --git a/src/layer-fns.cpp b/src/layer-fns.cpp index 2431b0758..75bb89bcf 100644 --- a/src/layer-fns.cpp +++ b/src/layer-fns.cpp @@ -165,7 +165,7 @@ SPObject *previous_layer(SPObject *root, SPObject *layer) { * \pre \a root should be either \a layer or an ancestor of it */ SPObject *create_layer(SPObject *root, SPObject *layer, LayerRelativePosition position) { - Document *document=SP_OBJECT_DOCUMENT(root); + SPDocument *document=SP_OBJECT_DOCUMENT(root); static int layer_suffix=1; gchar *id=NULL; diff --git a/src/layer-manager.cpp b/src/layer-manager.cpp index fe0d41904..8c45c7e53 100644 --- a/src/layer-manager.cpp +++ b/src/layer-manager.cpp @@ -126,12 +126,12 @@ LayerManager::LayerManager(SPDesktop *desktop) { _layer_connection = desktop->connectCurrentLayerChanged( sigc::mem_fun(*this, &LayerManager::_selectedLayerChanged) ); - sigc::bound_mem_functor1 first = sigc::mem_fun(*this, &LayerManager::_setDocument); + sigc::bound_mem_functor1 first = sigc::mem_fun(*this, &LayerManager::_setDocument); // This next line has problems on gcc 4.0.2 - sigc::slot base2 = first; + sigc::slot base2 = first; - sigc::slot slot2 = sigc::hide<0>( base2 ); + sigc::slot slot2 = sigc::hide<0>( base2 ); _document_connection = desktop->connectDocumentReplaced( slot2 ); _setDocument(desktop->doc()); @@ -211,7 +211,7 @@ void LayerManager::renameLayer( SPObject* obj, gchar const *label, bool uniquify -void LayerManager::_setDocument(Document *document) { +void LayerManager::_setDocument(SPDocument *document) { if (_document) { _resource_connection.disconnect(); } diff --git a/src/layer-manager.h b/src/layer-manager.h index bbd5ccafb..81f75e002 100644 --- a/src/layer-manager.h +++ b/src/layer-manager.h @@ -17,7 +17,7 @@ #include class SPDesktop; -class Document; +class SPDocument; namespace Inkscape { @@ -44,7 +44,7 @@ private: class LayerWatcher; void _objectModified( SPObject* obj, guint flags ); - void _setDocument(Document *document); + void _setDocument(SPDocument *document); void _rebuild(); void _selectedLayerChanged(SPObject *layer); @@ -53,7 +53,7 @@ private: sigc::connection _resource_connection; GC::soft_ptr _desktop; - Document *_document; + SPDocument *_document; std::vector _watchers; diff --git a/src/livarot/LivarotDefs.h b/src/livarot/LivarotDefs.h index c34559a29..49f954586 100644 --- a/src/livarot/LivarotDefs.h +++ b/src/livarot/LivarotDefs.h @@ -20,9 +20,9 @@ #ifdef HAVE_INTTYPES_H # include #else -//--tullarisc # ifdef HAVE_STDINT_H +# ifdef HAVE_STDINT_H # include -//# endif +# endif #endif // error codes (mostly obsolete) diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index f92f7c2ab..de0535448 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -246,7 +246,7 @@ Effect::New(EffectType lpenr, LivePathEffectObject *lpeobj) } void -Effect::createAndApply(const char* name, Document *doc, SPItem *item) +Effect::createAndApply(const char* name, SPDocument *doc, SPItem *item) { // Path effect definition Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc); @@ -263,7 +263,7 @@ Effect::createAndApply(const char* name, Document *doc, SPItem *item) } void -Effect::createAndApply(EffectType type, Document *doc, SPItem *item) +Effect::createAndApply(EffectType type, SPDocument *doc, SPItem *item) { createAndApply(LPETypeConverter.get_key(type).c_str(), doc, item); } @@ -576,7 +576,7 @@ Effect::getRepr() return SP_OBJECT_REPR(lpeobj); } -Document * +SPDocument * Effect::getSPDoc() { if (SP_OBJECT_DOCUMENT(lpeobj) == NULL) g_message("Effect::getSPDoc() returns NULL"); diff --git a/src/live_effects/effect.h b/src/live_effects/effect.h index 461073c3f..6f195b176 100644 --- a/src/live_effects/effect.h +++ b/src/live_effects/effect.h @@ -23,7 +23,7 @@ #define LPE_CONVERSION_TOLERANCE 0.01 // FIXME: find good solution for this. -struct Document; +struct SPDocument; struct SPDesktop; struct SPItem; class SPNodeContext; @@ -56,8 +56,8 @@ enum LPEPathFlashType { class Effect { public: static Effect* New(EffectType lpenr, LivePathEffectObject *lpeobj); - static void createAndApply(const char* name, Document *doc, SPItem *item); - static void createAndApply(EffectType type, Document *doc, SPItem *item); + static void createAndApply(const char* name, SPDocument *doc, SPItem *item); + static void createAndApply(EffectType type, SPDocument *doc, SPItem *item); virtual ~Effect(); @@ -111,7 +111,7 @@ public: Glib::ustring getName(); Inkscape::XML::Node * getRepr(); - Document * getSPDoc(); + SPDocument * getSPDoc(); LivePathEffectObject * getLPEObj() {return lpeobj;}; Parameter * getParameter(const char * key); diff --git a/src/live_effects/lpeobject.cpp b/src/live_effects/lpeobject.cpp index c7ca5e4aa..ec0dee0be 100644 --- a/src/live_effects/lpeobject.cpp +++ b/src/live_effects/lpeobject.cpp @@ -93,7 +93,7 @@ LivePathEffectObject::livepatheffect_init(LivePathEffectObject *lpeobj) * Virtual build: set livepatheffect attributes from its associated XML node. */ void -LivePathEffectObject::livepatheffect_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +LivePathEffectObject::livepatheffect_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { #ifdef LIVEPATHEFFECT_VERBOSE g_message("Build livepatheffect"); @@ -250,7 +250,7 @@ LivePathEffectObject * LivePathEffectObject::fork_private_if_necessary(unsigned int nr_of_allowed_users) { if (SP_OBJECT_HREFCOUNT(this) > nr_of_allowed_users) { - Document *doc = SP_OBJECT_DOCUMENT(this); + SPDocument *doc = SP_OBJECT_DOCUMENT(this); Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc); Inkscape::XML::Node *repr = SP_OBJECT_REPR (this)->duplicate(xml_doc); diff --git a/src/live_effects/lpeobject.h b/src/live_effects/lpeobject.h index 842b84c45..dc631a5c1 100644 --- a/src/live_effects/lpeobject.h +++ b/src/live_effects/lpeobject.h @@ -49,7 +49,7 @@ public: private: static void livepatheffect_class_init(LivePathEffectObjectClass *klass); static void livepatheffect_init(LivePathEffectObject *stop); - static void livepatheffect_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); + static void livepatheffect_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void livepatheffect_release(SPObject *object); static void livepatheffect_set(SPObject *object, unsigned key, gchar const *value); static Inkscape::XML::Node *livepatheffect_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); diff --git a/src/lpe-tool-context.cpp b/src/lpe-tool-context.cpp index 5f7cb0277..be465e324 100644 --- a/src/lpe-tool-context.cpp +++ b/src/lpe-tool-context.cpp @@ -422,7 +422,7 @@ lpetool_context_switch_mode(SPLPEToolContext *lc, Inkscape::LivePathEffect::Effe } void -lpetool_get_limiting_bbox_corners(Document *document, Geom::Point &A, Geom::Point &B) { +lpetool_get_limiting_bbox_corners(SPDocument *document, Geom::Point &A, Geom::Point &B) { Geom::Coord w = sp_document_width(document); Geom::Coord h = sp_document_height(document); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); @@ -452,7 +452,7 @@ lpetool_context_reset_limiting_bbox(SPLPEToolContext *lc) if (!prefs->getBool("/tools/lpetool/show_bbox", true)) return; - Document *document = sp_desktop_document(lc->desktop); + SPDocument *document = sp_desktop_document(lc->desktop); Geom::Point A, B; lpetool_get_limiting_bbox_corners(document, A, B); diff --git a/src/lpe-tool-context.h b/src/lpe-tool-context.h index f710e9321..8a52ba97c 100644 --- a/src/lpe-tool-context.h +++ b/src/lpe-tool-context.h @@ -67,7 +67,7 @@ int lpetool_mode_to_index(Inkscape::LivePathEffect::EffectType const type); int lpetool_item_has_construction(SPLPEToolContext *lc, SPItem *item); bool lpetool_try_construction(SPLPEToolContext *lc, Inkscape::LivePathEffect::EffectType const type); void lpetool_context_switch_mode(SPLPEToolContext *lc, Inkscape::LivePathEffect::EffectType const type); -void lpetool_get_limiting_bbox_corners(Document *document, Geom::Point &A, Geom::Point &B); +void lpetool_get_limiting_bbox_corners(SPDocument *document, Geom::Point &A, Geom::Point &B); void lpetool_context_reset_limiting_bbox(SPLPEToolContext *lc); void lpetool_create_measuring_items(SPLPEToolContext *lc, Inkscape::Selection *selection = NULL); void lpetool_delete_measuring_items(SPLPEToolContext *lc); diff --git a/src/main-cmdlineact.cpp b/src/main-cmdlineact.cpp index 6ab192095..dc59e1a93 100644 --- a/src/main-cmdlineact.cpp +++ b/src/main-cmdlineact.cpp @@ -55,7 +55,7 @@ CmdLineAction::doIt (Inkscape::UI::View::View * view) { SPDesktop * desktop = dynamic_cast(view); if (desktop == NULL) { return; } - Document * doc = view->doc(); + SPDocument * doc = view->doc(); SPObject * obj = doc->getObjectById(_arg); if (obj == NULL) { printf(_("Unable to find node ID: '%s'\n"), _arg); diff --git a/src/main.cpp b/src/main.cpp index 64fcb664d..9c33688ed 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -165,13 +165,13 @@ enum { int sp_main_gui(int argc, char const **argv); int sp_main_console(int argc, char const **argv); -static void sp_do_export_png(Document *doc); -static void do_export_ps_pdf(Document* doc, gchar const* uri, char const *mime); +static void sp_do_export_png(SPDocument *doc); +static void do_export_ps_pdf(SPDocument* doc, gchar const* uri, char const *mime); #ifdef WIN32 -static void do_export_emf(Document* doc, gchar const* uri, char const *mime); +static void do_export_emf(SPDocument* doc, gchar const* uri, char const *mime); #endif //WIN32 -static void do_query_dimension (Document *doc, bool extent, Geom::Dim2 const axis, const gchar *id); -static void do_query_all (Document *doc); +static void do_query_dimension (SPDocument *doc, bool extent, Geom::Dim2 const axis, const gchar *id); +static void do_query_all (SPDocument *doc); static void do_query_all_recurse (SPObject *o); static gchar *sp_global_printer = NULL; @@ -962,7 +962,7 @@ void sp_process_file_list(GSList *fl) { while (fl) { const gchar *filename = (gchar *)fl->data; - Document *doc = Inkscape::Extension::open(NULL, filename); + SPDocument *doc = Inkscape::Extension::open(NULL, filename); if (doc == NULL) { doc = Inkscape::Extension::open(Inkscape::Extension::db.get(SP_MODULE_KEY_INPUT_SVG), filename); } @@ -1127,7 +1127,7 @@ int sp_main_console(int argc, char const **argv) } static void -do_query_dimension (Document *doc, bool extent, Geom::Dim2 const axis, const gchar *id) +do_query_dimension (SPDocument *doc, bool extent, Geom::Dim2 const axis, const gchar *id) { SPObject *o = NULL; @@ -1167,7 +1167,7 @@ do_query_dimension (Document *doc, bool extent, Geom::Dim2 const axis, const gch } static void -do_query_all (Document *doc) +do_query_all (SPDocument *doc) { SPObject *o = NULL; @@ -1205,7 +1205,7 @@ do_query_all_recurse (SPObject *o) static void -sp_do_export_png(Document *doc) +sp_do_export_png(SPDocument *doc) { const gchar *filename = NULL; gdouble dpi = 0.0; @@ -1417,7 +1417,7 @@ sp_do_export_png(Document *doc) * \param mime MIME type to export as. */ -static void do_export_ps_pdf(Document* doc, gchar const* uri, char const* mime) +static void do_export_ps_pdf(SPDocument* doc, gchar const* uri, char const* mime) { Inkscape::Extension::DB::OutputList o; Inkscape::Extension::db.get_output_list(o); @@ -1507,7 +1507,7 @@ static void do_export_ps_pdf(Document* doc, gchar const* uri, char const* mime) * \param mime MIME type to export as (should be "image/x-emf") */ -static void do_export_emf(Document* doc, gchar const* uri, char const* mime) +static void do_export_emf(SPDocument* doc, gchar const* uri, char const* mime) { Inkscape::Extension::DB::OutputList o; Inkscape::Extension::db.get_output_list(o); diff --git a/src/marker.cpp b/src/marker.cpp index 2efcde1b9..c66acc192 100644 --- a/src/marker.cpp +++ b/src/marker.cpp @@ -43,7 +43,7 @@ struct SPMarkerView { static void sp_marker_class_init (SPMarkerClass *klass); static void sp_marker_init (SPMarker *marker); -static void sp_marker_build (SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_marker_build (SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_marker_release (SPObject *object); static void sp_marker_set (SPObject *object, unsigned int key, const gchar *value); static void sp_marker_update (SPObject *object, SPCtx *ctx, guint flags); @@ -133,7 +133,7 @@ sp_marker_init (SPMarker *marker) * \see sp_object_build() */ static void -sp_marker_build (SPObject *object, Document *document, Inkscape::XML::Node *repr) +sp_marker_build (SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { SPGroup *group; SPMarker *marker; @@ -723,7 +723,7 @@ sp_marker_view_remove (SPMarker *marker, SPMarkerView *view, unsigned int destro } const gchar * -generate_marker (GSList *reprs, Geom::Rect bounds, Document *document, Geom::Matrix /*transform*/, Geom::Matrix move) +generate_marker (GSList *reprs, Geom::Rect bounds, SPDocument *document, Geom::Matrix /*transform*/, Geom::Matrix move) { Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document); Inkscape::XML::Node *defsrepr = SP_OBJECT_REPR (SP_DOCUMENT_DEFS (document)); diff --git a/src/marker.h b/src/marker.h index 5206a9c89..f2d74a3a6 100644 --- a/src/marker.h +++ b/src/marker.h @@ -89,7 +89,7 @@ NRArenaItem *sp_marker_show_instance (SPMarker *marker, NRArenaItem *parent, unsigned int key, unsigned int pos, Geom::Matrix const &base, float linewidth); void sp_marker_hide (SPMarker *marker, unsigned int key); -const gchar *generate_marker (GSList *reprs, Geom::Rect bounds, Document *document, Geom::Matrix transform, Geom::Matrix move); +const gchar *generate_marker (GSList *reprs, Geom::Rect bounds, SPDocument *document, Geom::Matrix transform, Geom::Matrix move); #endif diff --git a/src/nodepath.cpp b/src/nodepath.cpp index e2c4f3fa3..f9a615583 100644 --- a/src/nodepath.cpp +++ b/src/nodepath.cpp @@ -2582,7 +2582,7 @@ void sp_node_delete_preserve(GList *nodes_to_delete) //FIXME: a closed path CAN legally have one node, it's only an open one which must be //at least 2 sp_nodepath_get_node_count(nodepath) < 2) { - Document *document = sp_desktop_document (nodepath->desktop); + SPDocument *document = sp_desktop_document (nodepath->desktop); //FIXME: The following line will be wrong when we have mltiple nodepaths: we only want to //delete this nodepath's object, not the entire selection! (though at this time, this //does not matter) @@ -2621,7 +2621,7 @@ void sp_node_selected_delete(Inkscape::NodePath::Path *nodepath) // if the entire nodepath is removed, delete the selected object. if (nodepath->subpaths == NULL || sp_nodepath_get_node_count(nodepath) < 2) { - Document *document = sp_desktop_document (nodepath->desktop); + SPDocument *document = sp_desktop_document (nodepath->desktop); sp_selection_delete(nodepath->desktop); sp_document_done (document, SP_VERB_CONTEXT_NODE, _("Delete nodes")); diff --git a/src/path-chemistry.cpp b/src/path-chemistry.cpp index 3b5cd3136..99ee78ade 100644 --- a/src/path-chemistry.cpp +++ b/src/path-chemistry.cpp @@ -43,7 +43,7 @@ void sp_selected_path_combine(SPDesktop *desktop) { Inkscape::Selection *selection = sp_desktop_selection(desktop); - Document *doc = sp_desktop_document(desktop); + SPDocument *doc = sp_desktop_document(desktop); if (g_slist_length((GSList *) selection->itemList()) < 1) { sp_desktop_message_stack(desktop)->flash(Inkscape::WARNING_MESSAGE, _("Select object(s) to combine.")); @@ -328,7 +328,7 @@ sp_item_list_to_curves(const GSList *items, GSList **selected, GSList **to_selec items = items->next) { SPItem *item = SP_ITEM(items->data); - Document *document = item->document; + SPDocument *document = item->document; if (SP_IS_PATH(item) && !SP_PATH(item)->original_curve) { continue; // already a path, and no path effect diff --git a/src/persp3d.cpp b/src/persp3d.cpp index 978a8952c..916e9f25f 100644 --- a/src/persp3d.cpp +++ b/src/persp3d.cpp @@ -26,7 +26,7 @@ static void persp3d_class_init(Persp3DClass *klass); static void persp3d_init(Persp3D *stop); -static void persp3d_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void persp3d_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void persp3d_release(SPObject *object); static void persp3d_set(SPObject *object, unsigned key, gchar const *value); static void persp3d_update(SPObject *object, SPCtx *ctx, guint flags); @@ -103,7 +103,7 @@ persp3d_init(Persp3D *persp) /** * Virtual build: set persp3d attributes from its associated XML node. */ -static void persp3d_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +static void persp3d_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) persp3d_parent_class)->build) (* ((SPObjectClass *) persp3d_parent_class)->build)(object, document, repr); @@ -201,7 +201,7 @@ persp3d_update(SPObject *object, SPCtx *ctx, guint flags) } Persp3D * -persp3d_create_xml_element (Document *document, Persp3D *dup) {// if dup is given, copy the attributes over +persp3d_create_xml_element (SPDocument *document, Persp3D *dup) {// if dup is given, copy the attributes over SPDefs *defs = (SPDefs *) SP_DOCUMENT_DEFS(document); Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document); Inkscape::XML::Node *repr; @@ -240,7 +240,7 @@ persp3d_create_xml_element (Document *document, Persp3D *dup) {// if dup is give } Persp3D * -persp3d_document_first_persp (Document *document) { +persp3d_document_first_persp (SPDocument *document) { SPDefs *defs = (SPDefs *) SP_DOCUMENT_DEFS(document); Inkscape::XML::Node *repr; for (SPObject *child = sp_object_first_child(defs); child != NULL; child = SP_OBJECT_NEXT(child) ) { @@ -653,7 +653,7 @@ persp3d_print_debugging_info (Persp3D *persp) { } void -persp3d_print_debugging_info_all(Document *document) { +persp3d_print_debugging_info_all(SPDocument *document) { SPDefs *defs = (SPDefs *) SP_DOCUMENT_DEFS(document); Inkscape::XML::Node *repr; for (SPObject *child = sp_object_first_child(defs); child != NULL; child = SP_OBJECT_NEXT(child) ) { diff --git a/src/persp3d.h b/src/persp3d.h index cbad0b873..79bec0232 100644 --- a/src/persp3d.h +++ b/src/persp3d.h @@ -35,7 +35,7 @@ struct Persp3D : public SPObject { // Also write the list of boxes into the xml repr and vice versa link boxes to their persp3d? std::vector boxes; std::map* boxes_transformed; // TODO: eventually we should merge this with 'boxes' - Document *document; // should this rather be the SPDesktop? + SPDocument *document; // should this rather be the SPDesktop? // for debugging only int my_counter; @@ -89,15 +89,15 @@ std::list persp3d_list_of_boxes(Persp3D *persp); bool persp3d_perspectives_coincide(const Persp3D *lhs, const Persp3D *rhs); void persp3d_absorb(Persp3D *persp1, Persp3D *persp2); -Persp3D * persp3d_create_xml_element (Document *document, Persp3D *dup = NULL); -Persp3D * persp3d_document_first_persp (Document *document); +Persp3D * persp3d_create_xml_element (SPDocument *document, Persp3D *dup = NULL); +Persp3D * persp3d_document_first_persp (SPDocument *document); bool persp3d_has_all_boxes_in_selection (Persp3D *persp); std::map > persp3d_unselected_boxes(Inkscape::Selection *selection); void persp3d_split_perspectives_according_to_selection(Inkscape::Selection *selection); void persp3d_print_debugging_info (Persp3D *persp); -void persp3d_print_debugging_info_all(Document *doc); +void persp3d_print_debugging_info_all(SPDocument *doc); void persp3d_print_all_selected(); #endif /* __PERSP3D_H__ */ diff --git a/src/print.cpp b/src/print.cpp index 7fbaa53e9..044dffe34 100644 --- a/src/print.cpp +++ b/src/print.cpp @@ -85,7 +85,7 @@ unsigned int sp_print_text(SPPrintContext *ctx, char const *text, Geom::Point p, /* UI */ void -sp_print_preview_document(Document *doc) +sp_print_preview_document(SPDocument *doc) { Inkscape::Extension::Print *mod; unsigned int ret; @@ -122,7 +122,7 @@ sp_print_preview_document(Document *doc) } void -sp_print_document(Gtk::Window& parentWindow, Document *doc) +sp_print_document(Gtk::Window& parentWindow, SPDocument *doc) { sp_document_ensure_up_to_date(doc); @@ -143,7 +143,7 @@ sp_print_document(Gtk::Window& parentWindow, Document *doc) } void -sp_print_document_to_file(Document *doc, gchar const *filename) +sp_print_document_to_file(SPDocument *doc, gchar const *filename) { Inkscape::Extension::Print *mod; SPPrintContext context; diff --git a/src/print.h b/src/print.h index 11efced7b..577a169cf 100644 --- a/src/print.h +++ b/src/print.h @@ -41,9 +41,9 @@ void sp_print_get_param(SPPrintContext *ctx, gchar *name, bool *value); /* UI */ -void sp_print_preview_document(Document *doc); -void sp_print_document(Gtk::Window& parentWindow, Document *doc); -void sp_print_document_to_file(Document *doc, gchar const *filename); +void sp_print_preview_document(SPDocument *doc); +void sp_print_document(Gtk::Window& parentWindow, SPDocument *doc); +void sp_print_document_to_file(SPDocument *doc, gchar const *filename); #endif /* !PRINT_H_INKSCAPE */ diff --git a/src/profile-manager.cpp b/src/profile-manager.cpp index 75fd12e4b..1cd965e39 100644 --- a/src/profile-manager.cpp +++ b/src/profile-manager.cpp @@ -14,7 +14,7 @@ namespace Inkscape { -ProfileManager::ProfileManager(Document *document) : +ProfileManager::ProfileManager(SPDocument *document) : _doc(document), _knownProfiles() { diff --git a/src/profile-manager.h b/src/profile-manager.h index d72ad3dd8..61e22615f 100644 --- a/src/profile-manager.h +++ b/src/profile-manager.h @@ -13,7 +13,7 @@ #include "gc-finalized.h" #include -class Document; +class SPDocument; namespace Inkscape { @@ -23,7 +23,7 @@ class ProfileManager : public DocumentSubset, public GC::Finalized { public: - ProfileManager(Document *document); + ProfileManager(SPDocument *document); ~ProfileManager(); ColorProfile* find(gchar const* name); @@ -34,7 +34,7 @@ private: void _resourcesChanged(); - Document* _doc; + SPDocument* _doc; sigc::connection _resource_connection; std::vector _knownProfiles; }; diff --git a/src/rdf.cpp b/src/rdf.cpp index 5559526f1..f0b174922 100644 --- a/src/rdf.cpp +++ b/src/rdf.cpp @@ -531,7 +531,7 @@ rdf_set_repr_text ( Inkscape::XML::Node * repr, // set document's title element to the RDF title if (!strcmp(entity->name, "title")) { - Document *doc = SP_ACTIVE_DOCUMENT; + SPDocument *doc = SP_ACTIVE_DOCUMENT; if(doc && doc->root) doc->root->setTitle(text); } @@ -644,7 +644,7 @@ rdf_set_repr_text ( Inkscape::XML::Node * repr, } Inkscape::XML::Node * -rdf_get_rdf_root_repr ( Document * doc, bool build ) +rdf_get_rdf_root_repr ( SPDocument * doc, bool build ) { g_return_val_if_fail (doc != NULL, NULL); g_return_val_if_fail (doc->rroot != NULL, NULL); @@ -705,7 +705,7 @@ rdf_get_rdf_root_repr ( Document * doc, bool build ) } Inkscape::XML::Node * -rdf_get_xml_repr( Document * doc, gchar const * name, bool build ) +rdf_get_xml_repr( SPDocument * doc, gchar const * name, bool build ) { g_return_val_if_fail (name != NULL, NULL); g_return_val_if_fail (doc != NULL, NULL); @@ -735,7 +735,7 @@ rdf_get_xml_repr( Document * doc, gchar const * name, bool build ) } Inkscape::XML::Node * -rdf_get_work_repr( Document * doc, gchar const * name, bool build ) +rdf_get_work_repr( SPDocument * doc, gchar const * name, bool build ) { g_return_val_if_fail (name != NULL, NULL); g_return_val_if_fail (doc != NULL, NULL); @@ -771,7 +771,7 @@ rdf_get_work_repr( Document * doc, gchar const * name, bool build ) * */ const gchar * -rdf_get_work_entity(Document * doc, struct rdf_work_entity_t * entity) +rdf_get_work_entity(SPDocument * doc, struct rdf_work_entity_t * entity) { g_return_val_if_fail (doc != NULL, NULL); if ( entity == NULL ) return NULL; @@ -802,7 +802,7 @@ rdf_get_work_entity(Document * doc, struct rdf_work_entity_t * entity) * */ unsigned int -rdf_set_work_entity(Document * doc, struct rdf_work_entity_t * entity, +rdf_set_work_entity(SPDocument * doc, struct rdf_work_entity_t * entity, const gchar * text) { g_return_val_if_fail ( entity != NULL, 0 ); @@ -918,7 +918,7 @@ rdf_match_license(Inkscape::XML::Node const *repr, struct rdf_license_t const *l * */ struct rdf_license_t * -rdf_get_license(Document * document) +rdf_get_license(SPDocument * document) { Inkscape::XML::Node const *repr = rdf_get_xml_repr ( document, XML_TAG_NAME_LICENSE, FALSE ); if (repr) { @@ -942,7 +942,7 @@ rdf_get_license(Document * document) * */ void -rdf_set_license(Document * doc, struct rdf_license_t const * license) +rdf_set_license(SPDocument * doc, struct rdf_license_t const * license) { // drop old license section Inkscape::XML::Node * repr = rdf_get_xml_repr ( doc, XML_TAG_NAME_LICENSE, FALSE ); @@ -981,7 +981,7 @@ struct rdf_entity_default_t rdf_defaults[] = { }; void -rdf_set_defaults ( Document * doc ) +rdf_set_defaults ( SPDocument * doc ) { g_assert ( doc != NULL ); diff --git a/src/rdf.h b/src/rdf.h index 57ae79cb8..a98f5a1e4 100644 --- a/src/rdf.h +++ b/src/rdf.h @@ -94,17 +94,17 @@ struct rdf_t { struct rdf_work_entity_t * rdf_find_entity(gchar const * name); -const gchar * rdf_get_work_entity(Document * doc, +const gchar * rdf_get_work_entity(SPDocument * doc, struct rdf_work_entity_t * entity); -unsigned int rdf_set_work_entity(Document * doc, +unsigned int rdf_set_work_entity(SPDocument * doc, struct rdf_work_entity_t * entity, const gchar * text); -struct rdf_license_t * rdf_get_license(Document * doc); -void rdf_set_license(Document * doc, +struct rdf_license_t * rdf_get_license(SPDocument * doc); +void rdf_set_license(SPDocument * doc, struct rdf_license_t const * license); -void rdf_set_defaults ( Document * doc ); +void rdf_set_defaults ( SPDocument * doc ); #endif // _RDF_H_ diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index 0e2fe43d1..e55bba2a5 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -139,7 +139,7 @@ void sp_selection_copy_impl(GSList const *items, GSList **clip, Inkscape::XML::D g_slist_free((GSList *) sorted_items); } -GSList *sp_selection_paste_impl(Document *doc, SPObject *parent, GSList **clip) +GSList *sp_selection_paste_impl(SPDocument *doc, SPObject *parent, GSList **clip) { Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc); @@ -240,7 +240,7 @@ void sp_selection_duplicate(SPDesktop *desktop, bool suppressDone) if (desktop == NULL) return; - Document *doc = desktop->doc(); + SPDocument *doc = desktop->doc(); Inkscape::XML::Document* xml_doc = sp_document_repr_doc(doc); Inkscape::Selection *selection = sp_desktop_selection(desktop); @@ -326,7 +326,7 @@ void sp_edit_clear_all(SPDesktop *dt) if (!dt) return; - Document *doc = sp_desktop_document(dt); + SPDocument *doc = sp_desktop_document(dt); sp_desktop_selection(dt)->clear(); g_return_if_fail(SP_IS_GROUP(dt->currentLayer())); @@ -454,7 +454,7 @@ void sp_selection_group(SPDesktop *desktop) if (desktop == NULL) return; - Document *doc = sp_desktop_document(desktop); + SPDocument *doc = sp_desktop_document(desktop); Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc); Inkscape::Selection *selection = sp_desktop_selection(desktop); @@ -741,7 +741,7 @@ void sp_selection_raise_to_top(SPDesktop *desktop) if (desktop == NULL) return; - Document *document = sp_desktop_document(desktop); + SPDocument *document = sp_desktop_document(desktop); Inkscape::Selection *selection = sp_desktop_selection(desktop); if (selection->isEmpty()) { @@ -839,7 +839,7 @@ void sp_selection_lower_to_bottom(SPDesktop *desktop) if (desktop == NULL) return; - Document *document = sp_desktop_document(desktop); + SPDocument *document = sp_desktop_document(desktop); Inkscape::Selection *selection = sp_desktop_selection(desktop); if (selection->isEmpty()) { @@ -882,14 +882,14 @@ void sp_selection_lower_to_bottom(SPDesktop *desktop) } void -sp_undo(SPDesktop *desktop, Document *) +sp_undo(SPDesktop *desktop, SPDocument *) { if (!sp_document_undo(sp_desktop_document(desktop))) desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Nothing to undo.")); } void -sp_redo(SPDesktop *desktop, Document *) +sp_redo(SPDesktop *desktop, SPDocument *) { if (!sp_document_redo(sp_desktop_document(desktop))) desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Nothing to redo.")); @@ -1672,7 +1672,7 @@ sp_selection_item_next(SPDesktop *desktop) void sp_selection_item_prev(SPDesktop *desktop) { - Document *document = sp_desktop_document(desktop); + SPDocument *document = sp_desktop_document(desktop); g_return_if_fail(document != NULL); g_return_if_fail(desktop != NULL); Inkscape::Selection *selection = sp_desktop_selection(desktop); @@ -2114,7 +2114,7 @@ void sp_selection_to_marker(SPDesktop *desktop, bool apply) if (desktop == NULL) return; - Document *doc = sp_desktop_document(desktop); + SPDocument *doc = sp_desktop_document(desktop); Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc); Inkscape::Selection *selection = sp_desktop_selection(desktop); @@ -2211,7 +2211,7 @@ void sp_selection_to_guides(SPDesktop *desktop) if (desktop == NULL) return; - Document *doc = sp_desktop_document(desktop); + SPDocument *doc = sp_desktop_document(desktop); Inkscape::Selection *selection = sp_desktop_selection(desktop); // we need to copy the list because it gets reset when objects are deleted GSList *items = g_slist_copy((GSList *) selection->itemList()); @@ -2238,7 +2238,7 @@ sp_selection_tile(SPDesktop *desktop, bool apply) if (desktop == NULL) return; - Document *doc = sp_desktop_document(desktop); + SPDocument *doc = sp_desktop_document(desktop); Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc); Inkscape::Selection *selection = sp_desktop_selection(desktop); @@ -2342,7 +2342,7 @@ sp_selection_untile(SPDesktop *desktop) if (desktop == NULL) return; - Document *doc = sp_desktop_document(desktop); + SPDocument *doc = sp_desktop_document(desktop); Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc); Inkscape::Selection *selection = sp_desktop_selection(desktop); @@ -2457,7 +2457,7 @@ sp_selection_get_export_hints(Inkscape::Selection *selection, char const **filen } void -sp_document_get_export_hints(Document *doc, char const **filename, float *xdpi, float *ydpi) +sp_document_get_export_hints(SPDocument *doc, char const **filename, float *xdpi, float *ydpi) { Inkscape::XML::Node * repr = sp_document_repr_root(doc); gchar const *dpi_string; @@ -2483,7 +2483,7 @@ sp_selection_create_bitmap_copy(SPDesktop *desktop) if (desktop == NULL) return; - Document *document = sp_desktop_document(desktop); + SPDocument *document = sp_desktop_document(desktop); Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document); Inkscape::Selection *selection = sp_desktop_selection(desktop); @@ -2697,7 +2697,7 @@ sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_to_la if (desktop == NULL) return; - Document *doc = sp_desktop_document(desktop); + SPDocument *doc = sp_desktop_document(desktop); Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc); Inkscape::Selection *selection = sp_desktop_selection(desktop); @@ -2824,7 +2824,7 @@ void sp_selection_unset_mask(SPDesktop *desktop, bool apply_clip_path) { if (desktop == NULL) return; - Document *doc = sp_desktop_document(desktop); + SPDocument *doc = sp_desktop_document(desktop); Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc); Inkscape::Selection *selection = sp_desktop_selection(desktop); @@ -2915,7 +2915,7 @@ bool fit_canvas_to_selection(SPDesktop *desktop) { g_return_val_if_fail(desktop != NULL, false); - Document *doc = sp_desktop_document(desktop); + SPDocument *doc = sp_desktop_document(desktop); g_return_val_if_fail(doc != NULL, false); g_return_val_if_fail(desktop->selection != NULL, false); @@ -2946,7 +2946,7 @@ verb_fit_canvas_to_selection(SPDesktop *const desktop) } bool -fit_canvas_to_drawing(Document *doc) +fit_canvas_to_drawing(SPDocument *doc) { g_return_val_if_fail(doc != NULL, false); @@ -2972,7 +2972,7 @@ verb_fit_canvas_to_drawing(SPDesktop *desktop) void fit_canvas_to_selection_or_drawing(SPDesktop *desktop) { g_return_if_fail(desktop != NULL); - Document *doc = sp_desktop_document(desktop); + SPDocument *doc = sp_desktop_document(desktop); g_return_if_fail(doc != NULL); g_return_if_fail(desktop->selection != NULL); diff --git a/src/selection-chemistry.h b/src/selection-chemistry.h index 4a8c8901e..67e772a00 100644 --- a/src/selection-chemistry.h +++ b/src/selection-chemistry.h @@ -104,11 +104,11 @@ void sp_selection_edit_clip_or_mask(SPDesktop * dt, bool clip); void scroll_to_show_item(SPDesktop *desktop, SPItem *item); -void sp_undo (SPDesktop *desktop, Document *doc); -void sp_redo (SPDesktop *desktop, Document *doc); +void sp_undo (SPDesktop *desktop, SPDocument *doc); +void sp_redo (SPDesktop *desktop, SPDocument *doc); void sp_selection_get_export_hints (Inkscape::Selection *selection, const char **filename, float *xdpi, float *ydpi); -void sp_document_get_export_hints (Document * doc, const char **filename, float *xdpi, float *ydpi); +void sp_document_get_export_hints (SPDocument * doc, const char **filename, float *xdpi, float *ydpi); void sp_selection_create_bitmap_copy (SPDesktop *desktop); @@ -117,7 +117,7 @@ void sp_selection_unset_mask(SPDesktop *desktop, bool apply_clip_path); bool fit_canvas_to_selection(SPDesktop *); void verb_fit_canvas_to_selection(SPDesktop *); -bool fit_canvas_to_drawing(Document *); +bool fit_canvas_to_drawing(SPDocument *); void verb_fit_canvas_to_drawing(SPDesktop *); void fit_canvas_to_selection_or_drawing(SPDesktop *); diff --git a/src/snap.cpp b/src/snap.cpp index 48f3a8fea..f0769e0a1 100644 --- a/src/snap.cpp +++ b/src/snap.cpp @@ -1092,7 +1092,7 @@ void SnapManager::setup(SPDesktop const *desktop, _guide_to_ignore = guide_to_ignore; } -Document *SnapManager::getDocument() const +SPDocument *SnapManager::getDocument() const { return _named_view->document; } diff --git a/src/snap.h b/src/snap.h index 18820f78e..e621bdb60 100644 --- a/src/snap.h +++ b/src/snap.h @@ -162,7 +162,7 @@ public: SPDesktop const *getDesktop() const {return _desktop;} SPNamedView const *getNamedView() const {return _named_view;} - Document *getDocument() const; + SPDocument *getDocument() const; SPGuide const *getGuideToIgnore() const {return _guide_to_ignore;} bool getSnapIndicator() const {return _snapindicator;} diff --git a/src/sp-anchor.cpp b/src/sp-anchor.cpp index ec1b4e53f..aabefdfdb 100644 --- a/src/sp-anchor.cpp +++ b/src/sp-anchor.cpp @@ -29,7 +29,7 @@ static void sp_anchor_class_init(SPAnchorClass *ac); static void sp_anchor_init(SPAnchor *anchor); -static void sp_anchor_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_anchor_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_anchor_release(SPObject *object); static void sp_anchor_set(SPObject *object, unsigned int key, const gchar *value); static Inkscape::XML::Node *sp_anchor_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); @@ -83,7 +83,7 @@ static void sp_anchor_init(SPAnchor *anchor) anchor->href = NULL; } -static void sp_anchor_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +static void sp_anchor_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) (parent_class))->build) { ((SPObjectClass *) (parent_class))->build(object, document, repr); diff --git a/src/sp-animation.cpp b/src/sp-animation.cpp index b5f0e8605..2d9f2e941 100644 --- a/src/sp-animation.cpp +++ b/src/sp-animation.cpp @@ -37,7 +37,7 @@ log_set_attr(char const *const classname, unsigned int const key, char const *co static void sp_animation_class_init(SPAnimationClass *klass); static void sp_animation_init(SPAnimation *animation); -static void sp_animation_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_animation_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_animation_release(SPObject *object); static void sp_animation_set(SPObject *object, unsigned int key, gchar const *value); @@ -84,7 +84,7 @@ sp_animation_init(SPAnimation */*animation*/) static void -sp_animation_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +sp_animation_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) animation_parent_class)->build) ((SPObjectClass *) animation_parent_class)->build(object, document, repr); @@ -124,7 +124,7 @@ sp_animation_set(SPObject *object, unsigned int key, gchar const *value) static void sp_ianimation_class_init(SPIAnimationClass *klass); static void sp_ianimation_init(SPIAnimation *animation); -static void sp_ianimation_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_ianimation_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_ianimation_release(SPObject *object); static void sp_ianimation_set(SPObject *object, unsigned int key, gchar const *value); @@ -171,7 +171,7 @@ sp_ianimation_init(SPIAnimation */*animation*/) static void -sp_ianimation_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +sp_ianimation_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) ianimation_parent_class)->build) ((SPObjectClass *) ianimation_parent_class)->build(object, document, repr); @@ -208,7 +208,7 @@ sp_ianimation_set(SPObject *object, unsigned int key, gchar const *value) static void sp_animate_class_init(SPAnimateClass *klass); static void sp_animate_init(SPAnimate *animate); -static void sp_animate_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_animate_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_animate_release(SPObject *object); static void sp_animate_set(SPObject *object, unsigned int key, gchar const *value); @@ -255,7 +255,7 @@ sp_animate_init(SPAnimate */*animate*/) static void -sp_animate_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +sp_animate_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) animate_parent_class)->build) ((SPObjectClass *) animate_parent_class)->build(object, document, repr); diff --git a/src/sp-clippath.cpp b/src/sp-clippath.cpp index 1dab31e34..4bbabc965 100644 --- a/src/sp-clippath.cpp +++ b/src/sp-clippath.cpp @@ -40,7 +40,7 @@ struct SPClipPathView { static void sp_clippath_class_init(SPClipPathClass *klass); static void sp_clippath_init(SPClipPath *clippath); -static void sp_clippath_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_clippath_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_clippath_release(SPObject * object); static void sp_clippath_set(SPObject *object, unsigned int key, gchar const *value); static void sp_clippath_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref); @@ -99,7 +99,7 @@ sp_clippath_init(SPClipPath *cp) } static void -sp_clippath_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +sp_clippath_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) parent_class)->build) ((SPObjectClass *) parent_class)->build(object, document, repr); @@ -381,7 +381,7 @@ sp_clippath_view_list_remove(SPClipPathView *list, SPClipPathView *view) // Create a mask element (using passed elements), add it to const gchar * -sp_clippath_create (GSList *reprs, Document *document, Geom::Matrix const* applyTransform) +sp_clippath_create (GSList *reprs, SPDocument *document, Geom::Matrix const* applyTransform) { Inkscape::XML::Node *defsrepr = SP_OBJECT_REPR (SP_DOCUMENT_DEFS (document)); diff --git a/src/sp-clippath.h b/src/sp-clippath.h index d6a4e6f0b..199b29f3b 100644 --- a/src/sp-clippath.h +++ b/src/sp-clippath.h @@ -59,6 +59,6 @@ void sp_clippath_hide(SPClipPath *cp, unsigned int key); void sp_clippath_set_bbox(SPClipPath *cp, unsigned int key, NRRect *bbox); void sp_clippath_get_bbox(SPClipPath *cp, NRRect *bbox, Geom::Matrix const &transform, unsigned const flags); -const gchar *sp_clippath_create (GSList *reprs, Document *document, Geom::Matrix const* applyTransform); +const gchar *sp_clippath_create (GSList *reprs, SPDocument *document, Geom::Matrix const* applyTransform); #endif diff --git a/src/sp-ellipse.cpp b/src/sp-ellipse.cpp index 2847d23e9..ff2e39044 100644 --- a/src/sp-ellipse.cpp +++ b/src/sp-ellipse.cpp @@ -366,7 +366,7 @@ static Inkscape::XML::Node *sp_genericellipse_write(SPObject *object, Inkscape:: static void sp_ellipse_class_init(SPEllipseClass *klass); static void sp_ellipse_init(SPEllipse *ellipse); -static void sp_ellipse_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_ellipse_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static Inkscape::XML::Node *sp_ellipse_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void sp_ellipse_set(SPObject *object, unsigned int key, gchar const *value); static gchar *sp_ellipse_description(SPItem *item); @@ -416,7 +416,7 @@ sp_ellipse_init(SPEllipse */*ellipse*/) } static void -sp_ellipse_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +sp_ellipse_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) ellipse_parent_class)->build) (* ((SPObjectClass *) ellipse_parent_class)->build) (object, document, repr); @@ -513,7 +513,7 @@ sp_ellipse_position_set(SPEllipse *ellipse, gdouble x, gdouble y, gdouble rx, gd static void sp_circle_class_init(SPCircleClass *klass); static void sp_circle_init(SPCircle *circle); -static void sp_circle_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_circle_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static Inkscape::XML::Node *sp_circle_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void sp_circle_set(SPObject *object, unsigned int key, gchar const *value); static gchar *sp_circle_description(SPItem *item); @@ -564,7 +564,7 @@ sp_circle_init(SPCircle */*circle*/) } static void -sp_circle_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +sp_circle_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) circle_parent_class)->build) (* ((SPObjectClass *) circle_parent_class)->build)(object, document, repr); @@ -635,7 +635,7 @@ static gchar *sp_circle_description(SPItem */*item*/) static void sp_arc_class_init(SPArcClass *klass); static void sp_arc_init(SPArc *arc); -static void sp_arc_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_arc_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static Inkscape::XML::Node *sp_arc_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void sp_arc_set(SPObject *object, unsigned int key, gchar const *value); static void sp_arc_modified(SPObject *object, guint flags); @@ -689,7 +689,7 @@ sp_arc_init(SPArc */*arc*/) } static void -sp_arc_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +sp_arc_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) arc_parent_class)->build) (* ((SPObjectClass *) arc_parent_class)->build) (object, document, repr); diff --git a/src/sp-filter-primitive.cpp b/src/sp-filter-primitive.cpp index e090a27b2..77325c4b1 100644 --- a/src/sp-filter-primitive.cpp +++ b/src/sp-filter-primitive.cpp @@ -32,7 +32,7 @@ static void sp_filter_primitive_class_init(SPFilterPrimitiveClass *klass); static void sp_filter_primitive_init(SPFilterPrimitive *filter_primitive); -static void sp_filter_primitive_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_filter_primitive_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_filter_primitive_release(SPObject *object); static void sp_filter_primitive_set(SPObject *object, unsigned int key, gchar const *value); static void sp_filter_primitive_update(SPObject *object, SPCtx *ctx, guint flags); @@ -93,7 +93,7 @@ sp_filter_primitive_init(SPFilterPrimitive *filter_primitive) * sp-object-repr.cpp's repr_name_entries array. */ static void -sp_filter_primitive_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +sp_filter_primitive_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) filter_primitive_parent_class)->build) { ((SPObjectClass *) filter_primitive_parent_class)->build(object, document, repr); diff --git a/src/sp-filter-reference.h b/src/sp-filter-reference.h index 31ef5ef11..216ff1d6f 100644 --- a/src/sp-filter-reference.h +++ b/src/sp-filter-reference.h @@ -8,7 +8,7 @@ class SPObject; class SPFilterReference : public Inkscape::URIReference { public: SPFilterReference(SPObject *obj) : URIReference(obj) {} - SPFilterReference(Document *doc) : URIReference(doc) {} + SPFilterReference(SPDocument *doc) : URIReference(doc) {} SPFilter *getObject() const { return (SPFilter *)URIReference::getObject(); diff --git a/src/sp-filter.cpp b/src/sp-filter.cpp index 7c819af1f..7197c1ec9 100644 --- a/src/sp-filter.cpp +++ b/src/sp-filter.cpp @@ -43,7 +43,7 @@ using std::pair; static void sp_filter_class_init(SPFilterClass *klass); static void sp_filter_init(SPFilter *filter); -static void sp_filter_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_filter_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_filter_release(SPObject *object); static void sp_filter_set(SPObject *object, unsigned int key, gchar const *value); static void sp_filter_update(SPObject *object, SPCtx *ctx, guint flags); @@ -129,7 +129,7 @@ sp_filter_init(SPFilter *filter) * sp-object-repr.cpp's repr_name_entries array. */ static void -sp_filter_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +sp_filter_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) filter_parent_class)->build) { ((SPObjectClass *) filter_parent_class)->build(object, document, repr); diff --git a/src/sp-flowdiv.cpp b/src/sp-flowdiv.cpp index 78aab7cb3..6d679701f 100644 --- a/src/sp-flowdiv.cpp +++ b/src/sp-flowdiv.cpp @@ -23,7 +23,7 @@ static void sp_flowdiv_release (SPObject *object); static Inkscape::XML::Node *sp_flowdiv_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void sp_flowdiv_update (SPObject *object, SPCtx *ctx, unsigned int flags); static void sp_flowdiv_modified (SPObject *object, guint flags); -static void sp_flowdiv_build (SPObject *object, Document *doc, Inkscape::XML::Node *repr); +static void sp_flowdiv_build (SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr); static void sp_flowdiv_set (SPObject *object, unsigned int key, const gchar *value); static void sp_flowtspan_class_init (SPFlowtspanClass *klass); @@ -32,7 +32,7 @@ static void sp_flowtspan_release (SPObject *object); static Inkscape::XML::Node *sp_flowtspan_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void sp_flowtspan_update (SPObject *object, SPCtx *ctx, unsigned int flags); static void sp_flowtspan_modified (SPObject *object, guint flags); -static void sp_flowtspan_build (SPObject *object, Document *doc, Inkscape::XML::Node *repr); +static void sp_flowtspan_build (SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr); static void sp_flowtspan_set (SPObject *object, unsigned int key, const gchar *value); static void sp_flowpara_class_init (SPFlowparaClass *klass); @@ -41,7 +41,7 @@ static void sp_flowpara_release (SPObject *object); static Inkscape::XML::Node *sp_flowpara_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void sp_flowpara_update (SPObject *object, SPCtx *ctx, unsigned int flags); static void sp_flowpara_modified (SPObject *object, guint flags); -static void sp_flowpara_build (SPObject *object, Document *doc, Inkscape::XML::Node *repr); +static void sp_flowpara_build (SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr); static void sp_flowpara_set (SPObject *object, unsigned int key, const gchar *value); static void sp_flowline_class_init (SPFlowlineClass *klass); @@ -177,7 +177,7 @@ sp_flowdiv_modified (SPObject *object, guint flags) } static void -sp_flowdiv_build (SPObject *object, Document *doc, Inkscape::XML::Node *repr) +sp_flowdiv_build (SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr) { object->_requireSVGVersion(Inkscape::Version(1, 2)); @@ -354,7 +354,7 @@ sp_flowtspan_modified (SPObject *object, guint flags) } } static void -sp_flowtspan_build (SPObject *object, Document *doc, Inkscape::XML::Node *repr) +sp_flowtspan_build (SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr) { if (((SPObjectClass *) flowtspan_parent_class)->build) ((SPObjectClass *) flowtspan_parent_class)->build (object, doc, repr); @@ -525,7 +525,7 @@ sp_flowpara_modified (SPObject *object, guint flags) } } static void -sp_flowpara_build (SPObject *object, Document *doc, Inkscape::XML::Node *repr) +sp_flowpara_build (SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr) { if (((SPObjectClass *) flowpara_parent_class)->build) ((SPObjectClass *) flowpara_parent_class)->build (object, doc, repr); diff --git a/src/sp-flowtext.cpp b/src/sp-flowtext.cpp index ff4a2fda5..6af2f7169 100644 --- a/src/sp-flowtext.cpp +++ b/src/sp-flowtext.cpp @@ -43,7 +43,7 @@ static void sp_flowtext_remove_child(SPObject *object, Inkscape::XML::Node *chil static void sp_flowtext_update(SPObject *object, SPCtx *ctx, guint flags); static void sp_flowtext_modified(SPObject *object, guint flags); static Inkscape::XML::Node *sp_flowtext_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); -static void sp_flowtext_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_flowtext_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_flowtext_set(SPObject *object, unsigned key, gchar const *value); static void sp_flowtext_bbox(SPItem const *item, NRRect *bbox, Geom::Matrix const &transform, unsigned const flags); @@ -220,7 +220,7 @@ sp_flowtext_modified(SPObject *object, guint flags) } static void -sp_flowtext_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +sp_flowtext_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { object->_requireSVGVersion(Inkscape::Version(1, 2)); @@ -677,7 +677,7 @@ bool SPFlowtext::has_internal_frame() SPItem *create_flowtext_with_internal_frame (SPDesktop *desktop, Geom::Point p0, Geom::Point p1) { - Document *doc = sp_desktop_document (desktop); + SPDocument *doc = sp_desktop_document (desktop); Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc); Inkscape::XML::Node *root_repr = xml_doc->createElement("svg:flowRoot"); diff --git a/src/sp-font-face.cpp b/src/sp-font-face.cpp index 166262bc9..1ec6f4601 100644 --- a/src/sp-font-face.cpp +++ b/src/sp-font-face.cpp @@ -295,7 +295,7 @@ static std::vector sp_read_fontFaceStretchType(gchar const static void sp_fontface_class_init(SPFontFaceClass *fc); static void sp_fontface_init(SPFontFace *font); -static void sp_fontface_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_fontface_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_fontface_release(SPObject *object); static void sp_fontface_set(SPObject *object, unsigned int key, const gchar *value); static Inkscape::XML::Node *sp_fontface_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); @@ -398,7 +398,7 @@ static void sp_fontface_init(SPFontFace *face) */ } -static void sp_fontface_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +static void sp_fontface_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) (parent_class))->build) { ((SPObjectClass *) (parent_class))->build(object, document, repr); diff --git a/src/sp-font.cpp b/src/sp-font.cpp index c960d0fe9..75fb18638 100644 --- a/src/sp-font.cpp +++ b/src/sp-font.cpp @@ -28,7 +28,7 @@ static void sp_font_class_init(SPFontClass *fc); static void sp_font_init(SPFont *font); -static void sp_font_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_font_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_font_release(SPObject *object); static void sp_font_set(SPObject *object, unsigned int key, const gchar *value); static Inkscape::XML::Node *sp_font_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); @@ -90,7 +90,7 @@ static void sp_font_init(SPFont *font) font->vert_adv_y = 0; } -static void sp_font_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +static void sp_font_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) (parent_class))->build) { ((SPObjectClass *) (parent_class))->build(object, document, repr); diff --git a/src/sp-gaussian-blur.cpp b/src/sp-gaussian-blur.cpp index 8544e03fe..e6eab5032 100644 --- a/src/sp-gaussian-blur.cpp +++ b/src/sp-gaussian-blur.cpp @@ -36,7 +36,7 @@ static void sp_gaussianBlur_class_init(SPGaussianBlurClass *klass); static void sp_gaussianBlur_init(SPGaussianBlur *gaussianBlur); -static void sp_gaussianBlur_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_gaussianBlur_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_gaussianBlur_release(SPObject *object); static void sp_gaussianBlur_set(SPObject *object, unsigned int key, gchar const *value); static void sp_gaussianBlur_update(SPObject *object, SPCtx *ctx, guint flags); @@ -94,7 +94,7 @@ sp_gaussianBlur_init(SPGaussianBlur */*gaussianBlur*/) * sp-object-repr.cpp's repr_name_entries array. */ static void -sp_gaussianBlur_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +sp_gaussianBlur_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) gaussianBlur_parent_class)->build) { ((SPObjectClass *) gaussianBlur_parent_class)->build(object, document, repr); diff --git a/src/sp-glyph-kerning.cpp b/src/sp-glyph-kerning.cpp index 7b61f1c3d..6d08f212c 100644 --- a/src/sp-glyph-kerning.cpp +++ b/src/sp-glyph-kerning.cpp @@ -28,7 +28,7 @@ static void sp_glyph_kerning_class_init(SPGlyphKerningClass *gc); static void sp_glyph_kerning_init(SPGlyphKerning *glyph); -static void sp_glyph_kerning_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_glyph_kerning_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_glyph_kerning_release(SPObject *object); static void sp_glyph_kerning_set(SPObject *object, unsigned int key, const gchar *value); static Inkscape::XML::Node *sp_glyph_kerning_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); @@ -105,7 +105,7 @@ static void sp_glyph_kerning_init(SPGlyphKerning *glyph) glyph->k = 0; } -static void sp_glyph_kerning_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +static void sp_glyph_kerning_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) (parent_class))->build) { ((SPObjectClass *) (parent_class))->build(object, document, repr); diff --git a/src/sp-glyph.cpp b/src/sp-glyph.cpp index 6102954f2..8af78a0aa 100644 --- a/src/sp-glyph.cpp +++ b/src/sp-glyph.cpp @@ -25,7 +25,7 @@ static void sp_glyph_class_init(SPGlyphClass *gc); static void sp_glyph_init(SPGlyph *glyph); -static void sp_glyph_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_glyph_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_glyph_release(SPObject *object); static void sp_glyph_set(SPObject *object, unsigned int key, const gchar *value); static Inkscape::XML::Node *sp_glyph_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); @@ -85,7 +85,7 @@ static void sp_glyph_init(SPGlyph *glyph) glyph->vert_adv_y = 0; } -static void sp_glyph_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +static void sp_glyph_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) (parent_class))->build) { ((SPObjectClass *) (parent_class))->build(object, document, repr); diff --git a/src/sp-gradient-test.h b/src/sp-gradient-test.h index 1771b7c3e..bc188401b 100644 --- a/src/sp-gradient-test.h +++ b/src/sp-gradient-test.h @@ -14,7 +14,7 @@ class SPGradientTest : public DocumentUsingTest { public: - Document* _doc; + SPDocument* _doc; SPGradientTest() : _doc(0) diff --git a/src/sp-gradient.cpp b/src/sp-gradient.cpp index c9ceeabf0..84a0a9870 100644 --- a/src/sp-gradient.cpp +++ b/src/sp-gradient.cpp @@ -56,7 +56,7 @@ static void sp_stop_class_init(SPStopClass *klass); static void sp_stop_init(SPStop *stop); -static void sp_stop_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_stop_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_stop_set(SPObject *object, unsigned key, gchar const *value); static Inkscape::XML::Node *sp_stop_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); @@ -114,7 +114,7 @@ sp_stop_init(SPStop *stop) /** * Virtual build: set stop attributes from its associated XML node. */ -static void sp_stop_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +static void sp_stop_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) stop_parent_class)->build) (* ((SPObjectClass *) stop_parent_class)->build)(object, document, repr); @@ -294,7 +294,7 @@ sp_stop_get_color(SPStop const *const stop) static void sp_gradient_class_init(SPGradientClass *klass); static void sp_gradient_init(SPGradient *gr); -static void sp_gradient_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_gradient_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_gradient_release(SPObject *object); static void sp_gradient_set(SPObject *object, unsigned key, gchar const *value); static void sp_gradient_child_added(SPObject *object, @@ -398,7 +398,7 @@ sp_gradient_init(SPGradient *gr) * Virtual build: set gradient attributes from its associated repr. */ static void -sp_gradient_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +sp_gradient_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { SPGradient *gradient = SP_GRADIENT(object); @@ -1402,7 +1402,7 @@ static void sp_lineargradient_class_init(SPLinearGradientClass *klass); static void sp_lineargradient_init(SPLinearGradient *lg); static void sp_lineargradient_build(SPObject *object, - Document *document, + SPDocument *document, Inkscape::XML::Node *repr); static void sp_lineargradient_set(SPObject *object, unsigned key, gchar const *value); static Inkscape::XML::Node *sp_lineargradient_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, @@ -1474,7 +1474,7 @@ static void sp_lineargradient_init(SPLinearGradient *lg) * Callback: set attributes from associated repr. */ static void sp_lineargradient_build(SPObject *object, - Document *document, + SPDocument *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) lg_parent_class)->build) @@ -1677,7 +1677,7 @@ static void sp_radialgradient_class_init(SPRadialGradientClass *klass); static void sp_radialgradient_init(SPRadialGradient *rg); static void sp_radialgradient_build(SPObject *object, - Document *document, + SPDocument *document, Inkscape::XML::Node *repr); static void sp_radialgradient_set(SPObject *object, unsigned key, gchar const *value); static Inkscape::XML::Node *sp_radialgradient_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, @@ -1751,7 +1751,7 @@ sp_radialgradient_init(SPRadialGradient *rg) * Set radial gradient attributes from associated repr. */ static void -sp_radialgradient_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +sp_radialgradient_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) rg_parent_class)->build) (* ((SPObjectClass *) rg_parent_class)->build)(object, document, repr); diff --git a/src/sp-guide.cpp b/src/sp-guide.cpp index 170dfa375..f5edf7d97 100644 --- a/src/sp-guide.cpp +++ b/src/sp-guide.cpp @@ -54,7 +54,7 @@ static void sp_guide_init(SPGuide *guide); static void sp_guide_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); static void sp_guide_get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); -static void sp_guide_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_guide_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_guide_release(SPObject *object); static void sp_guide_set(SPObject *object, unsigned int key, const gchar *value); @@ -152,7 +152,7 @@ static void sp_guide_get_property(GObject *object, guint prop_id, GValue *value, } } -static void sp_guide_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +static void sp_guide_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) (parent_class))->build) { (* ((SPObjectClass *) (parent_class))->build)(object, document, repr); @@ -243,7 +243,7 @@ static void sp_guide_set(SPObject *object, unsigned int key, const gchar *value) SPGuide * sp_guide_create(SPDesktop *desktop, Geom::Point const &pt1, Geom::Point const &pt2) { - Document *doc=sp_desktop_document(desktop); + SPDocument *doc=sp_desktop_document(desktop); Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc); Inkscape::XML::Node *repr = xml_doc->createElement("sodipodi:guide"); @@ -269,7 +269,7 @@ sp_guide_pt_pairs_to_guides(SPDesktop *dt, std::list > pts; Geom::Point A(0, 0); diff --git a/src/sp-image.cpp b/src/sp-image.cpp index 5284bb923..65aad1e2d 100644 --- a/src/sp-image.cpp +++ b/src/sp-image.cpp @@ -69,7 +69,7 @@ static void sp_image_class_init (SPImageClass * klass); static void sp_image_init (SPImage * image); -static void sp_image_build (SPObject * object, Document * document, Inkscape::XML::Node * repr); +static void sp_image_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr); static void sp_image_release (SPObject * object); static void sp_image_set (SPObject *object, unsigned int key, const gchar *value); static void sp_image_update (SPObject *object, SPCtx *ctx, unsigned int flags); @@ -625,7 +625,7 @@ static void sp_image_init( SPImage *image ) } static void -sp_image_build (SPObject *object, Document *document, Inkscape::XML::Node *repr) +sp_image_build (SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) parent_class)->build) { ((SPObjectClass *) parent_class)->build (object, document, repr); @@ -811,7 +811,7 @@ static void sp_image_update (SPObject *object, SPCtx *ctx, unsigned int flags) { SPImage *image = SP_IMAGE(object); - Document *doc = SP_OBJECT_DOCUMENT(object); + SPDocument *doc = SP_OBJECT_DOCUMENT(object); if (((SPObjectClass *) (parent_class))->update) { ((SPObjectClass *) (parent_class))->update (object, ctx, flags); diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp index f9570a885..9c19ce75a 100644 --- a/src/sp-item-group.cpp +++ b/src/sp-item-group.cpp @@ -51,7 +51,7 @@ static void sp_group_class_init (SPGroupClass *klass); static void sp_group_init (SPGroup *group); -static void sp_group_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_group_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_group_release(SPObject *object); static void sp_group_dispose(GObject *object); @@ -144,7 +144,7 @@ sp_group_init (SPGroup *group) new (&group->_display_modes) std::map(); } -static void sp_group_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +static void sp_group_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { sp_object_read_attr(object, "inkscape:groupmode"); @@ -358,7 +358,7 @@ sp_item_group_ungroup (SPGroup *group, GSList **children, bool do_done) g_return_if_fail (group != NULL); g_return_if_fail (SP_IS_GROUP (group)); - Document *doc = SP_OBJECT_DOCUMENT (group); + SPDocument *doc = SP_OBJECT_DOCUMENT (group); SPObject *root = SP_DOCUMENT_ROOT (doc); SPObject *defs = SP_OBJECT (SP_ROOT (root)->defs); diff --git a/src/sp-item.cpp b/src/sp-item.cpp index 16efe677f..662dc1cac 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -83,7 +83,7 @@ static void sp_item_class_init(SPItemClass *klass); static void sp_item_init(SPItem *item); -static void sp_item_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_item_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_item_release(SPObject *object); static void sp_item_set(SPObject *object, unsigned key, gchar const *value); static void sp_item_update(SPObject *object, SPCtx *ctx, guint flags); @@ -401,7 +401,7 @@ void SPItem::lowerToBottom() { } static void -sp_item_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +sp_item_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { sp_object_read_attr(object, "style"); sp_object_read_attr(object, "transform"); diff --git a/src/sp-line.cpp b/src/sp-line.cpp index 36ac643ec..d0ce32397 100644 --- a/src/sp-line.cpp +++ b/src/sp-line.cpp @@ -28,7 +28,7 @@ static void sp_line_class_init (SPLineClass *klass); static void sp_line_init (SPLine *line); -static void sp_line_build (SPObject * object, Document * document, Inkscape::XML::Node * repr); +static void sp_line_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr); static void sp_line_set (SPObject *object, unsigned int key, const gchar *value); static Inkscape::XML::Node *sp_line_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); @@ -96,7 +96,7 @@ sp_line_init (SPLine * line) static void -sp_line_build (SPObject * object, Document * document, Inkscape::XML::Node * repr) +sp_line_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr) { if (((SPObjectClass *) parent_class)->build) { ((SPObjectClass *) parent_class)->build (object, document, repr); diff --git a/src/sp-lpe-item.cpp b/src/sp-lpe-item.cpp index fdf348b78..90e9b2d6d 100644 --- a/src/sp-lpe-item.cpp +++ b/src/sp-lpe-item.cpp @@ -44,7 +44,7 @@ static void sp_lpe_item_class_init(SPLPEItemClass *klass); static void sp_lpe_item_init(SPLPEItem *lpe_item); static void sp_lpe_item_finalize(GObject *object); -static void sp_lpe_item_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_lpe_item_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_lpe_item_release(SPObject *object); static void sp_lpe_item_set(SPObject *object, unsigned int key, gchar const *value); static void sp_lpe_item_update(SPObject *object, SPCtx *ctx, guint flags); @@ -137,7 +137,7 @@ sp_lpe_item_finalize(GObject *object) * sp-object-repr.cpp's repr_name_entries array. */ static void -sp_lpe_item_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +sp_lpe_item_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { sp_object_read_attr(object, "inkscape:path-effect"); diff --git a/src/sp-mask.cpp b/src/sp-mask.cpp index 12876d69a..20cb38297 100644 --- a/src/sp-mask.cpp +++ b/src/sp-mask.cpp @@ -37,7 +37,7 @@ struct SPMaskView { static void sp_mask_class_init (SPMaskClass *klass); static void sp_mask_init (SPMask *mask); -static void sp_mask_build (SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_mask_build (SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_mask_release (SPObject * object); static void sp_mask_set (SPObject *object, unsigned int key, const gchar *value); static void sp_mask_child_added (SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref); @@ -98,7 +98,7 @@ sp_mask_init (SPMask *mask) } static void -sp_mask_build (SPObject *object, Document *document, Inkscape::XML::Node *repr) +sp_mask_build (SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) parent_class)->build) { ((SPObjectClass *) parent_class)->build (object, document, repr); @@ -270,7 +270,7 @@ sp_mask_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML // Create a mask element (using passed elements), add it to const gchar * -sp_mask_create (GSList *reprs, Document *document, Geom::Matrix const* applyTransform) +sp_mask_create (GSList *reprs, SPDocument *document, Geom::Matrix const* applyTransform) { Inkscape::XML::Node *defsrepr = SP_OBJECT_REPR (SP_DOCUMENT_DEFS (document)); diff --git a/src/sp-mask.h b/src/sp-mask.h index 293be8cee..d5bddd332 100644 --- a/src/sp-mask.h +++ b/src/sp-mask.h @@ -60,6 +60,6 @@ void sp_mask_hide (SPMask *mask, unsigned int key); void sp_mask_set_bbox (SPMask *mask, unsigned int key, NRRect *bbox); -const gchar *sp_mask_create (GSList *reprs, Document *document, Geom::Matrix const* applyTransform); +const gchar *sp_mask_create (GSList *reprs, SPDocument *document, Geom::Matrix const* applyTransform); #endif diff --git a/src/sp-metadata.cpp b/src/sp-metadata.cpp index 1b9be0188..920b7d64d 100644 --- a/src/sp-metadata.cpp +++ b/src/sp-metadata.cpp @@ -37,7 +37,7 @@ static void sp_metadata_class_init (SPMetadataClass *klass); static void sp_metadata_init (SPMetadata *metadata); -static void sp_metadata_build (SPObject * object, Document * document, Inkscape::XML::Node * repr); +static void sp_metadata_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr); static void sp_metadata_release (SPObject *object); static void sp_metadata_set (SPObject *object, unsigned int key, const gchar *value); static void sp_metadata_update(SPObject *object, SPCtx *ctx, guint flags); @@ -109,7 +109,7 @@ void strip_ids_recursively(Inkscape::XML::Node *node) { * sp-object-repr.cpp's repr_name_entries array. */ static void -sp_metadata_build (SPObject *object, Document *document, Inkscape::XML::Node *repr) +sp_metadata_build (SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { using Inkscape::XML::NodeSiblingIterator; @@ -207,7 +207,7 @@ sp_metadata_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML: * \brief Retrieves the metadata object associated with a document */ SPMetadata * -sp_document_metadata (Document *document) +sp_document_metadata (SPDocument *document) { SPObject *nv; diff --git a/src/sp-metadata.h b/src/sp-metadata.h index 1de463479..82b7c4fc5 100644 --- a/src/sp-metadata.h +++ b/src/sp-metadata.h @@ -33,7 +33,7 @@ struct SPMetadataClass { GType sp_metadata_get_type (void); -SPMetadata * sp_document_metadata (Document *document); +SPMetadata * sp_document_metadata (SPDocument *document); #endif // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : diff --git a/src/sp-missing-glyph.cpp b/src/sp-missing-glyph.cpp index 4b120717a..ffc29a71e 100644 --- a/src/sp-missing-glyph.cpp +++ b/src/sp-missing-glyph.cpp @@ -25,7 +25,7 @@ static void sp_missing_glyph_class_init(SPMissingGlyphClass *gc); static void sp_missing_glyph_init(SPMissingGlyph *glyph); -static void sp_missing_glyph_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_missing_glyph_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_missing_glyph_release(SPObject *object); static void sp_missing_glyph_set(SPObject *object, unsigned int key, const gchar *value); static Inkscape::XML::Node *sp_missing_glyph_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); @@ -77,7 +77,7 @@ static void sp_missing_glyph_init(SPMissingGlyph *glyph) glyph->vert_adv_y = 0; } -static void sp_missing_glyph_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +static void sp_missing_glyph_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) (parent_class))->build) { ((SPObjectClass *) (parent_class))->build(object, document, repr); diff --git a/src/sp-namedview.cpp b/src/sp-namedview.cpp index 4def33f75..47720c5d6 100644 --- a/src/sp-namedview.cpp +++ b/src/sp-namedview.cpp @@ -46,7 +46,7 @@ static void sp_namedview_class_init(SPNamedViewClass *klass); static void sp_namedview_init(SPNamedView *namedview); -static void sp_namedview_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_namedview_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_namedview_release(SPObject *object); static void sp_namedview_set(SPObject *object, unsigned int key, const gchar *value); static void sp_namedview_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref); @@ -120,7 +120,7 @@ static void sp_namedview_init(SPNamedView *nv) new (&nv->snap_manager) SnapManager(nv); } -static void sp_namedview_generate_old_grid(SPNamedView * /*nv*/, Document *document, Inkscape::XML::Node *repr) { +static void sp_namedview_generate_old_grid(SPNamedView * /*nv*/, SPDocument *document, Inkscape::XML::Node *repr) { bool old_grid_settings_present = false; // set old settings @@ -208,7 +208,7 @@ static void sp_namedview_generate_old_grid(SPNamedView * /*nv*/, Document *docum } } -static void sp_namedview_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +static void sp_namedview_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { SPNamedView *nv = (SPNamedView *) object; SPObjectGroup *og = (SPObjectGroup *) object; @@ -777,7 +777,7 @@ void sp_namedview_window_from_document(SPDesktop *desktop) void sp_namedview_update_layers_from_document (SPDesktop *desktop) { SPObject *layer = NULL; - Document *document = desktop->doc(); + SPDocument *document = desktop->doc(); SPNamedView *nv = desktop->namedview; if ( nv->default_layer_id != 0 ) { layer = document->getObjectById(g_quark_to_string(nv->default_layer_id)); @@ -878,7 +878,7 @@ static void sp_namedview_show_single_guide(SPGuide* guide, bool show) } } -void sp_namedview_toggle_guides(Document *doc, Inkscape::XML::Node *repr) +void sp_namedview_toggle_guides(SPDocument *doc, Inkscape::XML::Node *repr) { unsigned int v; unsigned int set = sp_repr_get_boolean(repr, "showguides", &v); @@ -900,7 +900,7 @@ void sp_namedview_show_grids(SPNamedView * namedview, bool show, bool dirty_docu { namedview->grids_visible = show; - Document *doc = SP_OBJECT_DOCUMENT (namedview); + SPDocument *doc = SP_OBJECT_DOCUMENT (namedview); Inkscape::XML::Node *repr = SP_OBJECT_REPR(namedview); bool saved = sp_document_get_undo_sensitive(doc); @@ -966,7 +966,7 @@ static gboolean sp_nv_read_opacity(const gchar *str, guint32 *color) return TRUE; } -SPNamedView *sp_document_namedview(Document *document, const gchar *id) +SPNamedView *sp_document_namedview(SPDocument *document, const gchar *id) { g_return_val_if_fail(document != NULL, NULL); diff --git a/src/sp-namedview.h b/src/sp-namedview.h index 450e80d47..048096d8c 100644 --- a/src/sp-namedview.h +++ b/src/sp-namedview.h @@ -88,13 +88,13 @@ struct SPNamedViewClass { GType sp_namedview_get_type(); -SPNamedView *sp_document_namedview(Document *document, gchar const *name); +SPNamedView *sp_document_namedview(SPDocument *document, gchar const *name); void sp_namedview_window_from_document(SPDesktop *desktop); void sp_namedview_document_from_window(SPDesktop *desktop); void sp_namedview_update_layers_from_document (SPDesktop *desktop); -void sp_namedview_toggle_guides(Document *doc, Inkscape::XML::Node *repr); +void sp_namedview_toggle_guides(SPDocument *doc, Inkscape::XML::Node *repr); void sp_namedview_show_grids(SPNamedView *namedview, bool show, bool dirty_document); Inkscape::CanvasGrid * sp_namedview_get_first_enabled_grid(SPNamedView *namedview); diff --git a/src/sp-object-repr.cpp b/src/sp-object-repr.cpp index 7583049dc..4c3d5196e 100644 --- a/src/sp-object-repr.cpp +++ b/src/sp-object-repr.cpp @@ -94,7 +94,7 @@ static GType name_to_gtype(NameType name_type, gchar const *name); * Construct an SPRoot and all its descendents from the given repr. */ SPObject * -sp_object_repr_build_tree(Document *document, Inkscape::XML::Node *repr) +sp_object_repr_build_tree(SPDocument *document, Inkscape::XML::Node *repr) { g_assert(document != NULL); g_assert(repr != NULL); diff --git a/src/sp-object-repr.h b/src/sp-object-repr.h index 5a6b1772f..f3a80f83c 100644 --- a/src/sp-object-repr.h +++ b/src/sp-object-repr.h @@ -21,7 +21,7 @@ class Node; } -SPObject *sp_object_repr_build_tree (Document *document, Inkscape::XML::Node *repr); +SPObject *sp_object_repr_build_tree (SPDocument *document, Inkscape::XML::Node *repr); GType sp_repr_type_lookup (Inkscape::XML::Node *repr); diff --git a/src/sp-object.cpp b/src/sp-object.cpp index fade379bd..85e8a4e9a 100644 --- a/src/sp-object.cpp +++ b/src/sp-object.cpp @@ -27,7 +27,7 @@ * propagate to the SPRepr layer. This is important for implementation of * the undo stack, animations and other features. * - * SPObjects are bound to the higher-level container Document, which + * SPObjects are bound to the higher-level container SPDocument, which * provides document level functionality such as the undo stack, * dictionary and so on. Source: doc/architecture.txt */ @@ -84,7 +84,7 @@ static void sp_object_remove_child(SPObject *object, Inkscape::XML::Node *child) static void sp_object_order_changed(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *old_ref, Inkscape::XML::Node *new_ref); static void sp_object_release(SPObject *object); -static void sp_object_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_object_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_object_private_set(SPObject *object, unsigned int key, gchar const *value); static Inkscape::XML::Node *sp_object_private_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); @@ -783,11 +783,11 @@ static void sp_object_order_changed(SPObject *object, Inkscape::XML::Node *child * the document and repr; implementation then will parse all of the attributes, * generate the children objects and so on. Invoking build on the SPRoot * object results in creation of the whole document tree (this is, what - * Document does after the creation of the XML tree). + * SPDocument does after the creation of the XML tree). * \see sp_object_release() */ static void -sp_object_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +sp_object_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { /* Nothing specific here */ debug("id=%x, typename=%s", object, g_type_name_from_instance((GTypeInstance*)object)); @@ -809,7 +809,7 @@ sp_object_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) } void -sp_object_invoke_build(SPObject *object, Document *document, Inkscape::XML::Node *repr, unsigned int cloned) +sp_object_invoke_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr, unsigned int cloned) { debug("id=%x, typename=%s", object, g_type_name_from_instance((GTypeInstance*)object)); @@ -960,7 +960,7 @@ sp_object_private_set(SPObject *object, unsigned int key, gchar const *value) switch (key) { case SP_ATTR_ID: if ( !SP_OBJECT_IS_CLONED(object) && object->repr->type() == Inkscape::XML::ELEMENT_NODE ) { - Document *document=object->document; + SPDocument *document=object->document; SPObject *conflict=NULL; gchar const *new_id = value; diff --git a/src/sp-object.h b/src/sp-object.h index 9a4f8fd4d..bbb8ecbd0 100644 --- a/src/sp-object.h +++ b/src/sp-object.h @@ -149,7 +149,7 @@ struct SPObject : public GObject { SPIXmlSpace xml_space; unsigned int hrefcount; /* number of xlink:href references */ unsigned int _total_hrefcount; /* our hrefcount + total descendants */ - Inkscape::XML::Document *document; /* Document we are part of */ + SPDocument *document; /* Document we are part of */ SPObject *parent; /* Our parent (only one allowed) */ SPObject *children; /* Our children */ SPObject *_last_child; /* Remembered last child */ @@ -429,7 +429,7 @@ struct SPObject : public GObject { /** @brief Updates the object's display immediately * - * This method is called during the idle loop by Document in order to update the object's + * This method is called during the idle loop by SPDocument in order to update the object's * display. * * One additional flag is legal here: @@ -501,7 +501,7 @@ private: struct SPObjectClass { GObjectClass parent_class; - void (* build) (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr); + void (* build) (SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr); void (* release) (SPObject *object); /* Virtual handlers of repr signals */ @@ -519,7 +519,7 @@ struct SPObjectClass { /* Modification handler */ void (* modified) (SPObject *object, unsigned int flags); - Inkscape::XML::Node * (* write) (SPObject *object, Inkscape::XML::DocumentTree *doc, Inkscape::XML::Node *repr, unsigned int flags); + Inkscape::XML::Node * (* write) (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, unsigned int flags); }; @@ -536,7 +536,7 @@ inline SPObject *sp_object_first_child(SPObject *parent) { } SPObject *sp_object_get_child_by_repr(SPObject *object, Inkscape::XML::Node *repr); -void sp_object_invoke_build(SPObject *object, Inkscape::XML::Document *document, Inkscape::XML::Node *repr, unsigned int cloned); +void sp_object_invoke_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr, unsigned int cloned); void sp_object_set(SPObject *object, unsigned int key, gchar const *value); diff --git a/src/sp-offset.cpp b/src/sp-offset.cpp index 12e98d5ef..ae0f7bf19 100644 --- a/src/sp-offset.cpp +++ b/src/sp-offset.cpp @@ -42,7 +42,7 @@ #include "xml/repr.h" -class Document; +class SPDocument; #define noOFFSET_VERBOSE @@ -73,7 +73,7 @@ static void sp_offset_class_init (SPOffsetClass * klass); static void sp_offset_init (SPOffset * offset); static void sp_offset_finalize(GObject *obj); -static void sp_offset_build (SPObject * object, Document * document, +static void sp_offset_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr); static Inkscape::XML::Node *sp_offset_write (SPObject * object, Inkscape::XML::Document *doc, Inkscape::XML::Node * repr, guint flags); @@ -212,7 +212,7 @@ sp_offset_finalize(GObject *obj) * Virtual build: set offset attributes from corresponding repr. */ static void -sp_offset_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +sp_offset_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) parent_class)->build) ((SPObjectClass *) parent_class)->build (object, document, repr); diff --git a/src/sp-paint-server.h b/src/sp-paint-server.h index 0402ac3ce..998f1556b 100644 --- a/src/sp-paint-server.h +++ b/src/sp-paint-server.h @@ -63,7 +63,7 @@ SPPainter *sp_painter_free (SPPainter *painter); class SPPaintServerReference : public Inkscape::URIReference { public: SPPaintServerReference (SPObject *obj) : URIReference(obj) {} - SPPaintServerReference (Document *doc) : URIReference(doc) {} + SPPaintServerReference (SPDocument *doc) : URIReference(doc) {} SPPaintServer *getObject() const { return (SPPaintServer *)URIReference::getObject(); } diff --git a/src/sp-path.cpp b/src/sp-path.cpp index b6637e9d1..04ad386d9 100644 --- a/src/sp-path.cpp +++ b/src/sp-path.cpp @@ -56,7 +56,7 @@ static void sp_path_init(SPPath *path); static void sp_path_finalize(GObject *obj); static void sp_path_release(SPObject *object); -static void sp_path_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_path_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_path_set(SPObject *object, unsigned key, gchar const *value); static Inkscape::XML::Node *sp_path_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); @@ -211,7 +211,7 @@ sp_path_finalize(GObject *obj) * fill & style attributes, markers, and CSS properties. */ static void -sp_path_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +sp_path_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { /* Are these calls actually necessary? */ sp_object_read_attr(object, "marker"); diff --git a/src/sp-pattern.cpp b/src/sp-pattern.cpp index 60d2254f7..90af65b97 100644 --- a/src/sp-pattern.cpp +++ b/src/sp-pattern.cpp @@ -64,7 +64,7 @@ struct SPPatPainter { static void sp_pattern_class_init (SPPatternClass *klass); static void sp_pattern_init (SPPattern *gr); -static void sp_pattern_build (SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_pattern_build (SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_pattern_release (SPObject *object); static void sp_pattern_set (SPObject *object, unsigned int key, const gchar *value); static void sp_pattern_child_added (SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref); @@ -151,7 +151,7 @@ sp_pattern_init (SPPattern *pat) } static void -sp_pattern_build (SPObject *object, Document *document, Inkscape::XML::Node *repr) +sp_pattern_build (SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) pattern_parent_class)->build) (* ((SPObjectClass *) pattern_parent_class)->build) (object, document, repr); @@ -443,7 +443,7 @@ pattern_users (SPPattern *pattern) SPPattern * pattern_chain (SPPattern *pattern) { - Document *document = SP_OBJECT_DOCUMENT (pattern); + SPDocument *document = SP_OBJECT_DOCUMENT (pattern); Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document); Inkscape::XML::Node *defsrepr = SP_OBJECT_REPR (SP_DOCUMENT_DEFS (document)); @@ -496,7 +496,7 @@ sp_pattern_transform_multiply (SPPattern *pattern, Geom::Matrix postmul, bool se } const gchar * -pattern_tile (GSList *reprs, Geom::Rect bounds, Document *document, Geom::Matrix transform, Geom::Matrix move) +pattern_tile (GSList *reprs, Geom::Rect bounds, SPDocument *document, Geom::Matrix transform, Geom::Matrix move) { Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document); Inkscape::XML::Node *defsrepr = SP_OBJECT_REPR (SP_DOCUMENT_DEFS (document)); diff --git a/src/sp-pattern.h b/src/sp-pattern.h index 48c450425..f15285e27 100644 --- a/src/sp-pattern.h +++ b/src/sp-pattern.h @@ -86,7 +86,7 @@ SPPattern *pattern_chain (SPPattern *pattern); SPPattern *sp_pattern_clone_if_necessary (SPItem *item, SPPattern *pattern, const gchar *property); void sp_pattern_transform_multiply (SPPattern *pattern, Geom::Matrix postmul, bool set); -const gchar *pattern_tile (GSList *reprs, Geom::Rect bounds, Document *document, Geom::Matrix transform, Geom::Matrix move); +const gchar *pattern_tile (GSList *reprs, Geom::Rect bounds, SPDocument *document, Geom::Matrix transform, Geom::Matrix move); SPPattern *pattern_getroot (SPPattern *pat); diff --git a/src/sp-polygon.cpp b/src/sp-polygon.cpp index 0f9003f34..014c68c9b 100644 --- a/src/sp-polygon.cpp +++ b/src/sp-polygon.cpp @@ -29,7 +29,7 @@ static void sp_polygon_class_init(SPPolygonClass *pc); static void sp_polygon_init(SPPolygon *polygon); -static void sp_polygon_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_polygon_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static Inkscape::XML::Node *sp_polygon_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static gchar *sp_polygon_description(SPItem *item); @@ -78,7 +78,7 @@ static void sp_polygon_init(SPPolygon */*polygon*/) /* Nothing here */ } -static void sp_polygon_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +static void sp_polygon_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) parent_class)->build) { ((SPObjectClass *) parent_class)->build(object, document, repr); diff --git a/src/sp-polyline.cpp b/src/sp-polyline.cpp index ff7951992..08f446d61 100644 --- a/src/sp-polyline.cpp +++ b/src/sp-polyline.cpp @@ -23,7 +23,7 @@ static void sp_polyline_class_init (SPPolyLineClass *klass); static void sp_polyline_init (SPPolyLine *polyline); -static void sp_polyline_build (SPObject * object, Document * document, Inkscape::XML::Node * repr); +static void sp_polyline_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr); static void sp_polyline_set (SPObject *object, unsigned int key, const gchar *value); static Inkscape::XML::Node *sp_polyline_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); @@ -81,7 +81,7 @@ sp_polyline_init (SPPolyLine * /*polyline*/) } static void -sp_polyline_build (SPObject * object, Document * document, Inkscape::XML::Node * repr) +sp_polyline_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr) { if (((SPObjectClass *) parent_class)->build) diff --git a/src/sp-rect.cpp b/src/sp-rect.cpp index 6e4b515c0..aa026abb3 100644 --- a/src/sp-rect.cpp +++ b/src/sp-rect.cpp @@ -36,7 +36,7 @@ static void sp_rect_class_init(SPRectClass *klass); static void sp_rect_init(SPRect *rect); -static void sp_rect_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_rect_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_rect_set(SPObject *object, unsigned key, gchar const *value); static void sp_rect_update(SPObject *object, SPCtx *ctx, guint flags); static Inkscape::XML::Node *sp_rect_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); @@ -108,7 +108,7 @@ sp_rect_init(SPRect */*rect*/) } static void -sp_rect_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +sp_rect_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) parent_class)->build) ((SPObjectClass *) parent_class)->build(object, document, repr); diff --git a/src/sp-root.cpp b/src/sp-root.cpp index e06405df5..bd935074d 100644 --- a/src/sp-root.cpp +++ b/src/sp-root.cpp @@ -41,7 +41,7 @@ class SPDesktop; static void sp_root_class_init(SPRootClass *klass); static void sp_root_init(SPRoot *root); -static void sp_root_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_root_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_root_release(SPObject *object); static void sp_root_set(SPObject *object, unsigned int key, gchar const *value); static void sp_root_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref); @@ -141,7 +141,7 @@ sp_root_init(SPRoot *root) * It then calls the object's parent class object's build function. */ static void -sp_root_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +sp_root_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { SPGroup *group = (SPGroup *) object; SPRoot *root = (SPRoot *) object; diff --git a/src/sp-script.cpp b/src/sp-script.cpp index d495ac51f..a40132450 100644 --- a/src/sp-script.cpp +++ b/src/sp-script.cpp @@ -23,7 +23,7 @@ static void sp_script_release(SPObject *object); static void sp_script_update(SPObject *object, SPCtx *ctx, guint flags); static void sp_script_modified(SPObject *object, guint flags); static void sp_script_set(SPObject *object, unsigned int key, gchar const *value); -static void sp_script_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_script_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static Inkscape::XML::Node *sp_script_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static SPObjectClass *parent_class; @@ -76,7 +76,7 @@ static void sp_script_init(SPScript */*script*/) * sp-object-repr.cpp's repr_name_entries array. */ static void -sp_script_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +sp_script_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) parent_class)->build) { ((SPObjectClass *) parent_class)->build(object, document, repr); diff --git a/src/sp-shape.cpp b/src/sp-shape.cpp index 638d2b040..e7ded6303 100644 --- a/src/sp-shape.cpp +++ b/src/sp-shape.cpp @@ -56,7 +56,7 @@ static void sp_shape_class_init (SPShapeClass *klass); static void sp_shape_init (SPShape *shape); static void sp_shape_finalize (GObject *object); -static void sp_shape_build (SPObject * object, Document * document, Inkscape::XML::Node * repr); +static void sp_shape_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr); static void sp_shape_release (SPObject *object); static void sp_shape_set(SPObject *object, unsigned key, gchar const *value); @@ -169,7 +169,7 @@ sp_shape_finalize (GObject *object) * \see sp_object_build() */ static void -sp_shape_build (SPObject *object, Document *document, Inkscape::XML::Node *repr) +sp_shape_build (SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) (parent_class))->build) { (*((SPObjectClass *) (parent_class))->build) (object, document, repr); diff --git a/src/sp-skeleton.cpp b/src/sp-skeleton.cpp index b92f738db..ec6c9b437 100644 --- a/src/sp-skeleton.cpp +++ b/src/sp-skeleton.cpp @@ -44,7 +44,7 @@ static void sp_skeleton_class_init(SPSkeletonClass *klass); static void sp_skeleton_init(SPSkeleton *skeleton); -static void sp_skeleton_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_skeleton_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_skeleton_release(SPObject *object); static void sp_skeleton_set(SPObject *object, unsigned int key, gchar const *value); static void sp_skeleton_update(SPObject *object, SPCtx *ctx, guint flags); @@ -100,7 +100,7 @@ sp_skeleton_init(SPSkeleton *skeleton) * sp-object-repr.cpp's repr_name_entries array. */ static void -sp_skeleton_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +sp_skeleton_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { debug("0x%p",object); if (((SPObjectClass *) skeleton_parent_class)->build) { diff --git a/src/sp-spiral.cpp b/src/sp-spiral.cpp index f0f95fb9c..71906fcc0 100644 --- a/src/sp-spiral.cpp +++ b/src/sp-spiral.cpp @@ -30,7 +30,7 @@ static void sp_spiral_class_init (SPSpiralClass *klass); static void sp_spiral_init (SPSpiral *spiral); -static void sp_spiral_build (SPObject * object, Document * document, Inkscape::XML::Node * repr); +static void sp_spiral_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr); static Inkscape::XML::Node *sp_spiral_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void sp_spiral_set (SPObject *object, unsigned int key, const gchar *value); static void sp_spiral_update (SPObject *object, SPCtx *ctx, guint flags); @@ -123,7 +123,7 @@ sp_spiral_init (SPSpiral * spiral) * Virtual build: set spiral properties from corresponding repr. */ static void -sp_spiral_build (SPObject * object, Document * document, Inkscape::XML::Node * repr) +sp_spiral_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr) { if (((SPObjectClass *) parent_class)->build) ((SPObjectClass *) parent_class)->build (object, document, repr); diff --git a/src/sp-star.cpp b/src/sp-star.cpp index 88b24aa77..71c9ad1c7 100644 --- a/src/sp-star.cpp +++ b/src/sp-star.cpp @@ -33,7 +33,7 @@ static void sp_star_class_init (SPStarClass *klass); static void sp_star_init (SPStar *star); -static void sp_star_build (SPObject * object, Document * document, Inkscape::XML::Node * repr); +static void sp_star_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr); static Inkscape::XML::Node *sp_star_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void sp_star_set (SPObject *object, unsigned int key, const gchar *value); static void sp_star_update (SPObject *object, SPCtx *ctx, guint flags); @@ -111,7 +111,7 @@ sp_star_init (SPStar * star) } static void -sp_star_build (SPObject * object, Document * document, Inkscape::XML::Node * repr) +sp_star_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr) { if (((SPObjectClass *) parent_class)->build) ((SPObjectClass *) parent_class)->build (object, document, repr); diff --git a/src/sp-string.cpp b/src/sp-string.cpp index a1a974310..871338ad5 100644 --- a/src/sp-string.cpp +++ b/src/sp-string.cpp @@ -40,7 +40,7 @@ static void sp_string_class_init(SPStringClass *classname); static void sp_string_init(SPString *string); -static void sp_string_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_string_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_string_release(SPObject *object); static void sp_string_read_content(SPObject *object); static void sp_string_update(SPObject *object, SPCtx *ctx, unsigned flags); @@ -91,7 +91,7 @@ sp_string_init(SPString *string) } static void -sp_string_build(SPObject *object, Document *doc, Inkscape::XML::Node *repr) +sp_string_build(SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr) { sp_string_read_content(object); diff --git a/src/sp-style-elem-test.h b/src/sp-style-elem-test.h index 75e2d450c..6e24ee28c 100644 --- a/src/sp-style-elem-test.h +++ b/src/sp-style-elem-test.h @@ -12,7 +12,7 @@ class SPStyleElemTest : public CxxTest::TestSuite { public: - Document* _doc; + SPDocument* _doc; SPStyleElemTest() : _doc(0) diff --git a/src/sp-style-elem.cpp b/src/sp-style-elem.cpp index 1becc4221..46c311920 100644 --- a/src/sp-style-elem.cpp +++ b/src/sp-style-elem.cpp @@ -9,7 +9,7 @@ using Inkscape::XML::TEXT_NODE; static void sp_style_elem_init(SPStyleElem *style_elem); static void sp_style_elem_class_init(SPStyleElemClass *klass); -static void sp_style_elem_build(SPObject *object, Document *doc, Inkscape::XML::Node *repr); +static void sp_style_elem_build(SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr); static void sp_style_elem_set(SPObject *object, unsigned const key, gchar const *const value); static void sp_style_elem_read_content(SPObject *); static Inkscape::XML::Node *sp_style_elem_write(SPObject *, Inkscape::XML::Document *, Inkscape::XML::Node *, guint flags); @@ -385,7 +385,7 @@ rec_add_listener(Inkscape::XML::Node &repr, } static void -sp_style_elem_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +sp_style_elem_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { sp_style_elem_read_content(object); diff --git a/src/sp-symbol.cpp b/src/sp-symbol.cpp index 8b176fb0a..41004db6e 100644 --- a/src/sp-symbol.cpp +++ b/src/sp-symbol.cpp @@ -31,7 +31,7 @@ static void sp_symbol_class_init (SPSymbolClass *klass); static void sp_symbol_init (SPSymbol *symbol); -static void sp_symbol_build (SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_symbol_build (SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_symbol_release (SPObject *object); static void sp_symbol_set (SPObject *object, unsigned int key, const gchar *value); static void sp_symbol_child_added (SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref); @@ -102,7 +102,7 @@ sp_symbol_init (SPSymbol *symbol) } static void -sp_symbol_build (SPObject *object, Document *document, Inkscape::XML::Node *repr) +sp_symbol_build (SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { SPGroup *group; SPSymbol *symbol; diff --git a/src/sp-text.cpp b/src/sp-text.cpp index 325b3b381..61947311c 100644 --- a/src/sp-text.cpp +++ b/src/sp-text.cpp @@ -62,7 +62,7 @@ static void sp_text_class_init (SPTextClass *classname); static void sp_text_init (SPText *text); static void sp_text_release (SPObject *object); -static void sp_text_build (SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_text_build (SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_text_set (SPObject *object, unsigned key, gchar const *value); static void sp_text_child_added (SPObject *object, Inkscape::XML::Node *rch, Inkscape::XML::Node *ref); static void sp_text_remove_child (SPObject *object, Inkscape::XML::Node *rch); @@ -147,7 +147,7 @@ sp_text_release (SPObject *object) } static void -sp_text_build (SPObject *object, Document *doc, Inkscape::XML::Node *repr) +sp_text_build (SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr) { sp_object_read_attr(object, "x"); sp_object_read_attr(object, "y"); diff --git a/src/sp-tref.cpp b/src/sp-tref.cpp index 5323cde84..83f9ecfa6 100644 --- a/src/sp-tref.cpp +++ b/src/sp-tref.cpp @@ -58,7 +58,7 @@ static void sp_tref_class_init(SPTRefClass *tref_class); static void sp_tref_init(SPTRef *tref); static void sp_tref_finalize(GObject *obj); -static void sp_tref_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_tref_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_tref_release(SPObject *object); static void sp_tref_set(SPObject *object, unsigned int key, gchar const *value); static void sp_tref_update(SPObject *object, SPCtx *ctx, guint flags); @@ -148,7 +148,7 @@ sp_tref_finalize(GObject *obj) * Reads the Inkscape::XML::Node, and initializes SPTRef variables. */ static void -sp_tref_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +sp_tref_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) tref_parent_class)->build) { ((SPObjectClass *) tref_parent_class)->build(object, document, repr); @@ -585,7 +585,7 @@ sp_tref_convert_to_tspan(SPObject *obj) Inkscape::XML::Node *tref_repr = SP_OBJECT_REPR(tref); Inkscape::XML::Node *tref_parent = sp_repr_parent(tref_repr); - Document *document = SP_OBJECT(tref)->document; + SPDocument *document = SP_OBJECT(tref)->document; Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document); Inkscape::XML::Node *new_tspan_repr = xml_doc->createElement("svg:tspan"); diff --git a/src/sp-tspan.cpp b/src/sp-tspan.cpp index a35ceae72..89a86218e 100644 --- a/src/sp-tspan.cpp +++ b/src/sp-tspan.cpp @@ -52,7 +52,7 @@ static void sp_tspan_class_init(SPTSpanClass *classname); static void sp_tspan_init(SPTSpan *tspan); -static void sp_tspan_build(SPObject * object, Document * document, Inkscape::XML::Node * repr); +static void sp_tspan_build(SPObject * object, SPDocument * document, Inkscape::XML::Node * repr); static void sp_tspan_release(SPObject *object); static void sp_tspan_set(SPObject *object, unsigned key, gchar const *value); static void sp_tspan_update(SPObject *object, SPCtx *ctx, guint flags); @@ -129,7 +129,7 @@ sp_tspan_release(SPObject *object) } static void -sp_tspan_build(SPObject *object, Document *doc, Inkscape::XML::Node *repr) +sp_tspan_build(SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr) { //SPTSpan *tspan = SP_TSPAN(object); @@ -293,7 +293,7 @@ static void sp_textpath_class_init(SPTextPathClass *classname); static void sp_textpath_init(SPTextPath *textpath); static void sp_textpath_finalize(GObject *obj); -static void sp_textpath_build(SPObject * object, Document * document, Inkscape::XML::Node * repr); +static void sp_textpath_build(SPObject * object, SPDocument * document, Inkscape::XML::Node * repr); static void sp_textpath_release(SPObject *object); static void sp_textpath_set(SPObject *object, unsigned key, gchar const *value); static void sp_textpath_update(SPObject *object, SPCtx *ctx, guint flags); @@ -388,7 +388,7 @@ sp_textpath_release(SPObject *object) } static void -sp_textpath_build(SPObject *object, Document *doc, Inkscape::XML::Node *repr) +sp_textpath_build(SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr) { //SPTextPath *textpath = SP_TEXTPATH(object); diff --git a/src/sp-use.cpp b/src/sp-use.cpp index 5e3c7ee10..76930086c 100644 --- a/src/sp-use.cpp +++ b/src/sp-use.cpp @@ -44,7 +44,7 @@ static void sp_use_class_init(SPUseClass *classname); static void sp_use_init(SPUse *use); static void sp_use_finalize(GObject *obj); -static void sp_use_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void sp_use_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_use_release(SPObject *object); static void sp_use_set(SPObject *object, unsigned key, gchar const *value); static Inkscape::XML::Node *sp_use_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); @@ -154,7 +154,7 @@ sp_use_finalize(GObject *obj) } static void -sp_use_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +sp_use_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) parent_class)->build) { (* ((SPObjectClass *) parent_class)->build)(object, document, repr); @@ -666,7 +666,7 @@ sp_use_unlink(SPUse *use) if (!repr) return NULL; Inkscape::XML::Node *parent = sp_repr_parent(repr); - Document *document = SP_OBJECT(use)->document; + SPDocument *document = SP_OBJECT(use)->document; Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document); // Track the ultimate source of a chain of uses. diff --git a/src/splivarot.cpp b/src/splivarot.cpp index 87f3dd890..feba2cab6 100644 --- a/src/splivarot.cpp +++ b/src/splivarot.cpp @@ -602,7 +602,7 @@ sp_selected_path_boolop(SPDesktop *desktop, bool_op bop, const unsigned int verb static void sp_selected_path_outline_add_marker( SPObject *marker_object, Geom::Matrix marker_transform, Geom::Scale stroke_scale, Geom::Matrix transform, - Inkscape::XML::Node *g_repr, Inkscape::XML::Document *xml_doc, Document * doc ) + Inkscape::XML::Node *g_repr, Inkscape::XML::Document *xml_doc, SPDocument * doc ) { SPMarker* marker = SP_MARKER (marker_object); SPItem* marker_item = sp_item_first_item_child (SP_OBJECT (marker_object)); @@ -813,7 +813,7 @@ sp_selected_path_outline(SPDesktop *desktop) if (res->descr_cmd.size() > 1) { // if there's 0 or 1 node left, drop this path altogether - Document * doc = sp_desktop_document(desktop); + SPDocument * doc = sp_desktop_document(desktop); Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc); Inkscape::XML::Node *repr = xml_doc->createElement("svg:path"); diff --git a/src/style-test.h b/src/style-test.h index 7ebbf08be..a2d5fcf24 100644 --- a/src/style-test.h +++ b/src/style-test.h @@ -11,7 +11,7 @@ class StyleTest : public CxxTest::TestSuite { public: - Document* _doc; + SPDocument* _doc; StyleTest() : _doc(0) diff --git a/src/style.cpp b/src/style.cpp index e564aa60b..dd8169282 100644 --- a/src/style.cpp +++ b/src/style.cpp @@ -84,10 +84,10 @@ static void sp_style_read_istring(SPIString *val, gchar const *str); static void sp_style_read_ilength(SPILength *val, gchar const *str); static void sp_style_read_ilengthornormal(SPILengthOrNormal *val, gchar const *str); static void sp_style_read_itextdecoration(SPITextDecoration *val, gchar const *str); -static void sp_style_read_icolor(SPIPaint *paint, gchar const *str, SPStyle *style, Document *document); -static void sp_style_read_ipaint(SPIPaint *paint, gchar const *str, SPStyle *style, Document *document); +static void sp_style_read_icolor(SPIPaint *paint, gchar const *str, SPStyle *style, SPDocument *document); +static void sp_style_read_ipaint(SPIPaint *paint, gchar const *str, SPStyle *style, SPDocument *document); static void sp_style_read_ifontsize(SPIFontSize *val, gchar const *str); -static void sp_style_read_ifilter(gchar const *str, SPStyle *style, Document *document); +static void sp_style_read_ifilter(gchar const *str, SPStyle *style, SPDocument *document); static void sp_style_read_penum(SPIEnum *val, Inkscape::XML::Node *repr, gchar const *key, SPStyleEnum const *dict, bool can_explicitly_inherit); static void sp_style_read_plength(SPILength *val, Inkscape::XML::Node *repr, gchar const *key); @@ -443,7 +443,7 @@ sp_style_stroke_paint_server_ref_changed(SPObject *old_ref, SPObject *ref, SPSty * Returns a new SPStyle object with settings as per sp_style_clear(). */ SPStyle * -sp_style_new(Document *document) +sp_style_new(SPDocument *document) { SPStyle *const style = g_new0(SPStyle, 1); @@ -1086,7 +1086,7 @@ sp_style_merge_property(SPStyle *style, gint id, gchar const *val) break; } case SP_PROP_MARKER: - /* TODO: Call sp_uri_reference_resolve(Document *document, guchar const *uri) */ + /* TODO: Call sp_uri_reference_resolve(SPDocument *document, guchar const *uri) */ /* style->marker[SP_MARKER_LOC] = g_quark_from_string(val); */ if (!style->marker[SP_MARKER_LOC].set) { g_free(style->marker[SP_MARKER_LOC].value); @@ -1097,7 +1097,7 @@ sp_style_merge_property(SPStyle *style, gint id, gchar const *val) break; case SP_PROP_MARKER_START: - /* TODO: Call sp_uri_reference_resolve(Document *document, guchar const *uri) */ + /* TODO: Call sp_uri_reference_resolve(SPDocument *document, guchar const *uri) */ if (!style->marker[SP_MARKER_LOC_START].set) { g_free(style->marker[SP_MARKER_LOC_START].value); style->marker[SP_MARKER_LOC_START].value = g_strdup(val); @@ -1106,7 +1106,7 @@ sp_style_merge_property(SPStyle *style, gint id, gchar const *val) } break; case SP_PROP_MARKER_MID: - /* TODO: Call sp_uri_reference_resolve(Document *document, guchar const *uri) */ + /* TODO: Call sp_uri_reference_resolve(SPDocument *document, guchar const *uri) */ if (!style->marker[SP_MARKER_LOC_MID].set) { g_free(style->marker[SP_MARKER_LOC_MID].value); style->marker[SP_MARKER_LOC_MID].value = g_strdup(val); @@ -1115,7 +1115,7 @@ sp_style_merge_property(SPStyle *style, gint id, gchar const *val) } break; case SP_PROP_MARKER_END: - /* TODO: Call sp_uri_reference_resolve(Document *document, guchar const *uri) */ + /* TODO: Call sp_uri_reference_resolve(SPDocument *document, guchar const *uri) */ if (!style->marker[SP_MARKER_LOC_END].set) { g_free(style->marker[SP_MARKER_LOC_END].value); style->marker[SP_MARKER_LOC_END].value = g_strdup(val); @@ -2111,7 +2111,7 @@ sp_style_merge_from_dying_parent(SPStyle *const style, SPStyle const *const pare static void -sp_style_set_ipaint_to_uri(SPStyle *style, SPIPaint *paint, const Inkscape::URI *uri, Document *document) +sp_style_set_ipaint_to_uri(SPStyle *style, SPIPaint *paint, const Inkscape::URI *uri, SPDocument *document) { // it may be that this style's SPIPaint has not yet created its URIReference; // now that we have a document, we can create it here @@ -2561,7 +2561,7 @@ sp_style_clear(SPStyle *style) /** \todo fixme: Do that text manipulation via parents */ SPObject *object = style->object; - Document *document = style->document; + SPDocument *document = style->document; gint const refcount = style->refcount; SPTextStyle *text = style->text; unsigned const text_private = style->text_private; @@ -3089,7 +3089,7 @@ sp_style_read_itextdecoration(SPITextDecoration *val, gchar const *str) * \param document Ignored */ static void -sp_style_read_icolor(SPIPaint *paint, gchar const *str, SPStyle *style, Document *document) +sp_style_read_icolor(SPIPaint *paint, gchar const *str, SPStyle *style, SPDocument *document) { (void)style; // TODO (void)document; // TODO @@ -3114,7 +3114,7 @@ sp_style_read_icolor(SPIPaint *paint, gchar const *str, SPStyle *style, Document * \pre paint == \&style.fill || paint == \&style.stroke. */ static void -sp_style_read_ipaint(SPIPaint *paint, gchar const *str, SPStyle *style, Document *document) +sp_style_read_ipaint(SPIPaint *paint, gchar const *str, SPStyle *style, SPDocument *document) { while (g_ascii_isspace(*str)) { ++str; @@ -3248,7 +3248,7 @@ sp_style_read_ifontsize(SPIFontSize *val, gchar const *str) * Set SPIFilter object from string. */ static void -sp_style_read_ifilter(gchar const *str, SPStyle * style, Document *document) +sp_style_read_ifilter(gchar const *str, SPStyle * style, SPDocument *document) { SPIFilter *f = &(style->filter); /* Try all possible values: inherit, none, uri */ diff --git a/src/style.h b/src/style.h index 87d427547..d5ccc4901 100644 --- a/src/style.h +++ b/src/style.h @@ -243,7 +243,7 @@ struct SPStyle { /** Object we are attached to */ SPObject *object; /** Document we are associated with */ - Document *document; + SPDocument *document; /** Our text style component */ SPTextStyle *text; @@ -372,7 +372,7 @@ struct SPStyle { const gchar *getStrokeURI() {if (stroke.value.href) return stroke.value.href->getURI()->toString(); else return NULL;} }; -SPStyle *sp_style_new(Document *document); +SPStyle *sp_style_new(SPDocument *document); SPStyle *sp_style_new_from_object(SPObject *object); diff --git a/src/svg-view-widget.cpp b/src/svg-view-widget.cpp index 5c33075c9..10d997656 100644 --- a/src/svg-view-widget.cpp +++ b/src/svg-view-widget.cpp @@ -205,7 +205,7 @@ sp_svg_view_widget_view_resized (SPViewWidget *vw, Inkscape::UI::View::View */*v * Constructs new SPSVGSPViewWidget object and returns pointer to it. */ GtkWidget * -sp_svg_view_widget_new (Document *doc) +sp_svg_view_widget_new (SPDocument *doc) { GtkWidget *widget; diff --git a/src/svg-view-widget.h b/src/svg-view-widget.h index 9f6410f67..cd609b07a 100644 --- a/src/svg-view-widget.h +++ b/src/svg-view-widget.h @@ -16,7 +16,7 @@ #include "display/display-forward.h" #include "ui/view/view-widget.h" -class Document; +class SPDocument; class SPSVGSPViewWidget; class SPSVGSPViewWidgetClass; @@ -28,7 +28,7 @@ class SPSVGSPViewWidgetClass; GtkType sp_svg_view_widget_get_type (void); -GtkWidget *sp_svg_view_widget_new (Document *doc); +GtkWidget *sp_svg_view_widget_new (SPDocument *doc); void sp_svg_view_widget_set_resize (SPSVGSPViewWidget *vw, bool resize, gdouble width, gdouble height); diff --git a/src/svg-view.cpp b/src/svg-view.cpp index 35a51cfcd..bd46dd17a 100644 --- a/src/svg-view.cpp +++ b/src/svg-view.cpp @@ -188,7 +188,7 @@ arena_handler (SPCanvasArena */*arena*/, NRArenaItem *ai, GdkEvent *event, SPSVG * Callback connected with set_document signal. */ void -SPSVGView::setDocument (Document *document) +SPSVGView::setDocument (SPDocument *document) { if (doc()) { sp_item_invoke_hide (SP_ITEM (sp_document_root (doc())), _dkey); diff --git a/src/svg-view.h b/src/svg-view.h index ab59ca417..838a95b03 100644 --- a/src/svg-view.h +++ b/src/svg-view.h @@ -47,7 +47,7 @@ public: void doRescale (bool event); - virtual void setDocument (Document*); + virtual void setDocument (SPDocument*); virtual void mouseover(); virtual void mouseout(); virtual bool shutdown() { return true; } diff --git a/src/test-helpers.h b/src/test-helpers.h index 3eacb7d13..8dba0c942 100644 --- a/src/test-helpers.h +++ b/src/test-helpers.h @@ -32,7 +32,7 @@ T* createSuiteAndDocument( void (*fun)(T*&) ) static_cast(g_object_new(inkscape_get_type(), NULL)); } - Document* tmp = sp_document_new( NULL, TRUE, true ); + SPDocument* tmp = sp_document_new( NULL, TRUE, true ); if ( tmp ) { fun( suite ); if ( suite ) diff --git a/src/text-chemistry.cpp b/src/text-chemistry.cpp index 61960086a..f574b69fb 100644 --- a/src/text-chemistry.cpp +++ b/src/text-chemistry.cpp @@ -301,7 +301,7 @@ text_flow_into_shape() if (!desktop) return; - Document *doc = sp_desktop_document (desktop); + SPDocument *doc = sp_desktop_document (desktop); Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc); Inkscape::Selection *selection = sp_desktop_selection(desktop); @@ -393,7 +393,7 @@ text_unflow () if (!desktop) return; - Document *doc = sp_desktop_document (desktop); + SPDocument *doc = sp_desktop_document (desktop); Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc); Inkscape::Selection *selection = sp_desktop_selection(desktop); diff --git a/src/trace/trace.cpp b/src/trace/trace.cpp index 9afadbeaf..e2bd0e9f5 100644 --- a/src/trace/trace.cpp +++ b/src/trace/trace.cpp @@ -442,7 +442,7 @@ void Tracer::traceThread() engine = NULL; return; } - Document *doc = SP_ACTIVE_DOCUMENT; + SPDocument *doc = SP_ACTIVE_DOCUMENT; sp_document_ensure_up_to_date(doc); diff --git a/src/tweak-context.cpp b/src/tweak-context.cpp index 692e22112..3f55d040b 100644 --- a/src/tweak-context.cpp +++ b/src/tweak-context.cpp @@ -415,7 +415,7 @@ sp_tweak_dilate_recursive (Inkscape::Selection *selection, SPItem *item, Geom::P GSList *items = g_slist_prepend (NULL, item); GSList *selected = NULL; GSList *to_select = NULL; - Document *doc = SP_OBJECT_DOCUMENT(item); + SPDocument *doc = SP_OBJECT_DOCUMENT(item); sp_item_list_to_curves (items, &selected, &to_select); g_slist_free (items); SPObject* newObj = doc->getObjectByRepr((Inkscape::XML::Node *) to_select->data); @@ -524,7 +524,7 @@ sp_tweak_dilate_recursive (Inkscape::Selection *selection, SPItem *item, Geom::P SP_OBJECT(item)->deleteObject(true, true); sp_object_unref(SP_OBJECT(item), NULL); } else { // duplicate - Document *doc = SP_OBJECT_DOCUMENT(item); + SPDocument *doc = SP_OBJECT_DOCUMENT(item); Inkscape::XML::Document* xml_doc = sp_document_repr_doc(doc); Inkscape::XML::Node *old_repr = SP_OBJECT_REPR(item); SPObject *old_obj = doc->getObjectByRepr(old_repr); diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index e7e8a29dc..7e41006be 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -126,13 +126,13 @@ private: void _copyTextPath(SPTextPath *); Inkscape::XML::Node *_copyNode(Inkscape::XML::Node *, Inkscape::XML::Document *, Inkscape::XML::Node *); - void _pasteDocument(Document *, bool in_place); - void _pasteDefs(Document *); + void _pasteDocument(SPDocument *, bool in_place); + void _pasteDefs(SPDocument *); bool _pasteImage(); bool _pasteText(); SPCSSAttr *_parseColor(const Glib::ustring &); void _applyPathEffect(SPItem *, gchar const *); - Document *_retrieveClipboard(Glib::ustring = ""); + SPDocument *_retrieveClipboard(Glib::ustring = ""); // clipboard callbacks void _onGet(Gtk::SelectionData &, guint); @@ -149,7 +149,7 @@ private: void _userWarn(SPDesktop *, char const *); // private properites - Document *_clipboardSPDoc; ///< Document that stores the clipboard until someone requests it + SPDocument *_clipboardSPDoc; ///< Document that stores the clipboard until someone requests it Inkscape::XML::Node *_defs; ///< Reference to the clipboard document's defs node Inkscape::XML::Node *_root; ///< Reference to the clipboard's root node Inkscape::XML::Node *_clipnode; ///< The node that holds extra information @@ -311,7 +311,7 @@ bool ClipboardManagerImpl::paste(bool in_place) if ( target == CLIPBOARD_TEXT_TARGET ) return _pasteText(); // otherwise, use the import extensions - Document *tempdoc = _retrieveClipboard(target); + SPDocument *tempdoc = _retrieveClipboard(target); if ( tempdoc == NULL ) { _userWarn(desktop, _("Nothing on the clipboard.")); return false; @@ -328,7 +328,7 @@ bool ClipboardManagerImpl::paste(bool in_place) */ const gchar *ClipboardManagerImpl::getFirstObjectID() { - Document *tempdoc = _retrieveClipboard("image/x-inkscape-svg"); + SPDocument *tempdoc = _retrieveClipboard("image/x-inkscape-svg"); if ( tempdoc == NULL ) { return NULL; } @@ -373,7 +373,7 @@ bool ClipboardManagerImpl::pasteStyle() return false; } - Document *tempdoc = _retrieveClipboard("image/x-inkscape-svg"); + SPDocument *tempdoc = _retrieveClipboard("image/x-inkscape-svg"); if ( tempdoc == NULL ) { // no document, but we can try _text_style if (_text_style) { @@ -425,7 +425,7 @@ bool ClipboardManagerImpl::pasteSize(bool separately, bool apply_x, bool apply_y } // FIXME: actually, this should accept arbitrary documents - Document *tempdoc = _retrieveClipboard("image/x-inkscape-svg"); + SPDocument *tempdoc = _retrieveClipboard("image/x-inkscape-svg"); if ( tempdoc == NULL ) { _userWarn(desktop, _("No size on the clipboard.")); return false; @@ -482,7 +482,7 @@ bool ClipboardManagerImpl::pastePathEffect() return false; } - Document *tempdoc = _retrieveClipboard("image/x-inkscape-svg"); + SPDocument *tempdoc = _retrieveClipboard("image/x-inkscape-svg"); if ( tempdoc ) { Inkscape::XML::Node *root = sp_document_repr_root(tempdoc); Inkscape::XML::Node *clipnode = sp_repr_lookup_name(root, "inkscape:clipboard", 1); @@ -513,7 +513,7 @@ bool ClipboardManagerImpl::pastePathEffect() */ Glib::ustring ClipboardManagerImpl::getPathParameter() { - Document *tempdoc = _retrieveClipboard(); // any target will do here + SPDocument *tempdoc = _retrieveClipboard(); // any target will do here if ( tempdoc == NULL ) { _userWarn(SP_ACTIVE_DESKTOP, _("Nothing on the clipboard.")); return ""; @@ -537,7 +537,7 @@ Glib::ustring ClipboardManagerImpl::getPathParameter() */ Glib::ustring ClipboardManagerImpl::getShapeOrTextObjectId() { - Document *tempdoc = _retrieveClipboard(); // any target will do here + SPDocument *tempdoc = _retrieveClipboard(); // any target will do here if ( tempdoc == NULL ) { _userWarn(SP_ACTIVE_DESKTOP, _("Nothing on the clipboard.")); return ""; @@ -769,10 +769,10 @@ Inkscape::XML::Node *ClipboardManagerImpl::_copyNode(Inkscape::XML::Node *node, * @param in_place Whether to paste the selection where it was when copied * @pre @c clipdoc is not empty and items can be added to the current layer */ -void ClipboardManagerImpl::_pasteDocument(Document *clipdoc, bool in_place) +void ClipboardManagerImpl::_pasteDocument(SPDocument *clipdoc, bool in_place) { SPDesktop *desktop = SP_ACTIVE_DESKTOP; - Document *target_document = sp_desktop_document(desktop); + SPDocument *target_document = sp_desktop_document(desktop); Inkscape::XML::Node *root = sp_document_repr_root(clipdoc), *target_parent = SP_OBJECT_REPR(desktop->currentLayer()); @@ -839,11 +839,11 @@ void ClipboardManagerImpl::_pasteDocument(Document *clipdoc, bool in_place) * @param clipdoc The document to paste * @pre @c clipdoc != NULL and pasting into the active document is possible */ -void ClipboardManagerImpl::_pasteDefs(Document *clipdoc) +void ClipboardManagerImpl::_pasteDefs(SPDocument *clipdoc) { // boilerplate vars copied from _pasteDocument SPDesktop *desktop = SP_ACTIVE_DESKTOP; - Document *target_document = sp_desktop_document(desktop); + SPDocument *target_document = sp_desktop_document(desktop); Inkscape::XML::Node *root = sp_document_repr_root(clipdoc), *defs = sp_repr_lookup_name(root, "svg:defs", 1), @@ -863,7 +863,7 @@ void ClipboardManagerImpl::_pasteDefs(Document *clipdoc) */ bool ClipboardManagerImpl::_pasteImage() { - Document *doc = SP_ACTIVE_DOCUMENT; + SPDocument *doc = SP_ACTIVE_DOCUMENT; if ( doc == NULL ) return false; // retrieve image data @@ -993,9 +993,9 @@ void ClipboardManagerImpl::_applyPathEffect(SPItem *item, gchar const *effect) /** * @brief Retrieve the clipboard contents as a document - * @return Clipboard contents converted to Document, or NULL if no suitable content was present + * @return Clipboard contents converted to SPDocument, or NULL if no suitable content was present */ -Document *ClipboardManagerImpl::_retrieveClipboard(Glib::ustring required_target) +SPDocument *ClipboardManagerImpl::_retrieveClipboard(Glib::ustring required_target) { Glib::ustring best_target; if ( required_target == "" ) @@ -1061,7 +1061,7 @@ Document *ClipboardManagerImpl::_retrieveClipboard(Glib::ustring required_target if ( in == inlist.end() ) return NULL; // this shouldn't happen unless _getBestTarget returns something bogus - Document *tempdoc = NULL; + SPDocument *tempdoc = NULL; try { tempdoc = (*in)->open(filename); } catch (...) { diff --git a/src/ui/clipboard.h b/src/ui/clipboard.h index 467888ed7..54c05ac0d 100644 --- a/src/ui/clipboard.h +++ b/src/ui/clipboard.h @@ -31,7 +31,7 @@ namespace UI { * @brief System-wide clipboard manager * * ClipboardManager takes care of manipulating the system clipboard in response - * to user actions. It holds a complete Document as the contents. This document + * to user actions. It holds a complete SPDocument as the contents. This document * is exported using output extensions when other applications request data. * Copying to another instance of Inkscape is special-cased, because of the extra * data required (i.e. style, size, Live Path Effects parameters, etc.) diff --git a/src/ui/dialog/aboutbox.cpp b/src/ui/dialog/aboutbox.cpp index af6a0c516..025bec37a 100644 --- a/src/ui/dialog/aboutbox.cpp +++ b/src/ui/dialog/aboutbox.cpp @@ -147,7 +147,7 @@ Gtk::Widget *build_splash_widget() { // should be in UTF-*8.. char *about=g_build_filename(INKSCAPE_SCREENSDIR, _("about.svg"), NULL); - Document *doc=sp_document_new (about, TRUE); + SPDocument *doc=sp_document_new (about, TRUE); g_free(about); g_return_val_if_fail(doc != NULL, NULL); diff --git a/src/ui/dialog/document-metadata.cpp b/src/ui/dialog/document-metadata.cpp index f69d80fe5..96cad1fbe 100644 --- a/src/ui/dialog/document-metadata.cpp +++ b/src/ui/dialog/document-metadata.cpp @@ -207,7 +207,7 @@ DocumentMetadata::update() } void -DocumentMetadata::_handleDocumentReplaced(SPDesktop* desktop, Document *) +DocumentMetadata::_handleDocumentReplaced(SPDesktop* desktop, SPDocument *) { Inkscape::XML::Node *repr = SP_OBJECT_REPR(sp_desktop_namedview(desktop)); repr->addListener (&_repr_events, this); diff --git a/src/ui/dialog/document-metadata.h b/src/ui/dialog/document-metadata.h index 2bc94836b..7f718e9f7 100644 --- a/src/ui/dialog/document-metadata.h +++ b/src/ui/dialog/document-metadata.h @@ -49,7 +49,7 @@ protected: void build_metadata(); void init(); - void _handleDocumentReplaced(SPDesktop* desktop, Document *document); + void _handleDocumentReplaced(SPDesktop* desktop, SPDocument *document); void _handleActivateDesktop(Inkscape::Application *application, SPDesktop *desktop); void _handleDeactivateDesktop(Inkscape::Application *application, SPDesktop *desktop); diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 0e928a9eb..423778276 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -851,7 +851,7 @@ DocumentProperties::on_response (int id) } void -DocumentProperties::_handleDocumentReplaced(SPDesktop* desktop, Document *document) +DocumentProperties::_handleDocumentReplaced(SPDesktop* desktop, SPDocument *document) { Inkscape::XML::Node *repr = SP_OBJECT_REPR(sp_desktop_namedview(desktop)); repr->addListener(&_repr_events, this); @@ -915,7 +915,7 @@ DocumentProperties::onNewGrid() { SPDesktop *dt = getDesktop(); Inkscape::XML::Node *repr = SP_OBJECT_REPR(sp_desktop_namedview(dt)); - Document *doc = sp_desktop_document(dt); + SPDocument *doc = sp_desktop_document(dt); Glib::ustring typestring = _grids_combo_gridtype.get_active_text(); CanvasGrid::writeNewGridToRepr(repr, doc, CanvasGrid::getGridTypeFromName(typestring.c_str())); diff --git a/src/ui/dialog/document-properties.h b/src/ui/dialog/document-properties.h index 5aa8d446d..136ae2c89 100644 --- a/src/ui/dialog/document-properties.h +++ b/src/ui/dialog/document-properties.h @@ -70,7 +70,7 @@ protected: void removeExternalScript(); void scripting_create_popup_menu(Gtk::Widget& parent, sigc::slot rem); - void _handleDocumentReplaced(SPDesktop* desktop, Document *document); + void _handleDocumentReplaced(SPDesktop* desktop, SPDocument *document); void _handleActivateDesktop(Inkscape::Application *application, SPDesktop *desktop); void _handleDeactivateDesktop(Inkscape::Application *application, SPDesktop *desktop); diff --git a/src/ui/dialog/filedialogimpl-gtkmm.cpp b/src/ui/dialog/filedialogimpl-gtkmm.cpp index 30a7e7c2a..70f2f2ae5 100644 --- a/src/ui/dialog/filedialogimpl-gtkmm.cpp +++ b/src/ui/dialog/filedialogimpl-gtkmm.cpp @@ -120,7 +120,7 @@ findExpanderWidgets(Gtk::Container *parent, ### SVG Preview Widget #########################################################################*/ -bool SVGPreview::setDocument(Document *doc) +bool SVGPreview::setDocument(SPDocument *doc) { if (document) sp_document_unref(document); @@ -151,7 +151,7 @@ bool SVGPreview::setFileName(Glib::ustring &theFileName) * I don't know why passing false to keepalive is bad. But it * prevents the display of an svg with a non-ascii filename */ - Document *doc = sp_document_new (fileName.c_str(), true); + SPDocument *doc = sp_document_new (fileName.c_str(), true); if (!doc) { g_warning("SVGView: error loading document '%s'\n", fileName.c_str()); return false; @@ -172,7 +172,7 @@ bool SVGPreview::setFromMem(char const *xmlBuffer) return false; gint len = (gint)strlen(xmlBuffer); - Document *doc = sp_document_new_from_mem(xmlBuffer, len, 0); + SPDocument *doc = sp_document_new_from_mem(xmlBuffer, len, 0); if (!doc) { g_warning("SVGView: error loading buffer '%s'\n",xmlBuffer); return false; diff --git a/src/ui/dialog/filedialogimpl-gtkmm.h b/src/ui/dialog/filedialogimpl-gtkmm.h index bd0477b30..90dddce59 100644 --- a/src/ui/dialog/filedialogimpl-gtkmm.h +++ b/src/ui/dialog/filedialogimpl-gtkmm.h @@ -99,7 +99,7 @@ public: ~SVGPreview(); - bool setDocument(Document *doc); + bool setDocument(SPDocument *doc); bool setFileName(Glib::ustring &fileName); @@ -128,7 +128,7 @@ private: /** * The svg document we are currently showing */ - Document *document; + SPDocument *document; /** * The sp_svg_view widget diff --git a/src/ui/dialog/filedialogimpl-win32.cpp b/src/ui/dialog/filedialogimpl-win32.cpp index 4a2cc879d..0d8f0de5f 100644 --- a/src/ui/dialog/filedialogimpl-win32.cpp +++ b/src/ui/dialog/filedialogimpl-win32.cpp @@ -887,7 +887,7 @@ bool FileOpenDialogImplWin32::set_svg_preview() gchar *utf8string = g_utf16_to_utf8((const gunichar2*)_path_string, _MAX_PATH, NULL, NULL, NULL); - Document *svgDoc = sp_document_new (utf8string, true); + SPDocument *svgDoc = sp_document_new (utf8string, true); g_free(utf8string); // Check the document loaded properly diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp index 026af2c9f..baf46970a 100644 --- a/src/ui/dialog/filter-effects-dialog.cpp +++ b/src/ui/dialog/filter-effects-dialog.cpp @@ -1222,7 +1222,7 @@ void FilterEffectsDialog::FilterModifier::on_selection_toggled(const Glib::ustri if(iter) { SPDesktop *desktop = _dialog.getDesktop(); - Document *doc = sp_desktop_document(desktop); + SPDocument *doc = sp_desktop_document(desktop); SPFilter* filter = (*iter)[_columns.filter]; Inkscape::Selection *sel = sp_desktop_selection(desktop); @@ -1255,7 +1255,7 @@ void FilterEffectsDialog::FilterModifier::on_selection_toggled(const Glib::ustri void FilterEffectsDialog::FilterModifier::update_filters() { SPDesktop* desktop = _dialog.getDesktop(); - Document* document = sp_desktop_document(desktop); + SPDocument* document = sp_desktop_document(desktop); const GSList* filters = sp_document_get_resource_list(document, "filter"); _model->clear(); @@ -1310,7 +1310,7 @@ void FilterEffectsDialog::FilterModifier::filter_list_button_release(GdkEventBut void FilterEffectsDialog::FilterModifier::add_filter() { - Document* doc = sp_desktop_document(_dialog.getDesktop()); + SPDocument* doc = sp_desktop_document(_dialog.getDesktop()); SPFilter* filter = new_filter(doc); const int count = _model->children().size(); @@ -1330,7 +1330,7 @@ void FilterEffectsDialog::FilterModifier::remove_filter() SPFilter *filter = get_selected_filter(); if(filter) { - Document* doc = filter->document; + SPDocument* doc = filter->document; sp_repr_unparent(filter->repr); sp_document_done(doc, SP_VERB_DIALOG_FILTER_EFFECTS, _("Remove filter")); diff --git a/src/ui/dialog/filter-effects-dialog.h b/src/ui/dialog/filter-effects-dialog.h index 28c714905..3fb9a46fb 100644 --- a/src/ui/dialog/filter-effects-dialog.h +++ b/src/ui/dialog/filter-effects-dialog.h @@ -88,7 +88,7 @@ private: static void on_activate_desktop(Application*, SPDesktop*, FilterModifier*); static void on_deactivate_desktop(Application*, SPDesktop*, FilterModifier*); - void on_document_replaced(SPDesktop*, Document*) + void on_document_replaced(SPDesktop*, SPDocument*) { update_filters(); } diff --git a/src/ui/dialog/guides.cpp b/src/ui/dialog/guides.cpp index 2d7f7cb5b..3a7964ba2 100644 --- a/src/ui/dialog/guides.cpp +++ b/src/ui/dialog/guides.cpp @@ -119,7 +119,7 @@ void GuidelinePropertiesDialog::_onOK() void GuidelinePropertiesDialog::_onDelete() { - Document *doc = SP_OBJECT_DOCUMENT(_guide); + SPDocument *doc = SP_OBJECT_DOCUMENT(_guide); sp_guide_remove(_guide); sp_document_done(doc, SP_VERB_NONE, _("Delete guide")); diff --git a/src/ui/dialog/icon-preview.cpp b/src/ui/dialog/icon-preview.cpp index 1490e5b73..336afc3c5 100644 --- a/src/ui/dialog/icon-preview.cpp +++ b/src/ui/dialog/icon-preview.cpp @@ -36,7 +36,7 @@ extern "C" { // takes doc, root, icon, and icon name to produce pixels guchar * -sp_icon_doc_icon( Document *doc, NRArenaItem *root, +sp_icon_doc_icon( SPDocument *doc, NRArenaItem *root, const gchar *name, unsigned int psize ); } @@ -247,7 +247,7 @@ void IconPreviewPanel::modeToggled() void IconPreviewPanel::renderPreview( SPObject* obj ) { - Document * doc = SP_OBJECT_DOCUMENT(obj); + SPDocument * doc = SP_OBJECT_DOCUMENT(obj); gchar * id = SP_OBJECT_ID(obj); // g_message(" setting up to render '%s' as the icon", id ); diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp index 0298042ef..fa47ad88d 100644 --- a/src/ui/dialog/layers.cpp +++ b/src/ui/dialog/layers.cpp @@ -349,7 +349,7 @@ bool LayersPanel::_checkForSelected(const Gtk::TreePath &path, const Gtk::TreeIt void LayersPanel::_layersChanged() { // g_message("_layersChanged()"); - Document* document = _desktop->doc(); + SPDocument* document = _desktop->doc(); SPObject* root = document->root; if ( root ) { _selectedConnection.block(); @@ -366,7 +366,7 @@ void LayersPanel::_layersChanged() } } -void LayersPanel::_addLayer( Document* doc, SPObject* layer, Gtk::TreeModel::Row* parentRow, SPObject* target, int level ) +void LayersPanel::_addLayer( SPDocument* doc, SPObject* layer, Gtk::TreeModel::Row* parentRow, SPObject* target, int level ) { if ( layer && (level < _maxNestDepth) ) { unsigned int counter = _mgr->childCount(layer); diff --git a/src/ui/dialog/layers.h b/src/ui/dialog/layers.h index c5f945437..16b3be350 100644 --- a/src/ui/dialog/layers.h +++ b/src/ui/dialog/layers.h @@ -86,7 +86,7 @@ private: bool _checkForSelected(const Gtk::TreePath& path, const Gtk::TreeIter& iter, SPObject* layer); void _layersChanged(); - void _addLayer( Document* doc, SPObject* layer, Gtk::TreeModel::Row* parentRow, SPObject* target, int level ); + void _addLayer( SPDocument* doc, SPObject* layer, Gtk::TreeModel::Row* parentRow, SPObject* target, int level ); SPObject* _selectedLayer(); diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp index bea8a096e..dd2dc8250 100644 --- a/src/ui/dialog/livepatheffect-editor.cpp +++ b/src/ui/dialog/livepatheffect-editor.cpp @@ -357,7 +357,7 @@ LivePathEffectEditor::onApply() if ( sel && !sel->isEmpty() ) { SPItem *item = sel->singleItem(); if ( item && SP_IS_LPE_ITEM(item) ) { - Document *doc = current_desktop->doc(); + SPDocument *doc = current_desktop->doc(); const Util::EnumData* data = combo_effecttype.get_active_data(); if (!data) return; diff --git a/src/ui/dialog/panel-dialog.h b/src/ui/dialog/panel-dialog.h index 5fc4a9134..7dbb6dd4a 100644 --- a/src/ui/dialog/panel-dialog.h +++ b/src/ui/dialog/panel-dialog.h @@ -50,7 +50,7 @@ protected: static_cast(data)->_propagateDesktopActivated(application, desktop); } - inline virtual void _propagateDocumentReplaced(SPDesktop* desktop, Document *document); + inline virtual void _propagateDocumentReplaced(SPDesktop* desktop, SPDocument *document); inline virtual void _propagateDesktopActivated(Inkscape::Application *, SPDesktop *); inline virtual void _propagateDesktopDeactivated(Inkscape::Application *, SPDesktop *); @@ -106,7 +106,7 @@ private: void -PanelDialogBase::_propagateDocumentReplaced(SPDesktop *desktop, Document *document) +PanelDialogBase::_propagateDocumentReplaced(SPDesktop *desktop, SPDocument *document) { _panel.signalDocumentReplaced().emit(desktop, document); } diff --git a/src/ui/dialog/print.cpp b/src/ui/dialog/print.cpp index 198495f74..d15773ecb 100644 --- a/src/ui/dialog/print.cpp +++ b/src/ui/dialog/print.cpp @@ -148,7 +148,7 @@ namespace Inkscape { namespace UI { namespace Dialog { -Print::Print(Document *doc, SPItem *base) : +Print::Print(SPDocument *doc, SPItem *base) : _doc (doc), _base (base) { diff --git a/src/ui/dialog/print.h b/src/ui/dialog/print.h index e8904d744..ea89ebdf2 100644 --- a/src/ui/dialog/print.h +++ b/src/ui/dialog/print.h @@ -30,7 +30,7 @@ */ struct workaround_gtkmm { - Document *_doc; + SPDocument *_doc; SPItem *_base; Inkscape::UI::Widget::RenderingOptions *_tab; }; @@ -41,14 +41,14 @@ namespace Dialog { class Print { public: - Print(Document *doc, SPItem *base); + Print(SPDocument *doc, SPItem *base); Gtk::PrintOperationResult run(Gtk::PrintOperationAction, Gtk::Window &parent_window); protected: private: GtkPrintOperation *_printop; - Document *_doc; + SPDocument *_doc; SPItem *_base; Inkscape::UI::Widget::RenderingOptions _tab; diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp index 64ea07877..5f86196b1 100644 --- a/src/ui/dialog/svg-fonts-dialog.cpp +++ b/src/ui/dialog/svg-fonts-dialog.cpp @@ -161,7 +161,7 @@ void GlyphComboBox::update(SPFont* spfont){ void SvgFontsDialog::on_kerning_value_changed(){ if (!this->kerning_pair) return; - Document* document = sp_desktop_document(this->getDesktop()); + SPDocument* document = sp_desktop_document(this->getDesktop()); //TODO: I am unsure whether this is the correct way of calling sp_document_maybe_done Glib::ustring undokey = "svgfonts:hkern:k:"; @@ -242,7 +242,7 @@ void SvgFontsDialog::update_sensitiveness(){ void SvgFontsDialog::update_fonts() { SPDesktop* desktop = this->getDesktop(); - Document* document = sp_desktop_document(desktop); + SPDocument* document = sp_desktop_document(desktop); const GSList* fonts = sp_document_get_resource_list(document, "font"); _model->clear(); @@ -420,7 +420,7 @@ SvgFontsDialog::populate_kerning_pairs_box() } } -SPGlyph *new_glyph(Document* document, SPFont *font, const int count) +SPGlyph *new_glyph(SPDocument* document, SPFont *font, const int count) { g_return_val_if_fail(font != NULL, NULL); Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document); @@ -459,7 +459,7 @@ void SvgFontsDialog::update_glyphs(){ void SvgFontsDialog::add_glyph(){ const int count = _GlyphsListStore->children().size(); - Document* doc = sp_desktop_document(this->getDesktop()); + SPDocument* doc = sp_desktop_document(this->getDesktop()); /* SPGlyph* glyph =*/ new_glyph(doc, get_selected_spfont(), count+1); sp_document_done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Add glyph")); @@ -475,7 +475,7 @@ void SvgFontsDialog::set_glyph_description_from_selected_path(){ } Inkscape::MessageStack *msgStack = sp_desktop_message_stack(desktop); - Document* doc = sp_desktop_document(desktop); + SPDocument* doc = sp_desktop_document(desktop); Inkscape::Selection* sel = sp_desktop_selection(desktop); if (sel->isEmpty()){ char *msg = _("Select a path to define the curves of a glyph"); @@ -519,7 +519,7 @@ void SvgFontsDialog::missing_glyph_description_from_selected_path(){ } Inkscape::MessageStack *msgStack = sp_desktop_message_stack(desktop); - Document* doc = sp_desktop_document(desktop); + SPDocument* doc = sp_desktop_document(desktop); Inkscape::Selection* sel = sp_desktop_selection(desktop); if (sel->isEmpty()){ char *msg = _("Select a path to define the curves of a glyph"); @@ -562,7 +562,7 @@ void SvgFontsDialog::reset_missing_glyph_description(){ return; } - Document* doc = sp_desktop_document(desktop); + SPDocument* doc = sp_desktop_document(desktop); SPObject* obj; for (obj = get_selected_spfont()->children; obj; obj=obj->next){ if (SP_IS_MISSING_GLYPH(obj)){ @@ -581,7 +581,7 @@ void SvgFontsDialog::glyph_name_edit(const Glib::ustring&, const Glib::ustring& SPGlyph* glyph = (*i)[_GlyphsListColumns.glyph_node]; glyph->repr->setAttribute("glyph-name", str.c_str()); - Document* doc = sp_desktop_document(this->getDesktop()); + SPDocument* doc = sp_desktop_document(this->getDesktop()); sp_document_done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Edit glyph name")); update_glyphs(); @@ -594,7 +594,7 @@ void SvgFontsDialog::glyph_unicode_edit(const Glib::ustring&, const Glib::ustrin SPGlyph* glyph = (*i)[_GlyphsListColumns.glyph_node]; glyph->repr->setAttribute("unicode", str.c_str()); - Document* doc = sp_desktop_document(this->getDesktop()); + SPDocument* doc = sp_desktop_document(this->getDesktop()); sp_document_done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Set glyph unicode")); update_glyphs(); @@ -604,7 +604,7 @@ void SvgFontsDialog::remove_selected_font(){ SPFont* font = get_selected_spfont(); sp_repr_unparent(font->repr); - Document* doc = sp_desktop_document(this->getDesktop()); + SPDocument* doc = sp_desktop_document(this->getDesktop()); sp_document_done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Remove font")); update_fonts(); @@ -619,7 +619,7 @@ void SvgFontsDialog::remove_selected_glyph(){ SPGlyph* glyph = (*i)[_GlyphsListColumns.glyph_node]; sp_repr_unparent(glyph->repr); - Document* doc = sp_desktop_document(this->getDesktop()); + SPDocument* doc = sp_desktop_document(this->getDesktop()); sp_document_done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Remove glyph")); update_glyphs(); @@ -634,7 +634,7 @@ void SvgFontsDialog::remove_selected_kerning_pair(){ SPGlyphKerning* pair = (*i)[_KerningPairsListColumns.spnode]; sp_repr_unparent(pair->repr); - Document* doc = sp_desktop_document(this->getDesktop()); + SPDocument* doc = sp_desktop_document(this->getDesktop()); sp_document_done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Remove kerning pair")); update_glyphs(); @@ -705,7 +705,7 @@ void SvgFontsDialog::add_kerning_pair(){ if (this->kerning_pair) return; //We already have this kerning pair - Document* document = sp_desktop_document(this->getDesktop()); + SPDocument* document = sp_desktop_document(this->getDesktop()); Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document); // create a new hkern node @@ -767,7 +767,7 @@ Gtk::VBox* SvgFontsDialog::kerning_tab(){ return &kerning_vbox; } -SPFont *new_font(Document *document) +SPFont *new_font(SPDocument *document) { g_return_val_if_fail(document != NULL, NULL); @@ -820,7 +820,7 @@ void set_font_family(SPFont* font, char* str){ } void SvgFontsDialog::add_font(){ - Document* doc = sp_desktop_document(this->getDesktop()); + SPDocument* doc = sp_desktop_document(this->getDesktop()); SPFont* font = new_font(doc); const int count = _model->children().size(); diff --git a/src/ui/dialog/swatches.cpp b/src/ui/dialog/swatches.cpp index cdd479e9d..e273a827c 100644 --- a/src/ui/dialog/swatches.cpp +++ b/src/ui/dialog/swatches.cpp @@ -377,7 +377,7 @@ static void editGradient( GtkMenuItem */*menuitem*/, gpointer /*user_data*/ ) if ( bounceTarget ) { SwatchesPanel* swp = bounceTarget->ptr ? reinterpret_cast(bounceTarget->ptr) : 0; SPDesktop* desktop = swp ? swp->getDesktop() : 0; - Document *doc = desktop ? desktop->doc() : 0; + SPDocument *doc = desktop ? desktop->doc() : 0; if (doc) { std::string targetName(bounceTarget->def.descr); const GSList *gradients = sp_document_get_resource_list(doc, "gradient"); @@ -397,7 +397,7 @@ static void addNewGradient( GtkMenuItem */*menuitem*/, gpointer /*user_data*/ ) if ( bounceTarget ) { SwatchesPanel* swp = bounceTarget->ptr ? reinterpret_cast(bounceTarget->ptr) : 0; SPDesktop* desktop = swp ? swp->getDesktop() : 0; - Document *doc = desktop ? desktop->doc() : 0; + SPDocument *doc = desktop ? desktop->doc() : 0; if (doc) { Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc); @@ -524,7 +524,7 @@ void ColorItem::_dropDataIn( GtkWidget */*widget*/, { } -static bool bruteForce( Document* document, Inkscape::XML::Node* node, Glib::ustring const& match, int r, int g, int b ) +static bool bruteForce( SPDocument* document, Inkscape::XML::Node* node, Glib::ustring const& match, int r, int g, int b ) { bool changed = false; @@ -612,7 +612,7 @@ void ColorItem::_colorDefChanged(void* data) { SPDesktop *desktop = SP_ACTIVE_DESKTOP; if ( desktop ) { - Document* document = sp_desktop_document( desktop ); + SPDocument* document = sp_desktop_document( desktop ); Inkscape::XML::Node *rroot = sp_document_repr_root( document ); if ( rroot ) { @@ -1362,9 +1362,9 @@ void SwatchesPanel::setDesktop( SPDesktop* desktop ) _currentDesktop->connectToolSubselectionChanged( sigc::hide(sigc::mem_fun(*this, &SwatchesPanel::_updateFromSelection))); - sigc::bound_mem_functor1 first = sigc::mem_fun(*this, &SwatchesPanel::_setDocument); - sigc::slot base2 = first; - sigc::slot slot2 = sigc::hide<0>( base2 ); + sigc::bound_mem_functor1 first = sigc::mem_fun(*this, &SwatchesPanel::_setDocument); + sigc::slot base2 = first; + sigc::slot slot2 = sigc::hide<0>( base2 ); _documentConnection = desktop->connectDocumentReplaced( slot2 ); _setDocument( desktop->doc() ); @@ -1374,7 +1374,7 @@ void SwatchesPanel::setDesktop( SPDesktop* desktop ) } } -void SwatchesPanel::_setDocument( Document *document ) +void SwatchesPanel::_setDocument( SPDocument *document ) { if ( document != _currentDocument ) { if ( _currentDocument ) { diff --git a/src/ui/dialog/swatches.h b/src/ui/dialog/swatches.h index 3ad5a38c1..35bcd8c78 100644 --- a/src/ui/dialog/swatches.h +++ b/src/ui/dialog/swatches.h @@ -45,7 +45,7 @@ public: protected: virtual void _updateFromSelection(); virtual void _handleAction( int setId, int itemId ); - virtual void _setDocument( Document *document ); + virtual void _setDocument( SPDocument *document ); virtual void _rebuild(); private: @@ -57,7 +57,7 @@ private: ColorItem* _remove; int _currentIndex; SPDesktop* _currentDesktop; - Document* _currentDocument; + SPDocument* _currentDocument; void* _ptr; sigc::connection _documentConnection; diff --git a/src/ui/dialog/undo-history.h b/src/ui/dialog/undo-history.h index 0e14b7d7b..82e04f3c9 100644 --- a/src/ui/dialog/undo-history.h +++ b/src/ui/dialog/undo-history.h @@ -122,7 +122,7 @@ public: protected: - Document *_document; + SPDocument *_document; EventLog *_event_log; const EventLog::EventModelColumns *_columns; diff --git a/src/ui/view/edit-widget.cpp b/src/ui/view/edit-widget.cpp index 9619380bb..756f4df73 100644 --- a/src/ui/view/edit-widget.cpp +++ b/src/ui/view/edit-widget.cpp @@ -71,7 +71,7 @@ namespace Inkscape { namespace UI { namespace View { -EditWidget::EditWidget (Document *doc) +EditWidget::EditWidget (SPDocument *doc) : _main_window_table(4), _viewport_table(3,3), _act_grp(Gtk::ActionGroup::create()), @@ -1191,7 +1191,7 @@ EditWidget::shutdown() if (Inkscape::NSApplication::Editor::isDuplicatedView (_desktop)) return false; - Document *doc = _desktop->doc(); + SPDocument *doc = _desktop->doc(); if (doc->isModifiedSinceSave()) { gchar *markup; /// \todo FIXME !!! obviously this will have problems if the document @@ -1389,7 +1389,7 @@ EditWidget::updateScrollbars (double scale) _update_s_f = true; /* The desktop region we always show unconditionally */ - Document *doc = _desktop->doc(); + SPDocument *doc = _desktop->doc(); Geom::Rect darea ( Geom::Point(-sp_document_width(doc), -sp_document_height(doc)), Geom::Point(2 * sp_document_width(doc), 2 * sp_document_height(doc)) ); SPObject* root = doc->root; @@ -1548,7 +1548,7 @@ void EditWidget::_namedview_modified (SPObject *obj, guint flags) { } void -EditWidget::initEdit (Document *doc) +EditWidget::initEdit (SPDocument *doc) { _desktop = new SPDesktop(); _desktop->registerEditWidget (this); diff --git a/src/ui/view/edit-widget.h b/src/ui/view/edit-widget.h index 28b4b52d2..2bb708305 100644 --- a/src/ui/view/edit-widget.h +++ b/src/ui/view/edit-widget.h @@ -36,7 +36,7 @@ #include "ui/widget/zoom-status.h" struct SPDesktop; -struct Document; +struct SPDocument; struct SPNamedView; namespace Inkscape { @@ -46,14 +46,14 @@ namespace View { class EditWidget : public Gtk::Window, public EditWidgetInterface { public: - EditWidget (Document*); + EditWidget (SPDocument*); ~EditWidget(); // Initialization void initActions(); void initUIManager(); void initLayout(); - void initEdit (Document*); + void initEdit (SPDocument*); void destroyEdit(); // Actions diff --git a/src/ui/view/view.cpp b/src/ui/view/view.cpp index 07bb6d2c1..1b498a846 100644 --- a/src/ui/view/view.cpp +++ b/src/ui/view/view.cpp @@ -137,7 +137,7 @@ void View::requestRedraw() * * \param doc The new document to connect the view to. */ -void View::setDocument(Document *doc) { +void View::setDocument(SPDocument *doc) { g_return_if_fail(doc != NULL); if (_doc) { diff --git a/src/ui/view/view.h b/src/ui/view/view.h index 6465807d6..882746cea 100644 --- a/src/ui/view/view.h +++ b/src/ui/view/view.h @@ -53,7 +53,7 @@ struct StopOnNonZero { } }; -class Document; +class SPDocument; namespace Inkscape { class MessageContext; @@ -80,7 +80,7 @@ public: void close() { _close(); } /// Returns a pointer to the view's document. - Document *doc() const + SPDocument *doc() const { return _doc; } /// Returns a pointer to the view's message stack. Inkscape::MessageStack *messageStack() const @@ -108,12 +108,12 @@ public: virtual void onDocumentResized (double, double) = 0; protected: - Document *_doc; + SPDocument *_doc; Inkscape::MessageStack *_message_stack; Inkscape::MessageContext *_tips_message_context; virtual void _close(); - virtual void setDocument(Document *doc); + virtual void setDocument(SPDocument *doc); sigc::signal _position_set_signal; sigc::signal _resized_signal; diff --git a/src/ui/widget/entity-entry.cpp b/src/ui/widget/entity-entry.cpp index f42b29760..e9f09f574 100644 --- a/src/ui/widget/entity-entry.cpp +++ b/src/ui/widget/entity-entry.cpp @@ -81,7 +81,7 @@ EntityLineEntry::~EntityLineEntry() } void -EntityLineEntry::update (Document *doc) +EntityLineEntry::update (SPDocument *doc) { const char *text = rdf_get_work_entity (doc, _entity); static_cast(_packable)->set_text (text ? text : ""); @@ -93,7 +93,7 @@ EntityLineEntry::on_changed() if (_wr->isUpdating()) return; _wr->setUpdating (true); - Document *doc = SP_ACTIVE_DOCUMENT; + SPDocument *doc = SP_ACTIVE_DOCUMENT; Glib::ustring text = static_cast(_packable)->get_text(); if (rdf_set_work_entity (doc, _entity, text.c_str())) sp_document_done (doc, SP_VERB_NONE, @@ -122,7 +122,7 @@ EntityMultiLineEntry::~EntityMultiLineEntry() } void -EntityMultiLineEntry::update (Document *doc) +EntityMultiLineEntry::update (SPDocument *doc) { const char *text = rdf_get_work_entity (doc, _entity); Gtk::ScrolledWindow *s = static_cast(_packable); @@ -136,7 +136,7 @@ EntityMultiLineEntry::on_changed() if (_wr->isUpdating()) return; _wr->setUpdating (true); - Document *doc = SP_ACTIVE_DOCUMENT; + SPDocument *doc = SP_ACTIVE_DOCUMENT; Gtk::ScrolledWindow *s = static_cast(_packable); Gtk::TextView *tv = static_cast(s->get_child()); Glib::ustring text = tv->get_buffer()->get_text(); diff --git a/src/ui/widget/entity-entry.h b/src/ui/widget/entity-entry.h index d080787c1..5bdee9a90 100644 --- a/src/ui/widget/entity-entry.h +++ b/src/ui/widget/entity-entry.h @@ -16,7 +16,7 @@ #include struct rdf_work_entity_t; -class Document; +class SPDocument; namespace Gtk { class TextBuffer; @@ -32,7 +32,7 @@ class EntityEntry { public: static EntityEntry* create (rdf_work_entity_t* ent, Gtk::Tooltips& tt, Registry& wr); virtual ~EntityEntry() = 0; - virtual void update (Document *doc) = 0; + virtual void update (SPDocument *doc) = 0; virtual void on_changed() = 0; Gtk::Label _label; Gtk::Widget *_packable; @@ -49,7 +49,7 @@ class EntityLineEntry : public EntityEntry { public: EntityLineEntry (rdf_work_entity_t* ent, Gtk::Tooltips& tt, Registry& wr); ~EntityLineEntry(); - void update (Document *doc); + void update (SPDocument *doc); protected: virtual void on_changed(); @@ -59,7 +59,7 @@ class EntityMultiLineEntry : public EntityEntry { public: EntityMultiLineEntry (rdf_work_entity_t* ent, Gtk::Tooltips& tt, Registry& wr); ~EntityMultiLineEntry(); - void update (Document *doc); + void update (SPDocument *doc); protected: virtual void on_changed(); diff --git a/src/ui/widget/imageicon.cpp b/src/ui/widget/imageicon.cpp index ead32b4b7..6a817e30d 100644 --- a/src/ui/widget/imageicon.cpp +++ b/src/ui/widget/imageicon.cpp @@ -94,13 +94,13 @@ void ImageIcon::init() } -bool ImageIcon::showSvgDocument(const Document *docArg) +bool ImageIcon::showSvgDocument(const SPDocument *docArg) { if (document) sp_document_unref(document); - Document *doc = (Document *)docArg; + SPDocument *doc = (SPDocument *)docArg; sp_document_ref(doc); document = doc; @@ -127,7 +127,7 @@ bool ImageIcon::showSvgFile(const Glib::ustring &theFileName) fileName = Glib::filename_to_utf8(fileName); - Document *doc = sp_document_new (fileName.c_str(), 0); + SPDocument *doc = sp_document_new (fileName.c_str(), 0); if (!doc) { g_warning("SVGView: error loading document '%s'\n", fileName.c_str()); return false; @@ -148,7 +148,7 @@ bool ImageIcon::showSvgFromMemory(const char *xmlBuffer) return false; gint len = (gint)strlen(xmlBuffer); - Document *doc = sp_document_new_from_mem(xmlBuffer, len, 0); + SPDocument *doc = sp_document_new_from_mem(xmlBuffer, len, 0); if (!doc) { g_warning("SVGView: error loading buffer '%s'\n",xmlBuffer); return false; diff --git a/src/ui/widget/imageicon.h b/src/ui/widget/imageicon.h index 3819a3c77..803b2f53f 100644 --- a/src/ui/widget/imageicon.h +++ b/src/ui/widget/imageicon.h @@ -16,7 +16,7 @@ #include -class Document; +class SPDocument; namespace Inkscape { @@ -62,7 +62,7 @@ public: /** * */ - bool showSvgDocument(const Document *doc); + bool showSvgDocument(const SPDocument *doc); /** * @@ -99,7 +99,7 @@ private: /** * The svg document we are currently showing */ - Document *document; + SPDocument *document; /** * The sp_svg_view widget diff --git a/src/ui/widget/layer-selector.h b/src/ui/widget/layer-selector.h index d9ef558a5..0b5300272 100644 --- a/src/ui/widget/layer-selector.h +++ b/src/ui/widget/layer-selector.h @@ -23,7 +23,7 @@ #include "util/list.h" class SPDesktop; -class Document; +class SPDocument; class SPObject; namespace Inkscape { namespace XML { diff --git a/src/ui/widget/licensor.cpp b/src/ui/widget/licensor.cpp index 778fbc6cc..a5f1d89be 100644 --- a/src/ui/widget/licensor.cpp +++ b/src/ui/widget/licensor.cpp @@ -119,7 +119,7 @@ Licensor::init (Gtk::Tooltips& tt, Registry& wr) } void -Licensor::update (Document *doc) +Licensor::update (SPDocument *doc) { /* identify the license info */ struct rdf_license_t * license = rdf_get_license (doc); diff --git a/src/ui/widget/licensor.h b/src/ui/widget/licensor.h index 6738c48df..9f41a6d0d 100644 --- a/src/ui/widget/licensor.h +++ b/src/ui/widget/licensor.h @@ -15,7 +15,7 @@ #include -class Document; +class SPDocument; namespace Gtk { class Tooltips; @@ -34,7 +34,7 @@ public: Licensor(); virtual ~Licensor(); void init (Gtk::Tooltips&, Registry&); - void update (Document *doc); + void update (SPDocument *doc); protected: EntityEntry *_eentry; diff --git a/src/ui/widget/object-composite-settings.cpp b/src/ui/widget/object-composite-settings.cpp index 1b4251143..bfc291bc0 100644 --- a/src/ui/widget/object-composite-settings.cpp +++ b/src/ui/widget/object-composite-settings.cpp @@ -117,7 +117,7 @@ ObjectCompositeSettings::_blendBlurValueChanged() if (!desktop) { return; } - Document *document = sp_desktop_document (desktop); + SPDocument *document = sp_desktop_document (desktop); if (_blocked) return; diff --git a/src/ui/widget/page-sizer.cpp b/src/ui/widget/page-sizer.cpp index 429442779..02688a55e 100644 --- a/src/ui/widget/page-sizer.cpp +++ b/src/ui/widget/page-sizer.cpp @@ -346,7 +346,7 @@ PageSizer::setDim (double w, double h, bool changeList) _changedh_connection.block(); if (SP_ACTIVE_DESKTOP && !_widgetRegistry->isUpdating()) { - Document *doc = sp_desktop_document(SP_ACTIVE_DESKTOP); + SPDocument *doc = sp_desktop_document(SP_ACTIVE_DESKTOP); double const old_height = sp_document_height(doc); sp_document_set_width (doc, w, &_px_unit); sp_document_set_height (doc, h, &_px_unit); diff --git a/src/ui/widget/panel.cpp b/src/ui/widget/panel.cpp index c2fafa001..93a950d1a 100644 --- a/src/ui/widget/panel.cpp +++ b/src/ui/widget/panel.cpp @@ -566,7 +566,7 @@ Panel::setResponseSensitive(int response_id, bool setting) _response_map[response_id]->set_sensitive(setting); } -sigc::signal & +sigc::signal & Panel::signalDocumentReplaced() { return _signal_document_replaced; diff --git a/src/ui/widget/panel.h b/src/ui/widget/panel.h index 36f5ea804..d42548f16 100644 --- a/src/ui/widget/panel.h +++ b/src/ui/widget/panel.h @@ -71,7 +71,7 @@ public: void setDefaultResponse(int response_id); void setResponseSensitive(int response_id, bool setting); - virtual sigc::signal &signalDocumentReplaced(); + virtual sigc::signal &signalDocumentReplaced(); virtual sigc::signal &signalActivateDesktop(); virtual sigc::signal &signalDeactiveDesktop(); @@ -100,7 +100,7 @@ protected: /** Signals */ sigc::signal _signal_response; sigc::signal _signal_present; - sigc::signal _signal_document_replaced; + sigc::signal _signal_document_replaced; sigc::signal _signal_activate_desktop; sigc::signal _signal_deactive_desktop; diff --git a/src/ui/widget/registered-enums.h b/src/ui/widget/registered-enums.h index f9195d1f2..739745817 100644 --- a/src/ui/widget/registered-enums.h +++ b/src/ui/widget/registered-enums.h @@ -32,7 +32,7 @@ public: const Util::EnumDataConverter& c, Registry& wr, Inkscape::XML::Node* repr_in = NULL, - Document *doc_in = NULL ) + SPDocument *doc_in = NULL ) : RegisteredWidget< LabelledComboBoxEnum >(label, tip, c) { RegisteredWidget< LabelledComboBoxEnum >::init_parent(key, wr, repr_in, doc_in); diff --git a/src/ui/widget/registered-widget.cpp b/src/ui/widget/registered-widget.cpp index 5780f74ed..95ddec286 100644 --- a/src/ui/widget/registered-widget.cpp +++ b/src/ui/widget/registered-widget.cpp @@ -50,7 +50,7 @@ RegisteredCheckButton::~RegisteredCheckButton() _toggled_connection.disconnect(); } -RegisteredCheckButton::RegisteredCheckButton (const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, bool right, Inkscape::XML::Node* repr_in, Document *doc_in) +RegisteredCheckButton::RegisteredCheckButton (const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, bool right, Inkscape::XML::Node* repr_in, SPDocument *doc_in) : RegisteredWidget() { init_parent(key, wr, repr_in, doc_in); @@ -108,7 +108,7 @@ RegisteredUnitMenu::~RegisteredUnitMenu() _changed_connection.disconnect(); } -RegisteredUnitMenu::RegisteredUnitMenu (const Glib::ustring& label, const Glib::ustring& key, Registry& wr, Inkscape::XML::Node* repr_in, Document *doc_in) +RegisteredUnitMenu::RegisteredUnitMenu (const Glib::ustring& label, const Glib::ustring& key, Registry& wr, Inkscape::XML::Node* repr_in, SPDocument *doc_in) : RegisteredWidget (label, "" /*tooltip*/, new UnitMenu()) { init_parent(key, wr, repr_in, doc_in); @@ -149,7 +149,7 @@ RegisteredScalarUnit::~RegisteredScalarUnit() _value_changed_connection.disconnect(); } -RegisteredScalarUnit::RegisteredScalarUnit (const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, const RegisteredUnitMenu &rum, Registry& wr, Inkscape::XML::Node* repr_in, Document *doc_in) +RegisteredScalarUnit::RegisteredScalarUnit (const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, const RegisteredUnitMenu &rum, Registry& wr, Inkscape::XML::Node* repr_in, SPDocument *doc_in) : RegisteredWidget(label, tip, UNIT_TYPE_LINEAR, "", "", rum.getUnitMenu()), _um(0) { @@ -200,7 +200,7 @@ RegisteredScalar::~RegisteredScalar() RegisteredScalar::RegisteredScalar ( const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, Inkscape::XML::Node* repr_in, - Document * doc_in ) + SPDocument * doc_in ) : RegisteredWidget(label, tip) { init_parent(key, wr, repr_in, doc_in); @@ -248,7 +248,7 @@ RegisteredText::~RegisteredText() RegisteredText::RegisteredText ( const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, Inkscape::XML::Node* repr_in, - Document * doc_in ) + SPDocument * doc_in ) : RegisteredWidget(label, tip) { init_parent(key, wr, repr_in, doc_in); @@ -296,7 +296,7 @@ RegisteredColorPicker::RegisteredColorPicker(const Glib::ustring& label, const Glib::ustring& akey, Registry& wr, Inkscape::XML::Node* repr_in, - Document *doc_in) + SPDocument *doc_in) : RegisteredWidget (title, tip, 0, true) { init_parent("", wr, repr_in, doc_in); @@ -337,7 +337,7 @@ RegisteredColorPicker::on_changed (guint32 rgba) // Use local repr here. When repr is specified, use that one, but // if repr==NULL, get the repr of namedview of active desktop. Inkscape::XML::Node *local_repr = repr; - Document *local_doc = doc; + SPDocument *local_doc = doc; if (!local_repr) { // no repr specified, use active desktop's namedview's repr SPDesktop *dt = SP_ACTIVE_DESKTOP; @@ -372,7 +372,7 @@ RegisteredSuffixedInteger::~RegisteredSuffixedInteger() _changed_connection.disconnect(); } -RegisteredSuffixedInteger::RegisteredSuffixedInteger (const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& suffix, const Glib::ustring& key, Registry& wr, Inkscape::XML::Node* repr_in, Document *doc_in) +RegisteredSuffixedInteger::RegisteredSuffixedInteger (const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& suffix, const Glib::ustring& key, Registry& wr, Inkscape::XML::Node* repr_in, SPDocument *doc_in) : RegisteredWidget(label, tip, 0, suffix), setProgrammatically(false) { @@ -419,7 +419,7 @@ RegisteredRadioButtonPair::~RegisteredRadioButtonPair() RegisteredRadioButtonPair::RegisteredRadioButtonPair (const Glib::ustring& label, const Glib::ustring& label1, const Glib::ustring& label2, const Glib::ustring& tip1, const Glib::ustring& tip2, - const Glib::ustring& key, Registry& wr, Inkscape::XML::Node* repr_in, Document *doc_in) + const Glib::ustring& key, Registry& wr, Inkscape::XML::Node* repr_in, SPDocument *doc_in) : RegisteredWidget(), _rb1(NULL), _rb2(NULL) @@ -486,7 +486,7 @@ RegisteredPoint::~RegisteredPoint() RegisteredPoint::RegisteredPoint ( const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, Inkscape::XML::Node* repr_in, - Document* doc_in ) + SPDocument* doc_in ) : RegisteredWidget (label, tip) { init_parent(key, wr, repr_in, doc_in); @@ -531,7 +531,7 @@ RegisteredTransformedPoint::~RegisteredTransformedPoint() RegisteredTransformedPoint::RegisteredTransformedPoint ( const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, Inkscape::XML::Node* repr_in, - Document* doc_in ) + SPDocument* doc_in ) : RegisteredWidget (label, tip), to_svg(Geom::identity()) { @@ -598,7 +598,7 @@ RegisteredRandom::~RegisteredRandom() RegisteredRandom::RegisteredRandom ( const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, Inkscape::XML::Node* repr_in, - Document * doc_in ) + SPDocument * doc_in ) : RegisteredWidget (label, tip) { init_parent(key, wr, repr_in, doc_in); diff --git a/src/ui/widget/registered-widget.h b/src/ui/widget/registered-widget.h index 32d6c93fa..a5c61f68a 100644 --- a/src/ui/widget/registered-widget.h +++ b/src/ui/widget/registered-widget.h @@ -35,7 +35,7 @@ #include "sp-namedview.h" class SPUnit; -class Document; +class SPDocument; namespace Gtk { class HScale; @@ -81,7 +81,7 @@ protected: virtual ~RegisteredWidget() {}; - void init_parent(const Glib::ustring& key, Registry& wr, Inkscape::XML::Node* repr_in, Document *doc_in) + void init_parent(const Glib::ustring& key, Registry& wr, Inkscape::XML::Node* repr_in, SPDocument *doc_in) { _wr = ≀ _key = key; @@ -96,7 +96,7 @@ protected: // Use local repr here. When repr is specified, use that one, but // if repr==NULL, get the repr of namedview of active desktop. Inkscape::XML::Node *local_repr = repr; - Document *local_doc = doc; + SPDocument *local_doc = doc; if (!local_repr) { // no repr specified, use active desktop's namedview's repr SPDesktop* dt = SP_ACTIVE_DESKTOP; @@ -120,7 +120,7 @@ protected: Registry * _wr; Glib::ustring _key; Inkscape::XML::Node * repr; - Document * doc; + SPDocument * doc; unsigned int event_type; Glib::ustring event_description; bool write_undo; @@ -139,7 +139,7 @@ private: class RegisteredCheckButton : public RegisteredWidget { public: virtual ~RegisteredCheckButton(); - RegisteredCheckButton (const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, bool right=true, Inkscape::XML::Node* repr_in=NULL, Document *doc_in=NULL); + RegisteredCheckButton (const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, bool right=true, Inkscape::XML::Node* repr_in=NULL, SPDocument *doc_in=NULL); void setActive (bool); @@ -168,7 +168,7 @@ public: const Glib::ustring& key, Registry& wr, Inkscape::XML::Node* repr_in = NULL, - Document *doc_in = NULL ); + SPDocument *doc_in = NULL ); void setUnit (const SPUnit*); Unit getUnit() const { return static_cast(_widget)->getUnit(); }; @@ -188,7 +188,7 @@ public: const RegisteredUnitMenu &rum, Registry& wr, Inkscape::XML::Node* repr_in = NULL, - Document *doc_in = NULL ); + SPDocument *doc_in = NULL ); protected: sigc::connection _value_changed_connection; @@ -204,7 +204,7 @@ public: const Glib::ustring& key, Registry& wr, Inkscape::XML::Node* repr_in = NULL, - Document *doc_in = NULL ); + SPDocument *doc_in = NULL ); protected: sigc::connection _value_changed_connection; @@ -219,7 +219,7 @@ public: const Glib::ustring& key, Registry& wr, Inkscape::XML::Node* repr_in = NULL, - Document *doc_in = NULL ); + SPDocument *doc_in = NULL ); protected: sigc::connection _activate_connection; @@ -237,7 +237,7 @@ public: const Glib::ustring& akey, Registry& wr, Inkscape::XML::Node* repr_in = NULL, - Document *doc_in = NULL); + SPDocument *doc_in = NULL); void setRgba32 (guint32); void closeWindow(); @@ -259,7 +259,7 @@ public: const Glib::ustring& key, Registry& wr, Inkscape::XML::Node* repr_in = NULL, - Document *doc_in = NULL ); + SPDocument *doc_in = NULL ); bool setProgrammatically; // true if the value was set by setValue, not changed by the user; // if a callback checks it, it must reset it back to false @@ -280,7 +280,7 @@ public: const Glib::ustring& key, Registry& wr, Inkscape::XML::Node* repr_in = NULL, - Document *doc_in = NULL ); + SPDocument *doc_in = NULL ); void setValue (bool second); @@ -301,7 +301,7 @@ public: const Glib::ustring& key, Registry& wr, Inkscape::XML::Node* repr_in = NULL, - Document *doc_in = NULL ); + SPDocument *doc_in = NULL ); protected: sigc::connection _value_x_changed_connection; @@ -318,7 +318,7 @@ public: const Glib::ustring& key, Registry& wr, Inkscape::XML::Node* repr_in = NULL, - Document *doc_in = NULL ); + SPDocument *doc_in = NULL ); // redefine setValue, because transform must be applied void setValue(Geom::Point const & p); @@ -342,7 +342,7 @@ public: const Glib::ustring& key, Registry& wr, Inkscape::XML::Node* repr_in = NULL, - Document *doc_in = NULL); + SPDocument *doc_in = NULL); void setValue (double val, long startseed); diff --git a/src/ui/widget/tolerance-slider.cpp b/src/ui/widget/tolerance-slider.cpp index bc5b45979..3a36127f4 100644 --- a/src/ui/widget/tolerance-slider.cpp +++ b/src/ui/widget/tolerance-slider.cpp @@ -185,7 +185,7 @@ ToleranceSlider::update (double val) _wr->setUpdating (true); - Document *doc = sp_desktop_document(dt); + SPDocument *doc = sp_desktop_document(dt); bool saved = sp_document_get_undo_sensitive (doc); sp_document_set_undo_sensitive (doc, false); Inkscape::XML::Node *repr = SP_OBJECT_REPR (sp_desktop_namedview(dt)); diff --git a/src/uri-references.cpp b/src/uri-references.cpp index 33d599180..d979fe292 100644 --- a/src/uri-references.cpp +++ b/src/uri-references.cpp @@ -32,7 +32,7 @@ URIReference::URIReference(SPObject *owner) /* FIXME !!! attach to owner's destroy signal to clean up in case */ } -URIReference::URIReference(Document *owner_document) +URIReference::URIReference(SPDocument *owner_document) : _owner(NULL), _owner_document(owner_document), _obj(NULL), _uri(NULL) { g_assert(_owner_document != NULL); @@ -45,7 +45,7 @@ URIReference::~URIReference() void URIReference::attach(const URI &uri) throw(BadURIException) { - Document *document; + SPDocument *document; if (_owner) { document = SP_OBJECT_DOCUMENT(_owner); } else if (_owner_document) { @@ -142,7 +142,7 @@ void URIReference::_release(SPObject *obj) -SPObject* sp_css_uri_reference_resolve( Document *document, const gchar *uri ) +SPObject* sp_css_uri_reference_resolve( SPDocument *document, const gchar *uri ) { SPObject* ref = 0; @@ -158,7 +158,7 @@ SPObject* sp_css_uri_reference_resolve( Document *document, const gchar *uri ) } SPObject * -sp_uri_reference_resolve (Document *document, const gchar *uri) +sp_uri_reference_resolve (SPDocument *document, const gchar *uri) { SPObject* ref = 0; diff --git a/src/uri-references.h b/src/uri-references.h index 0f7a724ba..a98c84153 100644 --- a/src/uri-references.h +++ b/src/uri-references.h @@ -41,7 +41,7 @@ public: * is holding a reference to the target object. */ URIReference(SPObject *owner); - URIReference(Document *owner_document); + URIReference(SPDocument *owner_document); /** * Destructor. Calls shutdown() if the reference has not been @@ -114,7 +114,7 @@ public: return (bool)_uri; } - Document *getOwnerDocument() { return _owner_document; } + SPDocument *getOwnerDocument() { return _owner_document; } SPObject *getOwnerObject() { return _owner; } protected: @@ -125,7 +125,7 @@ protected: private: SPObject *_owner; - Document *_owner_document; + SPDocument *_owner_document; sigc::connection _connection; sigc::connection _release_connection; SPObject *_obj; @@ -145,8 +145,8 @@ private: /** * Resolves an item referenced by a URI in CSS form contained in "url(...)" */ -SPObject* sp_css_uri_reference_resolve( Document *document, const gchar *uri ); +SPObject* sp_css_uri_reference_resolve( SPDocument *document, const gchar *uri ); -SPObject *sp_uri_reference_resolve (Document *document, const gchar *uri); +SPObject *sp_uri_reference_resolve (SPDocument *document, const gchar *uri); #endif diff --git a/src/vanishing-point.cpp b/src/vanishing-point.cpp index 133311625..ab46b21a6 100644 --- a/src/vanishing-point.cpp +++ b/src/vanishing-point.cpp @@ -462,7 +462,7 @@ VPDragger::printVPs() { } } -VPDrag::VPDrag (Document *document) +VPDrag::VPDrag (SPDocument *document) { this->document = document; this->selection = sp_desktop_selection(inkscape_active_desktop()); diff --git a/src/vanishing-point.h b/src/vanishing-point.h index 311315404..9fcb6bb46 100644 --- a/src/vanishing-point.h +++ b/src/vanishing-point.h @@ -158,14 +158,14 @@ public: struct VPDrag { public: - VPDrag(Document *document); + VPDrag(SPDocument *document); ~VPDrag(); VPDragger *getDraggerFor (VanishingPoint const &vp); bool dragging; - Document *document; + SPDocument *document; GList *draggers; GSList *lines; diff --git a/src/verbs.cpp b/src/verbs.cpp index 10f4f3acc..43ddc1459 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -607,7 +607,7 @@ Verb::get_action(Inkscape::UI::View::View *view) } void -Verb::sensitive(Document *in_doc, bool in_sensitive) +Verb::sensitive(SPDocument *in_doc, bool in_sensitive) { // printf("Setting sensitivity of \"%s\" to %d\n", _name, in_sensitive); if (_actions != NULL) { @@ -635,7 +635,7 @@ Verb::get_tip (void) } void -Verb::name(Document *in_doc, Glib::ustring in_name) +Verb::name(SPDocument *in_doc, Glib::ustring in_name) { if (_actions != NULL) { for (ActionTable::iterator cur_action = _actions->begin(); @@ -759,7 +759,7 @@ FileVerb::perform(SPAction *action, void *data, void */*pdata*/) /* These aren't used, but are here to remind people not to use the CURRENT_DOCUMENT macros unless they really have to. */ Inkscape::UI::View::View *current_view = sp_action_get_view(action); - Document *current_document = current_view->doc(); + SPDocument *current_document = current_view->doc(); #endif SPDesktop *desktop = dynamic_cast(sp_action_get_view(action)); @@ -1605,7 +1605,7 @@ TextVerb::perform(SPAction *action, void */*data*/, void */*pdata*/) if (!dt) return; - Document *doc = sp_desktop_document(dt); + SPDocument *doc = sp_desktop_document(dt); (void)doc; Inkscape::XML::Node *repr = SP_OBJECT_REPR(dt->namedview); (void)repr; @@ -1620,7 +1620,7 @@ ZoomVerb::perform(SPAction *action, void *data, void */*pdata*/) return; SPEventContext *ec = dt->event_context; - Document *doc = sp_desktop_document(dt); + SPDocument *doc = sp_desktop_document(dt); Inkscape::XML::Node *repr = SP_OBJECT_REPR(dt->namedview); @@ -2066,7 +2066,7 @@ EffectLastVerb::perform(SPAction *action, void *data, void */*pdata*/) /* These aren't used, but are here to remind people not to use the CURRENT_DOCUMENT macros unless they really have to. */ Inkscape::UI::View::View *current_view = sp_action_get_view(action); - // Document *current_document = SP_VIEW_DOCUMENT(current_view); + // SPDocument *current_document = SP_VIEW_DOCUMENT(current_view); Inkscape::Extension::Effect *effect = Inkscape::Extension::Effect::get_last_effect(); if (effect == NULL) return; @@ -2134,7 +2134,7 @@ FitCanvasVerb::perform(SPAction *action, void *data, void */*pdata*/) { SPDesktop *dt = static_cast(sp_action_get_view(action)); if (!dt) return; - Document *doc = sp_desktop_document(dt); + SPDocument *doc = sp_desktop_document(dt); if (!doc) return; switch ((long) data) { @@ -2203,7 +2203,7 @@ LockAndHideVerb::perform(SPAction *action, void *data, void */*pdata*/) { SPDesktop *dt = static_cast(sp_action_get_view(action)); if (!dt) return; - Document *doc = sp_desktop_document(dt); + SPDocument *doc = sp_desktop_document(dt); if (!doc) return; switch ((long) data) { diff --git a/src/verbs.h b/src/verbs.h index de9eae68a..c3b88918b 100644 --- a/src/verbs.h +++ b/src/verbs.h @@ -437,8 +437,8 @@ public: static void delete_all_view (Inkscape::UI::View::View * view); void delete_view (Inkscape::UI::View::View * view); - void sensitive (Inkscape::XML::DocumentTree * in_doc = NULL, bool in_sensitive = true); - void name (Inkscape::XML::DocumentTree * in_doc = NULL, Glib::ustring in_name = ""); + void sensitive (SPDocument * in_doc = NULL, bool in_sensitive = true); + void name (SPDocument * in_doc = NULL, Glib::ustring in_name = ""); // Yes, multiple public, protected and private sections are bad. We'll clean that up later protected: diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index fc2e82722..a2f88c16d 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -820,7 +820,7 @@ SPDesktopWidget::shutdown() g_assert(desktop != NULL); if (inkscape_is_sole_desktop_for_document(*desktop)) { - Document *doc = desktop->doc(); + SPDocument *doc = desktop->doc(); if (doc->isModifiedSinceSave()) { GtkWidget *dialog; @@ -1721,7 +1721,7 @@ sp_desktop_widget_update_scrollbars (SPDesktopWidget *dtw, double scale) dtw->update = 1; /* The desktop region we always show unconditionally */ - Document *doc = dtw->desktop->doc(); + SPDocument *doc = dtw->desktop->doc(); Geom::Rect darea ( Geom::Point(-sp_document_width(doc), -sp_document_height(doc)), Geom::Point(2 * sp_document_width(doc), 2 * sp_document_height(doc)) ); SPObject* root = doc->root; diff --git a/src/widgets/fill-style.cpp b/src/widgets/fill-style.cpp index 683b041b0..5e9d30bcd 100644 --- a/src/widgets/fill-style.cpp +++ b/src/widgets/fill-style.cpp @@ -355,7 +355,7 @@ sp_fill_style_widget_paint_changed ( SPPaintSelector *psel, if (!desktop) { return; } - Document *document = sp_desktop_document (desktop); + SPDocument *document = sp_desktop_document (desktop); Inkscape::Selection *selection = sp_desktop_selection (desktop); GSList const *items = selection->itemList(); diff --git a/src/widgets/gradient-selector.cpp b/src/widgets/gradient-selector.cpp index 15b65c239..f24a6781b 100644 --- a/src/widgets/gradient-selector.cpp +++ b/src/widgets/gradient-selector.cpp @@ -248,7 +248,7 @@ sp_gradient_selector_get_spread (SPGradientSelector *sel) } void -sp_gradient_selector_set_vector (SPGradientSelector *sel, Document *doc, SPGradient *vector) +sp_gradient_selector_set_vector (SPGradientSelector *sel, SPDocument *doc, SPGradient *vector) { g_return_if_fail (sel != NULL); g_return_if_fail (SP_IS_GRADIENT_SELECTOR (sel)); @@ -307,7 +307,7 @@ sp_gradient_selector_edit_vector_clicked (GtkWidget */*w*/, SPGradientSelector * static void sp_gradient_selector_add_vector_clicked (GtkWidget */*w*/, SPGradientSelector *sel) { - Document *doc = sp_gradient_vector_selector_get_document ( + SPDocument *doc = sp_gradient_vector_selector_get_document ( SP_GRADIENT_VECTOR_SELECTOR (sel->vectors)); if (!doc) diff --git a/src/widgets/gradient-selector.h b/src/widgets/gradient-selector.h index 63e18554d..e68dfecfc 100644 --- a/src/widgets/gradient-selector.h +++ b/src/widgets/gradient-selector.h @@ -68,7 +68,7 @@ GtkWidget *sp_gradient_selector_new (void); void sp_gradient_selector_set_mode (SPGradientSelector *sel, guint mode); void sp_gradient_selector_set_units (SPGradientSelector *sel, guint units); void sp_gradient_selector_set_spread (SPGradientSelector *sel, guint spread); -void sp_gradient_selector_set_vector (SPGradientSelector *sel, Document *doc, SPGradient *vector); +void sp_gradient_selector_set_vector (SPGradientSelector *sel, SPDocument *doc, SPGradient *vector); void sp_gradient_selector_set_bbox (SPGradientSelector *sel, gdouble x0, gdouble y0, gdouble x1, gdouble y1); SPGradientUnits sp_gradient_selector_get_units (SPGradientSelector *sel); diff --git a/src/widgets/gradient-toolbar.cpp b/src/widgets/gradient-toolbar.cpp index f64dc7bd8..ddd9fd96a 100644 --- a/src/widgets/gradient-toolbar.cpp +++ b/src/widgets/gradient-toolbar.cpp @@ -167,7 +167,7 @@ gr_prepare_label (SPObject *obj) GtkWidget * gr_vector_list (SPDesktop *desktop, bool selection_empty, SPGradient *gr_selected, bool gr_multi) { - Document *document = sp_desktop_document (desktop); + SPDocument *document = sp_desktop_document (desktop); GtkWidget *om = gtk_option_menu_new (); GtkWidget *m = gtk_menu_new (); @@ -435,7 +435,7 @@ GtkWidget * gr_change_widget (SPDesktop *desktop) { Inkscape::Selection *selection = sp_desktop_selection (desktop); - Document *document = sp_desktop_document (desktop); + SPDocument *document = sp_desktop_document (desktop); SPEventContext *ev = sp_desktop_event_context (desktop); SPGradient *gr_selected = NULL; diff --git a/src/widgets/gradient-vector.cpp b/src/widgets/gradient-vector.cpp index c6a7b37f4..1f0c07754 100644 --- a/src/widgets/gradient-vector.cpp +++ b/src/widgets/gradient-vector.cpp @@ -155,7 +155,7 @@ sp_gradient_vector_selector_destroy (GtkObject *object) } GtkWidget * -sp_gradient_vector_selector_new (Document *doc, SPGradient *gr) +sp_gradient_vector_selector_new (SPDocument *doc, SPGradient *gr) { GtkWidget *gvs; @@ -174,7 +174,7 @@ sp_gradient_vector_selector_new (Document *doc, SPGradient *gr) } void -sp_gradient_vector_selector_set_gradient (SPGradientVectorSelector *gvs, Document *doc, SPGradient *gr) +sp_gradient_vector_selector_set_gradient (SPGradientVectorSelector *gvs, SPDocument *doc, SPGradient *gr) { static gboolean suppress = FALSE; @@ -220,7 +220,7 @@ sp_gradient_vector_selector_set_gradient (SPGradientVectorSelector *gvs, Documen /* The case of setting NULL -> NULL is not very interesting */ } -Document * +SPDocument * sp_gradient_vector_selector_get_document (SPGradientVectorSelector *gvs) { g_return_val_if_fail (gvs != NULL, NULL); @@ -1037,7 +1037,7 @@ sp_gradient_vector_widget_load_gradient (GtkWidget *widget, SPGradient *gradient // Once the user edits a gradient, it stops being auto-collectable if (SP_OBJECT_REPR(gradient)->attribute("inkscape:collect")) { - Document *document = SP_OBJECT_DOCUMENT (gradient); + SPDocument *document = SP_OBJECT_DOCUMENT (gradient); bool saved = sp_document_get_undo_sensitive(document); sp_document_set_undo_sensitive (document, false); SP_OBJECT_REPR(gradient)->setAttribute("inkscape:collect", NULL); diff --git a/src/widgets/gradient-vector.h b/src/widgets/gradient-vector.h index aa5444755..ea1f5159f 100644 --- a/src/widgets/gradient-vector.h +++ b/src/widgets/gradient-vector.h @@ -31,7 +31,7 @@ struct SPGradientVectorSelector { guint idlabel : 1; - Document *doc; + SPDocument *doc; SPGradient *gr; /* Vector menu */ @@ -50,11 +50,11 @@ struct SPGradientVectorSelectorClass { GType sp_gradient_vector_selector_get_type(void); -GtkWidget *sp_gradient_vector_selector_new (Document *doc, SPGradient *gradient); +GtkWidget *sp_gradient_vector_selector_new (SPDocument *doc, SPGradient *gradient); -void sp_gradient_vector_selector_set_gradient (SPGradientVectorSelector *gvs, Document *doc, SPGradient *gr); +void sp_gradient_vector_selector_set_gradient (SPGradientVectorSelector *gvs, SPDocument *doc, SPGradient *gr); -Document *sp_gradient_vector_selector_get_document (SPGradientVectorSelector *gvs); +SPDocument *sp_gradient_vector_selector_get_document (SPGradientVectorSelector *gvs); SPGradient *sp_gradient_vector_selector_get_gradient (SPGradientVectorSelector *gvs); /* fixme: rethink this (Lauris) */ diff --git a/src/widgets/icon.cpp b/src/widgets/icon.cpp index 56602962d..5824b102c 100644 --- a/src/widgets/icon.cpp +++ b/src/widgets/icon.cpp @@ -908,7 +908,7 @@ GdkPixbuf *sp_icon_image_load_pixmap(gchar const *name, unsigned /*lsize*/, unsi // takes doc, root, icon, and icon name to produce pixels extern "C" guchar * -sp_icon_doc_icon( Document *doc, NRArenaItem *root, +sp_icon_doc_icon( SPDocument *doc, NRArenaItem *root, gchar const *name, unsigned psize ) { bool const dump = Inkscape::Preferences::get()->getBool("/debug/icons/dumpSvg"); @@ -1038,7 +1038,7 @@ sp_icon_doc_icon( Document *doc, NRArenaItem *root, struct svg_doc_cache_t { - Document *doc; + SPDocument *doc; NRArenaItem *root; }; @@ -1081,7 +1081,7 @@ static std::list &icons_svg_paths() static guchar *load_svg_pixels(gchar const *name, unsigned /*lsize*/, unsigned psize) { - Document *doc = NULL; + SPDocument *doc = NULL; NRArenaItem *root = NULL; svg_doc_cache_t *info = NULL; diff --git a/src/widgets/paint-selector.cpp b/src/widgets/paint-selector.cpp index d203e094f..a101b9eeb 100644 --- a/src/widgets/paint-selector.cpp +++ b/src/widgets/paint-selector.cpp @@ -747,7 +747,7 @@ sp_psel_pattern_change(GtkWidget *widget, SPPaintSelector *psel) * Returns NULL if there are no patterns in the document. */ GSList * -ink_pattern_list_get (Document *source) +ink_pattern_list_get (SPDocument *source) { if (source == NULL) return NULL; @@ -768,7 +768,7 @@ ink_pattern_list_get (Document *source) * Adds menu items for pattern list - derived from marker code, left hb etc in to make addition of previews easier at some point. */ static void -sp_pattern_menu_build (GtkWidget *m, GSList *pattern_list, Document */*source*/) +sp_pattern_menu_build (GtkWidget *m, GSList *pattern_list, SPDocument */*source*/) { for (; pattern_list != NULL; pattern_list = pattern_list->next) { @@ -813,7 +813,7 @@ sp_pattern_menu_build (GtkWidget *m, GSList *pattern_list, Document */*source*/) * */ static void -sp_pattern_list_from_doc (GtkWidget *m, Document *current_doc, Document *source, Document *pattern_doc) +sp_pattern_list_from_doc (GtkWidget *m, SPDocument *current_doc, SPDocument *source, SPDocument *pattern_doc) { (void)current_doc; (void)pattern_doc; @@ -838,9 +838,9 @@ sp_pattern_list_from_doc (GtkWidget *m, Document *current_doc, Document *source, static void -ink_pattern_menu_populate_menu(GtkWidget *m, Document *doc) +ink_pattern_menu_populate_menu(GtkWidget *m, SPDocument *doc) { - static Document *patterns_doc = NULL; + static SPDocument *patterns_doc = NULL; // find and load patterns.svg if (patterns_doc == NULL) { @@ -878,7 +878,7 @@ ink_pattern_menu(GtkWidget *mnu) /* Create new menu widget */ GtkWidget *m = gtk_menu_new(); gtk_widget_show(m); - Document *doc = SP_ACTIVE_DOCUMENT; + SPDocument *doc = SP_ACTIVE_DOCUMENT; if (!doc) { GtkWidget *i; diff --git a/src/widgets/select-toolbar.cpp b/src/widgets/select-toolbar.cpp index 6d28f80e5..f168cedeb 100644 --- a/src/widgets/select-toolbar.cpp +++ b/src/widgets/select-toolbar.cpp @@ -153,7 +153,7 @@ sp_object_layout_any_value_changed(GtkAdjustment *adj, SPWidget *spw) SPDesktop *desktop = SP_ACTIVE_DESKTOP; Inkscape::Selection *selection = sp_desktop_selection(desktop); - Document *document = sp_desktop_document(desktop); + SPDocument *document = sp_desktop_document(desktop); sp_document_ensure_up_to_date (document); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); diff --git a/src/widgets/stroke-style.cpp b/src/widgets/stroke-style.cpp index e0002e5c2..f502f87d3 100644 --- a/src/widgets/stroke-style.cpp +++ b/src/widgets/stroke-style.cpp @@ -81,7 +81,7 @@ sigc::connection marker_start_menu_connection; sigc::connection marker_mid_menu_connection; sigc::connection marker_end_menu_connection; -static SPObject *ink_extract_marker_name(gchar const *n, Document *doc); +static SPObject *ink_extract_marker_name(gchar const *n, SPDocument *doc); static void ink_markers_menu_update(Gtk::Container* spw, SPMarkerLoc const which); static Inkscape::UI::Cache::SvgPreview svg_preview_cache; @@ -307,7 +307,7 @@ sp_stroke_style_paint_changed(SPPaintSelector *psel, SPWidget *spw) g_object_set_data (G_OBJECT (spw), "update", GINT_TO_POINTER (TRUE)); SPDesktop *desktop = SP_ACTIVE_DESKTOP; - Document *document = sp_desktop_document (desktop); + SPDocument *document = sp_desktop_document (desktop); Inkscape::Selection *selection = sp_desktop_selection (desktop); GSList const *items = selection->itemList(); @@ -550,7 +550,7 @@ sp_stroke_style_widget_transientize_callback(Inkscape::Application */*inkscape*/ */ static Gtk::Image * sp_marker_prev_new(unsigned psize, gchar const *mname, - Document *source, Document *sandbox, + SPDocument *source, SPDocument *sandbox, gchar const *menu_id, NRArena const */*arena*/, unsigned /*visionkey*/, NRArenaItem *root) { // Retrieve the marker named 'mname' from the source SVG document @@ -617,7 +617,7 @@ sp_marker_prev_new(unsigned psize, gchar const *mname, * Returns NULL if there are no markers in the document. */ GSList * -ink_marker_list_get (Document *source) +ink_marker_list_get (SPDocument *source) { if (source == NULL) return NULL; @@ -641,7 +641,7 @@ ink_marker_list_get (Document *source) * Adds previews of markers in marker_list to the given menu widget */ static void -sp_marker_menu_build (Gtk::Menu *m, GSList *marker_list, Document *source, Document *sandbox, gchar const *menu_id) +sp_marker_menu_build (Gtk::Menu *m, GSList *marker_list, SPDocument *source, SPDocument *sandbox, gchar const *menu_id) { // Do this here, outside of loop, to speed up preview generation: NRArena const *arena = NRArena::create(); @@ -695,7 +695,7 @@ sp_marker_menu_build (Gtk::Menu *m, GSList *marker_list, Document *source, Docum * */ static void -sp_marker_list_from_doc (Gtk::Menu *m, Document */*current_doc*/, Document *source, Document */*markers_doc*/, Document *sandbox, gchar const *menu_id) +sp_marker_list_from_doc (Gtk::Menu *m, SPDocument */*current_doc*/, SPDocument *source, SPDocument */*markers_doc*/, SPDocument *sandbox, gchar const *menu_id) { GSList *ml = ink_marker_list_get(source); GSList *clean_ml = NULL; @@ -716,7 +716,7 @@ sp_marker_list_from_doc (Gtk::Menu *m, Document */*current_doc*/, Document *sour /** * Returns a new document containing default start, mid, and end markers. */ -Document * +SPDocument * ink_markers_preview_doc () { gchar const *buffer = "" @@ -749,9 +749,9 @@ gchar const *buffer = "(spw->get_data("miterlimit")); SPDesktop *desktop = SP_ACTIVE_DESKTOP; - Document *document = sp_desktop_document (desktop); + SPDocument *document = sp_desktop_document (desktop); Inkscape::Selection *selection = sp_desktop_selection (desktop); GSList const *items = selection->itemList(); @@ -1833,7 +1833,7 @@ sp_stroke_style_update_marker_menus(Gtk::Container *spw, GSList const *objects) * the caller should free the buffer when they no longer need it. */ static SPObject* -ink_extract_marker_name(gchar const *n, Document *doc) +ink_extract_marker_name(gchar const *n, SPDocument *doc) { gchar const *p = n; while (*p != '\0' && *p != '#') { diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index c13ad9ba6..8bb15ae6f 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -1886,7 +1886,7 @@ void toggle_snap_callback (GtkToggleAction *act, gpointer data) { //data points SPDesktop *dt = reinterpret_cast(ptr); SPNamedView *nv = sp_desktop_namedview(dt); - Document *doc = SP_OBJECT_DOCUMENT(nv); + SPDocument *doc = SP_OBJECT_DOCUMENT(nv); if (dt == NULL || nv == NULL) { g_warning("No desktop or namedview specified (in toggle_snap_callback)!"); @@ -3327,7 +3327,7 @@ static void box3d_angle_value_changed(GtkAdjustment *adj, GObject *dataKludge, Proj::Axis axis) { SPDesktop *desktop = (SPDesktop *) g_object_get_data( dataKludge, "desktop" ); - Document *document = sp_desktop_document(desktop); + SPDocument *document = sp_desktop_document(desktop); // quit if run by the attr_changed or selection changed listener if (g_object_get_data( dataKludge, "freeze" )) { @@ -3407,7 +3407,7 @@ static void box3d_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); EgeAdjustmentAction* eact = 0; - Document *document = sp_desktop_document (desktop); + SPDocument *document = sp_desktop_document (desktop); Persp3D *persp = document->current_persp3d; EgeAdjustmentAction* box3d_angle_x = 0; @@ -6845,7 +6845,7 @@ static void sp_connector_path_set_ignore(void) static void connector_spacing_changed(GtkAdjustment *adj, GObject* tbl) { SPDesktop *desktop = (SPDesktop *) g_object_get_data( tbl, "desktop" ); - Document *doc = sp_desktop_document(desktop); + SPDocument *doc = sp_desktop_document(desktop); if (!sp_document_get_undo_sensitive(doc)) { diff --git a/src/xml/document.h b/src/xml/document.h index a5f457fe8..2b9ea5cc3 100644 --- a/src/xml/document.h +++ b/src/xml/document.h @@ -12,8 +12,8 @@ * */ -#ifndef SEEN_INKSCAPE_XML_SP_REPR_DOCTREE_H -#define SEEN_INKSCAPE_XML_SP_REPR_DOCTREE_H +#ifndef SEEN_INKSCAPE_XML_SP_REPR_DOC_H +#define SEEN_INKSCAPE_XML_SP_REPR_DOC_H #include "xml/xml-forward.h" #include "xml/node.h" @@ -41,7 +41,7 @@ namespace XML { * "restore point" by calling beginTransaction() again. There can be only one active * transaction at a time for a given document. */ -class DocumentTree : virtual public Node { +struct Document : virtual public Node { public: /** * @name Document transactions diff --git a/src/xml/node.h b/src/xml/node.h index 38f006d5c..abcccdb9a 100644 --- a/src/xml/node.h +++ b/src/xml/node.h @@ -80,8 +80,6 @@ public: * @{ */ - - /** * @brief Get the type of the node * @return NodeType enumeration member corresponding to the type of the node. diff --git a/src/xml/rebase-hrefs.cpp b/src/xml/rebase-hrefs.cpp index 0fa5c0337..ec43bb178 100644 --- a/src/xml/rebase-hrefs.cpp +++ b/src/xml/rebase-hrefs.cpp @@ -1,6 +1,6 @@ #include "xml/rebase-hrefs.h" #include "dir-util.h" -#include "document.h" /* Unfortunately there's a separate xml/document.h. */ +#include "../document.h" /* Unfortunately there's a separate xml/document.h. */ #include "io/sys.h" #include "sp-object.h" #include "streq.h" @@ -199,9 +199,9 @@ Inkscape::XML::calc_abs_doc_base(gchar const *const doc_base) * * \param spns True iff doc should contain sodipodi:absref attributes. */ -void Inkscape::XML::rebase_hrefs(Inkscape::XML::Document *doc, gchar const *const new_base, bool const spns) +void Inkscape::XML::rebase_hrefs(SPDocument *const doc, gchar const *const new_base, bool const spns) { - gchar *const old_abs_base = calc_abs_doc_base((Inkscape::XML::Document *)(doc)->base); + gchar *const old_abs_base = calc_abs_doc_base(doc->base); gchar *const new_abs_base = calc_abs_doc_base(new_base); /* TODO: Should handle not just image but also: @@ -224,7 +224,7 @@ void Inkscape::XML::rebase_hrefs(Inkscape::XML::Document *doc, gchar const *cons * * Note also that Inkscape only supports fragment hrefs (href="#pattern257") for many of these * cases. */ - GSList const *images = sp_document_get_resource_list((Inkscape::XML::Document *)doc, "image"); + GSList const *images = sp_document_get_resource_list(doc, "image"); for (GSList const *l = images; l != NULL; l = l->next) { Inkscape::XML::Node *ir = SP_OBJECT_REPR(l->data); diff --git a/src/xml/rebase-hrefs.h b/src/xml/rebase-hrefs.h index 36de6ba6e..b4f288c4d 100644 --- a/src/xml/rebase-hrefs.h +++ b/src/xml/rebase-hrefs.h @@ -4,15 +4,14 @@ #include #include "util/list.h" #include "xml/attribute-record.h" -#include "document.h" +struct SPDocument; namespace Inkscape { namespace XML { -//struct Document; gchar *calc_abs_doc_base(gchar const *doc_base); -void rebase_hrefs(Inkscape::XML::Document *doc, gchar const *new_base, bool spns); +void rebase_hrefs(SPDocument *doc, gchar const *new_base, bool spns); Inkscape::Util::List rebase_href_attrs( gchar const *old_abs_base, diff --git a/src/xml/repr-css.cpp b/src/xml/repr-css.cpp index a7e913853..be125f453 100644 --- a/src/xml/repr-css.cpp +++ b/src/xml/repr-css.cpp @@ -18,19 +18,19 @@ using Inkscape::XML::AttributeRecord; using Inkscape::XML::SimpleNode; using Inkscape::XML::Node; using Inkscape::XML::NodeType; -//using Inkscape::XML::Document; +using Inkscape::XML::Document; struct SPCSSAttrImpl : public SimpleNode, public SPCSSAttr { public: - SPCSSAttrImpl(Inkscape::XML::Document *doc) + SPCSSAttrImpl(Document *doc) : SimpleNode(g_quark_from_static_string("css"), doc) {} - SPCSSAttrImpl(SPCSSAttrImpl const &other, Inkscape::XML::Document *doc) - : SimpleNode(other, (Inkscape::XML::Document *)doc) {} + SPCSSAttrImpl(SPCSSAttrImpl const &other, Document *doc) + : SimpleNode(other, doc) {} NodeType type() const { return Inkscape::XML::ELEMENT_NODE; } protected: - SimpleNode *_duplicate(Inkscape::XML::Document* doc) const { return new SPCSSAttrImpl(*this, (Inkscape::XML::Document *)doc); } + SimpleNode *_duplicate(Document* doc) const { return new SPCSSAttrImpl(*this, doc); } }; static void sp_repr_css_add_components(SPCSSAttr *css, Node *repr, gchar const *attr); diff --git a/src/xml/repr.h b/src/xml/repr.h index b40fe63a9..549822e4e 100644 --- a/src/xml/repr.h +++ b/src/xml/repr.h @@ -148,7 +148,7 @@ Inkscape::XML::Node *sp_repr_lookup_child(Inkscape::XML::Node *repr, gchar const *value); -inline Inkscape::XML::Node *sp_repr_document_first_child(Inkscape::XML::DocumentTree const *doc) { +inline Inkscape::XML::Node *sp_repr_document_first_child(Inkscape::XML::Document const *doc) { return const_cast(doc->firstChild()); } diff --git a/src/xml/xml-forward.h b/src/xml/xml-forward.h index e3ebad183..33218c8ae 100644 --- a/src/xml/xml-forward.h +++ b/src/xml/xml-forward.h @@ -20,7 +20,7 @@ namespace XML { struct AttributeRecord; struct CommentNode; class CompositeNodeObserver; -class Document; +struct Document; class ElementNode; class Event; class EventAdd; -- cgit v1.2.3 From f6646a2f88c4e071e79bd5c173903fe8f89fde14 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Thu, 6 Aug 2009 15:31:08 +0000 Subject: Make PDF, PS, and EPS dialogs consistent. Change "Canvas" to "Page" to be consistent with other dialogs and menu items. (bzr r8423) --- src/extension/internal/cairo-ps-out.cpp | 8 ++++---- src/extension/internal/cairo-renderer-pdf-out.cpp | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/extension/internal/cairo-ps-out.cpp b/src/extension/internal/cairo-ps-out.cpp index dff89c1ed..209d1e9b9 100644 --- a/src/extension/internal/cairo-ps-out.cpp +++ b/src/extension/internal/cairo-ps-out.cpp @@ -279,11 +279,11 @@ CairoPsOutput::init (void) "<_item value='PS2'>" N_("PostScript level 2") "\n" #endif "\n" - "true\n" - "true\n" "false\n" "true\n" "90\n" + "true\n" + "true\n" "\n" "\n" ".ps\n" @@ -316,11 +316,11 @@ CairoEpsOutput::init (void) "<_item value='PS2'>" N_("PostScript level 2") "\n" #endif "\n" - "true\n" - "true\n" "false\n" "true\n" "90\n" + "true\n" + "true\n" "\n" "\n" ".eps\n" diff --git a/src/extension/internal/cairo-renderer-pdf-out.cpp b/src/extension/internal/cairo-renderer-pdf-out.cpp index b44e83449..b8af3b177 100644 --- a/src/extension/internal/cairo-renderer-pdf-out.cpp +++ b/src/extension/internal/cairo-renderer-pdf-out.cpp @@ -219,8 +219,8 @@ CairoRendererPdfOutput::init (void) "false\n" "true\n" "90\n" - "false\n" - "false\n" + "false\n" + "false\n" "\n" "\n" ".pdf\n" -- cgit v1.2.3 From 84cd4afbcea5a9fa796b1fec6e2238f77970bd1f Mon Sep 17 00:00:00 2001 From: Maximilian Albert Date: Fri, 7 Aug 2009 02:47:16 +0000 Subject: Fix buglet: In the Save dialog the file extension should be automatically updated when it is changed from the dropdown box. (bzr r8431) --- src/ui/dialog/filedialogimpl-gtkmm.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ui/dialog/filedialogimpl-gtkmm.cpp b/src/ui/dialog/filedialogimpl-gtkmm.cpp index 70f2f2ae5..749a67b28 100644 --- a/src/ui/dialog/filedialogimpl-gtkmm.cpp +++ b/src/ui/dialog/filedialogimpl-gtkmm.cpp @@ -1234,8 +1234,9 @@ void FileSaveDialogImplGtk::updateNameAndExtension() Inkscape::Extension::Output* newOut = extension ? dynamic_cast(extension) : 0; if ( fileTypeCheckbox.get_active() && newOut ) { - // Append the file extension if it's not already present + // Append the file extension if it's not already present and display it in the file name entry field appendExtension(myFilename, newOut); + change_path(myFilename); } } -- cgit v1.2.3 From c5b0b577134ed7c2df538ed019a6c07cb75bf38e Mon Sep 17 00:00:00 2001 From: Maximilian Albert Date: Fri, 7 Aug 2009 09:31:39 +0000 Subject: Store last used paths separately for the 'Save as ...' and 'Save a copy ...' dialogs and remember the last used file types in each case (closes LP #184655 and perhaps others; LP #386292 was fixed by the previous commit). (bzr r8432) --- src/file.cpp | 65 ++++++++++++++++++++++------------ src/preferences-skeleton.h | 3 +- src/ui/dialog/filedialog.cpp | 13 +++---- src/ui/dialog/filedialog.h | 3 +- src/ui/dialog/filedialogimpl-gtkmm.cpp | 30 +++++++++++----- src/ui/dialog/filedialogimpl-gtkmm.h | 16 ++++++--- src/ui/dialog/filedialogimpl-win32.cpp | 5 +-- src/ui/dialog/filedialogimpl-win32.h | 7 ++-- 8 files changed, 93 insertions(+), 49 deletions(-) (limited to 'src') diff --git a/src/file.cpp b/src/file.cpp index 049c1acb4..f16d87cbd 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -711,9 +711,9 @@ sp_file_save_dialog(Gtk::Window &parentWindow, SPDocument *doc, bool is_copy) //# Get the default extension name Glib::ustring default_extension; - char *attr = (char *)repr->attribute("inkscape:output_extension"); + char *attr = (char *)repr->attribute(is_copy ? "inkscape:output_extension_copy" : "inkscape:output_extension"); if (!attr) { - Glib::ustring attr2 = prefs->getString("/dialogs/save_as/default"); + Glib::ustring attr2 = prefs->getString(is_copy ? "/dialogs/save_copy/default" : "/dialogs/save_as/default"); if(!attr2.empty()) default_extension = attr2; } else { default_extension = attr; @@ -723,18 +723,24 @@ sp_file_save_dialog(Gtk::Window &parentWindow, SPDocument *doc, bool is_copy) Glib::ustring save_path; Glib::ustring save_loc; - if (doc->uri == NULL) { - char formatBuf[256]; - int i = 1; - - Glib::ustring filename_extension = ".svg"; + if (!default_extension.empty()) { extension = dynamic_cast (Inkscape::Extension::db.get(default_extension.c_str())); + } else { + g_warning ("No default extension!!!! What to do?\n"); + } + + if (doc->uri && !is_copy) { + // Saving as a regular file: recover the filename from the existing doc->uri + save_loc = Glib::build_filename(Glib::path_get_dirname(doc->uri), + Glib::path_get_basename(doc->uri)); + } else { + Glib::ustring filename_extension = ".svg"; //g_warning("%s: extension ptr: 0x%x", __FUNCTION__, (unsigned int)extension); if (extension) filename_extension = extension->get_extension(); - Glib::ustring attr3 = prefs->getString("/dialogs/save_as/path"); + Glib::ustring attr3 = prefs->getString(is_copy ? "/dialogs/save_copy/path" : "/dialogs/save_as/path"); if (!attr3.empty()) save_path = attr3; @@ -747,18 +753,30 @@ sp_file_save_dialog(Gtk::Window &parentWindow, SPDocument *doc, bool is_copy) save_loc = save_path; save_loc.append(G_DIR_SEPARATOR_S); - snprintf(formatBuf, 255, _("drawing%s"), filename_extension.c_str()); - save_loc.append(formatBuf); - while (Inkscape::IO::file_test(save_loc.c_str(), G_FILE_TEST_EXISTS)) { - save_loc = save_path; - save_loc.append(G_DIR_SEPARATOR_S); - snprintf(formatBuf, 255, _("drawing-%d%s"), i++, filename_extension.c_str()); + char formatBuf[256]; + int i = 1; + if (!doc->uri) { + // We are saving for the first time; create a unique default filename + snprintf(formatBuf, 255, _("drawing%s"), filename_extension.c_str()); save_loc.append(formatBuf); + + while (Inkscape::IO::file_test(save_loc.c_str(), G_FILE_TEST_EXISTS)) { + save_loc = save_path; + save_loc.append(G_DIR_SEPARATOR_S); + snprintf(formatBuf, 255, _("drawing-%d%s"), i++, filename_extension.c_str()); + save_loc.append(formatBuf); + } + } else { + if (is_copy) { + // Use the document uri's base name as the filename but + // store in the directory last used for "Save a copy ..." + snprintf(formatBuf, 255, _("%s"), Glib::path_get_basename(doc->uri).c_str()); + save_loc.append(formatBuf); + } else { + g_assert_not_reached(); + } } - } else { - save_loc = Glib::build_filename(Glib::path_get_dirname(doc->uri), - Glib::path_get_basename(doc->uri)); } // convert save_loc from utf-8 to locale @@ -784,7 +802,8 @@ sp_file_save_dialog(Gtk::Window &parentWindow, SPDocument *doc, bool is_copy) Inkscape::UI::Dialog::SVG_TYPES, dialog_title, default_extension, - doc_title ? doc_title : "" + doc_title ? doc_title : "", + is_copy ); saveDialog->setSelectionType(extension); @@ -823,7 +842,7 @@ sp_file_save_dialog(Gtk::Window &parentWindow, SPDocument *doc, bool is_copy) save_path = Glib::path_get_dirname(fileName); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setString("/dialogs/save_as/path", save_path); + prefs->setString(is_copy ? "/dialogs/save_copy/path" : "/dialogs/save_as/path", save_path); return success; } @@ -1144,9 +1163,9 @@ sp_file_export_dialog(void *widget) //# Get the default extension name Glib::ustring default_extension; - char *attr = (char *)repr->attribute("inkscape:output_extension"); + char *attr = (char *)repr->attribute("inkscape:output_extension_export"); if (!attr) { - Glib::ustring attr2 = prefs->getString("/dialogs/save_as/default"); + Glib::ustring attr2 = prefs->getString("/dialogs/save_export/default"); if(!attr2.empty()) default_extension = attr2; } else { default_extension = attr; @@ -1164,7 +1183,7 @@ sp_file_export_dialog(void *widget) if (extension) filename_extension = extension->get_extension(); - Glib::ustring attr3 = prefs->getString("/dialogs/save_as/path"); + Glib::ustring attr3 = prefs->getString("/dialogs/save_export/path"); if (!attr3.empty()) export_path = attr3; @@ -1232,7 +1251,7 @@ sp_file_export_dialog(void *widget) } export_path = fileName; - prefs->setString("/dialogs/save_as/path", export_path); + prefs->setString("/dialogs/save_export/path", export_path); return success; } diff --git a/src/preferences-skeleton.h b/src/preferences-skeleton.h index 21bacd5a4..db21697ca 100644 --- a/src/preferences-skeleton.h +++ b/src/preferences-skeleton.h @@ -179,11 +179,12 @@ static char const preferences_skeleton[] = " \n" " \n" " \n" -" \n" +" \n" " \n" " \n" " \n" " \n" +" \n" " \n" " \n" " \n" diff --git a/src/ui/dialog/filedialog.cpp b/src/ui/dialog/filedialog.cpp index 172edf8a5..b1385195f 100644 --- a/src/ui/dialog/filedialog.cpp +++ b/src/ui/dialog/filedialog.cpp @@ -105,16 +105,17 @@ Glib::ustring FileOpenDialog::getFilename() * Public factory method. Used in file.cpp */ FileSaveDialog *FileSaveDialog::create(Gtk::Window& parentWindow, - const Glib::ustring &path, + const Glib::ustring &path, FileDialogType fileTypes, const char *title, const Glib::ustring &default_key, - const gchar *docTitle) + const gchar *docTitle, + const bool save_copy) { #ifdef WIN32 - FileSaveDialog *dialog = new FileSaveDialogImplWin32(parentWindow, path, fileTypes, title, default_key, docTitle); + FileSaveDialog *dialog = new FileSaveDialogImplWin32(parentWindow, path, fileTypes, title, default_key, docTitle, save_copy); #else - FileSaveDialog *dialog = new FileSaveDialogImplGtk(parentWindow, path, fileTypes, title, default_key, docTitle); + FileSaveDialog *dialog = new FileSaveDialogImplGtk(parentWindow, path, fileTypes, title, default_key, docTitle, save_copy); #endif return dialog; } @@ -168,8 +169,8 @@ void FileSaveDialog::appendExtension(Glib::ustring& path, Inkscape::Extension::O /** * Public factory method. Used in file.cpp */ - FileExportDialog *FileExportDialog::create(Gtk::Window& parentWindow, - const Glib::ustring &path, +FileExportDialog *FileExportDialog::create(Gtk::Window& parentWindow, + const Glib::ustring &path, FileDialogType fileTypes, const char *title, const Glib::ustring &default_key) diff --git a/src/ui/dialog/filedialog.h b/src/ui/dialog/filedialog.h index 52dcd1b23..6eab75a5b 100644 --- a/src/ui/dialog/filedialog.h +++ b/src/ui/dialog/filedialog.h @@ -163,7 +163,8 @@ public: FileDialogType fileTypes, const char *title, const Glib::ustring &default_key, - const gchar *docTitle); + const gchar *docTitle, + const bool save_copy); /** diff --git a/src/ui/dialog/filedialogimpl-gtkmm.cpp b/src/ui/dialog/filedialogimpl-gtkmm.cpp index 749a67b28..53faa075a 100644 --- a/src/ui/dialog/filedialogimpl-gtkmm.cpp +++ b/src/ui/dialog/filedialogimpl-gtkmm.cpp @@ -883,8 +883,10 @@ FileSaveDialogImplGtk::FileSaveDialogImplGtk( Gtk::Window &parentWindow, FileDialogType fileTypes, const Glib::ustring &title, const Glib::ustring &/*default_key*/, - const gchar* docTitle) : - FileDialogBaseGtk(parentWindow, title, Gtk::FILE_CHOOSER_ACTION_SAVE, fileTypes, "/dialogs/save_as") + const gchar* docTitle, + const bool save_copy) : + FileDialogBaseGtk(parentWindow, title, Gtk::FILE_CHOOSER_ACTION_SAVE, fileTypes, save_copy ? "/dialogs/save_copy" : "/dialogs/save_as"), + is_copy(save_copy) { FileSaveDialog::myDocTitle = docTitle; @@ -922,7 +924,11 @@ FileSaveDialogImplGtk::FileSaveDialogImplGtk( Gtk::Window &parentWindow, //###### Do we want the .xxx extension automatically added? Inkscape::Preferences *prefs = Inkscape::Preferences::get(); fileTypeCheckbox.set_label(Glib::ustring(_("Append filename extension automatically"))); - fileTypeCheckbox.set_active(prefs->getBool("/dialogs/save_as/append_extension", true)); + if (save_copy) { + fileTypeCheckbox.set_active(prefs->getBool("/dialogs/save_copy/append_extension", true)); + } else { + fileTypeCheckbox.set_active(prefs->getBool("/dialogs/save_as/append_extension", true)); + } createFileTypeMenu(); fileTypeComboBox.set_size_request(200,40); @@ -1109,10 +1115,18 @@ FileSaveDialogImplGtk::show() Inkscape::Preferences *prefs = Inkscape::Preferences::get(); // Store changes of the "Append filename automatically" checkbox back to preferences. - prefs->setBool("/dialogs/save_as/append_extension", fileTypeCheckbox.get_active()); + if (is_copy) { + prefs->setBool("/dialogs/save_copy/append_extension", fileTypeCheckbox.get_active()); + } else { + prefs->setBool("/dialogs/save_as/append_extension", fileTypeCheckbox.get_active()); + } // Store the last used save-as filetype to preferences. - prefs->setString("/dialogs/save_as/default", ( extension != NULL ? extension->get_id() : "" )); + if (is_copy) { + prefs->setString("/dialogs/save_copy/default", ( extension != NULL ? extension->get_id() : "" )); + } else { + prefs->setString("/dialogs/save_as/default", ( extension != NULL ? extension->get_id() : "" )); + } cleanup( true ); @@ -1356,7 +1370,7 @@ FileExportDialogImpl::FileExportDialogImpl( Gtk::Window& parentWindow, destDPISpinner("DPI", _("Resolution (dots per inch)")) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - append_extension = prefs->getBool("/dialogs/save_as/append_extension", true); + append_extension = prefs->getBool("/dialogs/save_export/append_extension", true); /* One file at a time */ set_select_multiple(false); @@ -1566,8 +1580,8 @@ FileExportDialogImpl::show() append_extension = checkbox.get_active(); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setBool("/dialogs/save_as/append_extension", append_extension); - prefs->setBool("/dialogs/save_as/default", ( extension != NULL ? extension->get_id() : "" )); + prefs->setBool("/dialogs/save_export/append_extension", append_extension); + prefs->setBool("/dialogs/save_export/default", ( extension != NULL ? extension->get_id() : "" )); */ return TRUE; } diff --git a/src/ui/dialog/filedialogimpl-gtkmm.h b/src/ui/dialog/filedialogimpl-gtkmm.h index 90dddce59..2a37aed2b 100644 --- a/src/ui/dialog/filedialogimpl-gtkmm.h +++ b/src/ui/dialog/filedialogimpl-gtkmm.h @@ -281,11 +281,12 @@ class FileSaveDialogImplGtk : public FileSaveDialog, public FileDialogBaseGtk public: FileSaveDialogImplGtk(Gtk::Window &parentWindow, - const Glib::ustring &dir, - FileDialogType fileTypes, - const Glib::ustring &title, - const Glib::ustring &default_key, - const gchar* docTitle); + const Glib::ustring &dir, + FileDialogType fileTypes, + const Glib::ustring &title, + const Glib::ustring &default_key, + const gchar* docTitle, + const bool save_copy); virtual ~FileSaveDialogImplGtk(); @@ -301,6 +302,11 @@ private: void change_path(const Glib::ustring& path); void updateNameAndExtension(); + /** + * Whether the dialog was invoked by "Save as ..." or "Save a copy ..." + */ + bool is_copy; + /** * Fix to allow the user to type the file name */ diff --git a/src/ui/dialog/filedialogimpl-win32.cpp b/src/ui/dialog/filedialogimpl-win32.cpp index 0d8f0de5f..c703d3c75 100644 --- a/src/ui/dialog/filedialogimpl-win32.cpp +++ b/src/ui/dialog/filedialogimpl-win32.cpp @@ -1497,8 +1497,9 @@ FileSaveDialogImplWin32::FileSaveDialogImplWin32(Gtk::Window &parent, FileDialogType fileTypes, const char *title, const Glib::ustring &/*default_key*/, - const char *docTitle) : - FileDialogBaseWin32(parent, dir, title, fileTypes, "dialogs.save_as"), + const char *docTitle, + const bool save_copy) : + FileDialogBaseWin32(parent, dir, title, fileTypes, save_copy ? "dialogs.save_copy" : "dialogs.save_as"), _title_label(NULL), _title_edit(NULL) { diff --git a/src/ui/dialog/filedialogimpl-win32.h b/src/ui/dialog/filedialogimpl-win32.h index bb026169a..f75133fe3 100644 --- a/src/ui/dialog/filedialogimpl-win32.h +++ b/src/ui/dialog/filedialogimpl-win32.h @@ -120,9 +120,10 @@ public: /// @param title The title caption for the dialog in UTF-8 /// @param type The dialog type FileOpenDialogImplWin32(Gtk::Window &parent, - const Glib::ustring &dir, - FileDialogType fileTypes, - const char *title); + const Glib::ustring &dir, + FileDialogType fileTypes, + const char *title, + const bool save_copy); /// Destructor virtual ~FileOpenDialogImplWin32(); -- cgit v1.2.3 From 3ac70a59262fb8b1fafe189174ebff1e5a150223 Mon Sep 17 00:00:00 2001 From: Maximilian Albert Date: Fri, 7 Aug 2009 11:27:22 +0000 Subject: Fix compile on windows (bzr r8434) --- src/ui/dialog/filedialogimpl-win32.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/ui/dialog/filedialogimpl-win32.h b/src/ui/dialog/filedialogimpl-win32.h index f75133fe3..f74d9fccf 100644 --- a/src/ui/dialog/filedialogimpl-win32.h +++ b/src/ui/dialog/filedialogimpl-win32.h @@ -122,8 +122,7 @@ public: FileOpenDialogImplWin32(Gtk::Window &parent, const Glib::ustring &dir, FileDialogType fileTypes, - const char *title, - const bool save_copy); + const char *title); /// Destructor virtual ~FileOpenDialogImplWin32(); @@ -307,11 +306,12 @@ class FileSaveDialogImplWin32 : public FileSaveDialog, public FileDialogBaseWin3 public: FileSaveDialogImplWin32(Gtk::Window &parent, - const Glib::ustring &dir, - FileDialogType fileTypes, - const char *title, - const Glib::ustring &default_key, - const char *docTitle); + const Glib::ustring &dir, + FileDialogType fileTypes, + const char *title, + const Glib::ustring &default_key, + const char *docTitle, + const bool save_copy); /// Destructor virtual ~FileSaveDialogImplWin32(); -- cgit v1.2.3 From 0ff8eef7cfad92189e1d624a2b3ae449be64e891 Mon Sep 17 00:00:00 2001 From: Maximilian Albert Date: Fri, 7 Aug 2009 12:32:06 +0000 Subject: Report complete paths when doing an emergency save (closes LP #171392) (bzr r8436) --- src/inkscape.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/inkscape.cpp b/src/inkscape.cpp index 60ab895ed..01e11a916 100644 --- a/src/inkscape.cpp +++ b/src/inkscape.cpp @@ -634,6 +634,7 @@ inkscape_crash_handler (int /*signum*/) gchar * location = homedir_path(c); Inkscape::IO::dump_fopen_call(location, "E"); file = Inkscape::IO::fopen_utf8name(location, "w"); + g_snprintf (c, 1024, "%s", location); // we want the complete path to be stored in c (for reporting purposes) g_free(location); if (!file) { // try saving to /tmp @@ -643,9 +644,14 @@ inkscape_crash_handler (int /*signum*/) } if (!file) { // try saving to the current directory + gchar *curdir = g_get_current_dir(); g_snprintf (c, 1024, "inkscape-%.256s.%s.%d.svg", docname, sptstr, count); Inkscape::IO::dump_fopen_call(c, "F"); file = Inkscape::IO::fopen_utf8name(c, "w"); + // store the complete path in c so that it can be reported later + gchar * location = g_build_filename(curdir, c, NULL); + g_snprintf (c, 1024, "%s", location); + g_free(location); } if (file) { sp_repr_save_stream (repr->document(), file, SP_SVG_NS_URI); -- cgit v1.2.3 From 6b9887038db4d4569d33c75557424fdc16e976e6 Mon Sep 17 00:00:00 2001 From: Maximilian Albert Date: Fri, 7 Aug 2009 12:47:43 +0000 Subject: Clarify tooltip (bzr r8437) --- src/ui/dialog/inkscape-preferences.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index a81446a03..7275165a7 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -1271,7 +1271,7 @@ void InkscapePreferences::initPageMisc() _misc_simpl.init("/options/simplifythreshold/value", 0.0001, 1.0, 0.0001, 0.0010, 0.0010, false, false); _page_misc.add_line( false, _("Simplification threshold:"), _misc_simpl, "", - _("How strong is the Simplify command by default. If you invoke this command several times in quick succession, it will act more and more aggressively; invoking it again after a pause restores the default threshold."), false); + _("How strong is the Node tool's Simplify command by default. If you invoke this command several times in quick succession, it will act more and more aggressively; invoking it again after a pause restores the default threshold."), false); _misc_latency_skew.init("/debug/latency/skew", 0.5, 2.0, 0.01, 0.10, 1.0, false, false); _page_misc.add_line( false, _("Latency skew:"), _misc_latency_skew, _("(requires restart)"), -- cgit v1.2.3 From 63d1a47c13905391b0c3ee3e72ee8df74fbf012a Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Fri, 7 Aug 2009 12:53:15 +0000 Subject: Change "canvas" to "page" to be consistent with use in all other dialogs and menus. '-C' is kept, as '-P' is used for PostScript export. (bzr r8438) --- src/extension/internal/cairo-ps-out.cpp | 16 +++++----- src/extension/internal/cairo-renderer-pdf-out.cpp | 4 +-- src/main.cpp | 38 +++++++++++------------ 3 files changed, 29 insertions(+), 29 deletions(-) (limited to 'src') diff --git a/src/extension/internal/cairo-ps-out.cpp b/src/extension/internal/cairo-ps-out.cpp index 209d1e9b9..9ac19326f 100644 --- a/src/extension/internal/cairo-ps-out.cpp +++ b/src/extension/internal/cairo-ps-out.cpp @@ -156,9 +156,9 @@ CairoPsOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar con new_bitmapResolution = mod->get_param_int("resolution"); } catch(...) {} - bool new_areaCanvas = true; + bool new_areaPage = true; try { - new_areaCanvas = mod->get_param_bool("areaCanvas"); + new_areaPage = mod->get_param_bool("areaPage"); } catch(...) {} bool new_areaDrawing = true; @@ -173,7 +173,7 @@ CairoPsOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar con gchar * final_name; final_name = g_strdup_printf("> %s", filename); - ret = ps_print_document_to_file(doc, final_name, level, new_textToPath, new_blurToBitmap, new_bitmapResolution, new_exportId, new_areaDrawing, new_areaCanvas); + ret = ps_print_document_to_file(doc, final_name, level, new_textToPath, new_blurToBitmap, new_bitmapResolution, new_exportId, new_areaDrawing, new_areaPage); g_free(final_name); if (!ret) @@ -220,9 +220,9 @@ CairoEpsOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar co new_bitmapResolution = mod->get_param_int("resolution"); } catch(...) {} - bool new_areaCanvas = true; + bool new_areaPage = true; try { - new_areaCanvas = mod->get_param_bool("areaCanvas"); + new_areaPage = mod->get_param_bool("areaPage"); } catch(...) {} bool new_areaDrawing = true; @@ -237,7 +237,7 @@ CairoEpsOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar co gchar * final_name; final_name = g_strdup_printf("> %s", filename); - ret = ps_print_document_to_file(doc, final_name, level, new_textToPath, new_blurToBitmap, new_bitmapResolution, new_exportId, new_areaDrawing, new_areaCanvas, true); + ret = ps_print_document_to_file(doc, final_name, level, new_textToPath, new_blurToBitmap, new_bitmapResolution, new_exportId, new_areaDrawing, new_areaPage, true); g_free(final_name); if (!ret) @@ -283,7 +283,7 @@ CairoPsOutput::init (void) "true\n" "90\n" "true\n" - "true\n" + "true\n" "\n" "\n" ".ps\n" @@ -320,7 +320,7 @@ CairoEpsOutput::init (void) "true\n" "90\n" "true\n" - "true\n" + "true\n" "\n" "\n" ".eps\n" diff --git a/src/extension/internal/cairo-renderer-pdf-out.cpp b/src/extension/internal/cairo-renderer-pdf-out.cpp index b8af3b177..0598c388a 100644 --- a/src/extension/internal/cairo-renderer-pdf-out.cpp +++ b/src/extension/internal/cairo-renderer-pdf-out.cpp @@ -180,7 +180,7 @@ CairoRendererPdfOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, bool new_exportCanvas = FALSE; try { - new_exportCanvas = mod->get_param_bool("areaCanvas"); + new_exportCanvas = mod->get_param_bool("areaPage"); } catch(...) { g_warning("Parameter might not exist"); @@ -220,7 +220,7 @@ CairoRendererPdfOutput::init (void) "true\n" "90\n" "false\n" - "false\n" + "false\n" "\n" "\n" ".pdf\n" diff --git a/src/main.cpp b/src/main.cpp index 9c33688ed..12732ef2c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -129,7 +129,7 @@ enum { SP_ARG_EXPORT_DPI, SP_ARG_EXPORT_AREA, SP_ARG_EXPORT_AREA_DRAWING, - SP_ARG_EXPORT_AREA_CANVAS, + SP_ARG_EXPORT_AREA_PAGE, SP_ARG_EXPORT_AREA_SNAP, SP_ARG_EXPORT_WIDTH, SP_ARG_EXPORT_HEIGHT, @@ -179,7 +179,7 @@ static gchar *sp_export_png = NULL; static gchar *sp_export_dpi = NULL; static gchar *sp_export_area = NULL; static gboolean sp_export_area_drawing = FALSE; -static gboolean sp_export_area_canvas = FALSE; +static gboolean sp_export_area_page = FALSE; static gchar *sp_export_width = NULL; static gchar *sp_export_height = NULL; static gchar *sp_export_id = NULL; @@ -222,7 +222,7 @@ static void resetCommandlineGlobals() { sp_export_dpi = NULL; sp_export_area = NULL; sp_export_area_drawing = FALSE; - sp_export_area_canvas = FALSE; + sp_export_area_page = FALSE; sp_export_width = NULL; sp_export_height = NULL; sp_export_id = NULL; @@ -296,17 +296,17 @@ struct poptOption options[] = { {"export-area", 'a', POPT_ARG_STRING, &sp_export_area, SP_ARG_EXPORT_AREA, - N_("Exported area in SVG user units (default is the canvas; 0,0 is lower-left corner)"), + N_("Exported area in SVG user units (default is the page; 0,0 is lower-left corner)"), N_("x0:y0:x1:y1")}, {"export-area-drawing", 'D', POPT_ARG_NONE, &sp_export_area_drawing, SP_ARG_EXPORT_AREA_DRAWING, - N_("Exported area is the entire drawing (not canvas)"), + N_("Exported area is the entire drawing (not page)"), NULL}, - {"export-area-canvas", 'C', - POPT_ARG_NONE, &sp_export_area_canvas, SP_ARG_EXPORT_AREA_CANVAS, - N_("Exported area is the entire canvas"), + {"export-area-page", 'C', + POPT_ARG_NONE, &sp_export_area_page, SP_ARG_EXPORT_AREA_PAGE, + N_("Exported area is the entire page"), NULL}, {"export-area-snap", 0, @@ -632,7 +632,7 @@ main(int argc, char **argv) || !strcmp(argv[i], "-i") || !strncmp(argv[i], "--export-area-drawing", 21) || !strcmp(argv[i], "-D") - || !strncmp(argv[i], "--export-area-canvas", 20) + || !strncmp(argv[i], "--export-area-page", 20) || !strcmp(argv[i], "-C") || !strncmp(argv[i], "--export-id", 12) || !strcmp(argv[i], "-P") @@ -1298,8 +1298,8 @@ sp_do_export_png(SPDocument *doc) return; } area = Geom::Rect(Geom::Interval(x0,x1), Geom::Interval(y0,y1)); - } else if (sp_export_area_canvas || !(sp_export_id || sp_export_area_drawing)) { - /* Export the whole canvas */ + } else if (sp_export_area_page || !(sp_export_id || sp_export_area_drawing)) { + /* Export the whole page: note: Inkscape uses 'page' in all menus and dialogs, not 'canvas' */ sp_document_ensure_up_to_date (doc); Geom::Point origin (SP_ROOT(doc->root)->x.computed, SP_ROOT(doc->root)->y.computed); area = Geom::Rect(origin, origin + sp_document_dimensions(doc)); @@ -1443,8 +1443,8 @@ static void do_export_ps_pdf(SPDocument* doc, gchar const* uri, char const* mime (*i)->set_param_string ("exportId", ""); } - if (sp_export_area_canvas && sp_export_area_drawing) { - g_warning ("You cannot use --export-area-canvas and --export-area-drawing at the same time; only the former will take effect."); + if (sp_export_area_page && sp_export_area_drawing) { + g_warning ("You cannot use --export-area-page and --export-area-drawing at the same time; only the former will take effect."); sp_export_area_drawing = false; } @@ -1454,17 +1454,17 @@ static void do_export_ps_pdf(SPDocument* doc, gchar const* uri, char const* mime (*i)->set_param_bool ("areaDrawing", FALSE); } - if (sp_export_area_canvas) { + if (sp_export_area_page) { if (sp_export_eps) { - g_warning ("EPS cannot have its bounding box extend beyond its content, so if your drawing is smaller than the canvas, --export-area-canvas will clip it to drawing."); + g_warning ("EPS cannot have its bounding box extend beyond its content, so if your drawing is smaller than the page, --export-area-page will clip it to drawing."); } - (*i)->set_param_bool ("areaCanvas", TRUE); + (*i)->set_param_bool ("areaPage", TRUE); } else { - (*i)->set_param_bool ("areaCanvas", FALSE); + (*i)->set_param_bool ("areaPage", FALSE); } - if (!sp_export_area_drawing && !sp_export_area_canvas && !sp_export_id) { - // neither is set, set canvas as default for ps/pdf and drawing for eps + if (!sp_export_area_drawing && !sp_export_area_page && !sp_export_id) { + // neither is set, set page as default for ps/pdf and drawing for eps if (sp_export_eps) { try { (*i)->set_param_bool("areaDrawing", TRUE); -- cgit v1.2.3 From 52d2a4f66aff977d17092bb105d327d978f51470 Mon Sep 17 00:00:00 2001 From: theAdib Date: Sat, 8 Aug 2009 22:28:01 +0000 Subject: add additional files for win32 distribution (bzr r8447) --- src/Makefile.am | 1 + src/bind/Makefile_insert | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index bc5b2d839..fb876f231 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -195,6 +195,7 @@ EXTRA_DIST = \ traits/function.h \ traits/list-copy.h \ traits/reference.h \ + show-preview.bmp \ $(jabber_whiteboard_SOURCES) \ $(CXXTEST_TEMPLATE) diff --git a/src/bind/Makefile_insert b/src/bind/Makefile_insert index e91ff47f5..b640957d3 100644 --- a/src/bind/Makefile_insert +++ b/src/bind/Makefile_insert @@ -6,4 +6,6 @@ ink_common_sources += \ bind/javabind.cpp \ bind/dobinding.cpp \ bind/javainc/jni.h \ - bind/javainc/linux/jni_md.h + bind/javainc/linux/jni_md.h \ + bind/javainc/solaris/jni_md.h \ + bind/javainc/win32/jni_md.h -- cgit v1.2.3 From ee832838951cb097685f88478d896db2a35f0efb Mon Sep 17 00:00:00 2001 From: Diederik van Lierop Date: Sun, 9 Aug 2009 09:02:00 +0000 Subject: When snapping while translating, use the bounding box corners of each selected item instead of the selection as a whole (fixes bug #404941) (bzr r8449) --- src/select-context.cpp | 2 +- src/seltrans.cpp | 253 +++++++++++++++++++++++++++++-------------------- src/seltrans.h | 5 +- 3 files changed, 153 insertions(+), 107 deletions(-) (limited to 'src') diff --git a/src/select-context.cpp b/src/select-context.cpp index a5f5202ae..606934ca6 100644 --- a/src/select-context.cpp +++ b/src/select-context.cpp @@ -535,7 +535,7 @@ sp_select_context_root_handler(SPEventContext *event_context, GdkEvent *event) if (item_at_point && !selection->includes(item_at_point)) selection->set(item_at_point); } // otherwise, do not change selection so that dragging selected-within-group items, as well as alt-dragging, is possible - seltrans->grab(p, -1, -1, FALSE); + seltrans->grab(p, -1, -1, FALSE, TRUE); sc->moved = TRUE; } if (!seltrans->isEmpty()) diff --git a/src/seltrans.cpp b/src/seltrans.cpp index c3c841149..8f060725b 100644 --- a/src/seltrans.cpp +++ b/src/seltrans.cpp @@ -241,8 +241,10 @@ void Inkscape::SelTrans::setCenter(Geom::Point const &p) _updateHandles(); } -void Inkscape::SelTrans::grab(Geom::Point const &p, gdouble x, gdouble y, bool show_handles) +void Inkscape::SelTrans::grab(Geom::Point const &p, gdouble x, gdouble y, bool show_handles, bool translating) { + // While dragging a handle, we will either scale, skew, or rotate and the "translating" parameter will be false + // When dragging the selected item itself however, we will translate the selection and that parameter will be true Inkscape::Selection *selection = sp_desktop_selection(_desktop); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); @@ -273,10 +275,11 @@ void Inkscape::SelTrans::grab(Geom::Point const &p, gdouble x, gdouble y, bool s // The selector tool should snap the bbox, special snappoints, and path nodes // (The special points are the handles, center, rotation axis, font baseline, ends of spiral, etc.) - // First, determine the bounding box for snapping ... + // First, determine the bounding box _bbox = selection->bounds(_snap_bbox_type); _approximate_bbox = selection->bounds(SPItem::APPROXIMATE_BBOX); // Used for correctly scaling the strokewidth _geometric_bbox = selection->bounds(SPItem::GEOMETRIC_BBOX); + _point = p; if (_geometric_bbox) { _point_geom = _geometric_bbox->min() + _geometric_bbox->dimensions() * Geom::Scale(x, y); @@ -286,31 +289,31 @@ void Inkscape::SelTrans::grab(Geom::Point const &p, gdouble x, gdouble y, bool s // Next, get all points to consider for snapping SnapManager const &m = _desktop->namedview->snap_manager; - Inkscape::SnapPreferences local_snapprefs = m.snapprefs; - local_snapprefs.setSnapToItemNode(true); // We should get at least the cusp nodes here. This might - // have been turned off because (for example) the user only want paths as a snap target, not nodes - // but as a snap source we still need some nodes though! + Inkscape::SnapPreferences local_snapprefs = m.snapprefs; + local_snapprefs.setSnapToItemNode(true); // We should get at least the cusp nodes here. This might + // have been turned off because (for example) the user only want paths as a snap target, not nodes + // but as a snap source we still need some nodes though! _snap_points.clear(); - _snap_points = selection->getSnapPoints(&local_snapprefs); - std::vector > snap_points_hull = selection->getSnapPointsConvexHull(&local_snapprefs); - if (_snap_points.size() > 100) { - /* Snapping a huge number of nodes will take way too long, so limit the number of snappable nodes - An average user would rarely ever try to snap such a large number of nodes anyway, because - (s)he could hardly discern which node would be snapping */ - if (prefs->getBool("/options/snapclosestonly/value", false)) { - _keepClosestPointOnly(_snap_points, p); - } else { - _snap_points = snap_points_hull; - } - // Unfortunately, by now we will have lost the font-baseline snappoints :-( - } + _snap_points = selection->getSnapPoints(&local_snapprefs); + std::vector > snap_points_hull = selection->getSnapPointsConvexHull(&local_snapprefs); + if (_snap_points.size() > 200) { + /* Snapping a huge number of nodes will take way too long, so limit the number of snappable nodes + An average user would rarely ever try to snap such a large number of nodes anyway, because + (s)he could hardly discern which node would be snapping */ + if (prefs->getBool("/options/snapclosestonly/value", false)) { + _keepClosestPointOnly(_snap_points, p); + } else { + _snap_points = snap_points_hull; + } + // Unfortunately, by now we will have lost the font-baseline snappoints :-( + } // Find bbox hulling all special points, which excludes stroke width. Here we need to include the // path nodes, for example because a rectangle which has been converted to a path doesn't have // any other special points Geom::Rect snap_points_bbox; if ( snap_points_hull.empty() == false ) { - std::vector >::iterator i = snap_points_hull.begin(); + std::vector >::iterator i = snap_points_hull.begin(); snap_points_bbox = Geom::Rect((*i).first, (*i).first); i++; while (i != snap_points_hull.end()) { @@ -320,11 +323,29 @@ void Inkscape::SelTrans::grab(Geom::Point const &p, gdouble x, gdouble y, bool s } _bbox_points.clear(); + _bbox_points_for_translating.clear(); + // Collect the bounding box's corners and midpoints for each selected item + if (m.snapprefs.getSnapModeBBox()) { + bool mp = m.snapprefs.getSnapBBoxMidpoints(); + bool emp = m.snapprefs.getSnapBBoxEdgeMidpoints(); + // Preferably we'd use the bbox of each selected item, instead of the bbox of the selection as a whole; for translations + // this is easy to do, but when snapping the visual bbox while scaling we will have to compensate for the scaling of the + // stroke width. (see get_scale_transform_with_stroke()). This however is currently only implemented for a single bbox. + // That's why we have both _bbox_points_for_translating and _bbox_points. + getBBoxPoints(selection->bounds(_snap_bbox_type), &_bbox_points, false, true, emp, mp); + if ((_items.size() > 0) && (_items.size() < 50)) { // more than 50 items will produce at least 200 bbox points, which might + // make Inkscape crawl (see the comment a few lines above). In that case we will use the bbox of the selection + // as a whole + for (unsigned i = 0; i < _items.size(); i++) { + getBBoxPoints(sp_item_bbox_desktop(_items[i], _snap_bbox_type), &_bbox_points_for_translating, false, true, emp, mp); + } + } else { + _bbox_points_for_translating = _bbox_points; // use the bbox points of the selection as a whole + } + } + if (_bbox) { - if (m.snapprefs.getSnapModeBBox()) { - getBBoxPoints(_bbox, &_bbox_points, false, true, m.snapprefs.getSnapBBoxEdgeMidpoints(), m.snapprefs.getSnapBBoxMidpoints()); - } - // There are two separate "opposites" (i.e. opposite w.r.t. the handle being dragged): + // There are two separate "opposites" (i.e. opposite w.r.t. the handle being dragged): // - one for snapping the boundingbox, which can be either visual or geometric // - one for snapping the special points // The "opposite" in case of a geometric boundingbox always coincides with the "opposite" for the special points @@ -339,41 +360,65 @@ void Inkscape::SelTrans::grab(Geom::Point const &p, gdouble x, gdouble y, bool s // (i.e. when weight == 1), then we will not even try to snap to other points and discard those other // points immediately. - if (prefs->getBool("/options/snapclosestonly/value", false)) { - if (m.snapprefs.getSnapModeNode()) { - _keepClosestPointOnly(_snap_points, p); - } else { - _snap_points.clear(); // don't keep any point - } - - if (m.snapprefs.getSnapModeBBox()) { - _keepClosestPointOnly(_bbox_points, p); - } else { - _bbox_points.clear(); // don't keep any point - } - - g_assert(_bbox_points.size() < 2 && _snap_points.size() < 2); - if (_snap_points.size() == 1 && _bbox_points.size() == 1) { //both vectors can only have either one or zero elements - // So we have exactly one bbox corner and one node left; now find out which is closest and delete the other one - if (Geom::L2((_snap_points.at(0)).first - p) < Geom::L2((_bbox_points.at(0)).first - p)) { - _bbox_points.clear(); - } else { - _snap_points.clear(); - } - } - - // Optionally, show the snap source - if (!(_state == STATE_ROTATE && x != 0.5 && y != 0.5)) { // but not when we're draging a rotation handle, because that won't snap - // Now either _bbox_points or _snap_points has a single element, the other one has zero..... or both have zero elements - g_assert((_bbox_points.size() + _snap_points.size()) < 2); - if (m.snapprefs.getSnapEnabledGlobally()) { - if (_bbox_points.size() == 1) { - _desktop->snapindicator->set_new_snapsource(_bbox_points.at(0)); - } else if (_snap_points.size() == 1){ - _desktop->snapindicator->set_new_snapsource(_snap_points.at(0)); - } - } - } + if (prefs->getBool("/options/snapclosestonly/value", false)) { + if (m.snapprefs.getSnapModeNode()) { + _keepClosestPointOnly(_snap_points, p); + } else { + _snap_points.clear(); // don't keep any point + } + + if (m.snapprefs.getSnapModeBBox()) { + _keepClosestPointOnly(_bbox_points, p); + _keepClosestPointOnly(_bbox_points_for_translating, p); + } else { + _bbox_points.clear(); // don't keep any point + _bbox_points_for_translating.clear(); + } + + // Each of the three vectors of snappoints now contains either one snappoint or none at all. + if (_snap_points.size() > 1 || _bbox_points.size() > 1 || _bbox_points_for_translating.size() > 1) { + g_warning("Incorrect assumption encountered while finding the snap source; nothing serious, but please report to Diederik"); + } + + // Now let's reduce this to a single closest snappoint + Geom::Coord dsp = _snap_points.size() == 1 ? Geom::L2((_snap_points.at(0)).first - p) : NR_HUGE; + Geom::Coord dbbp = _bbox_points.size() == 1 ? Geom::L2((_bbox_points.at(0)).first - p) : NR_HUGE; + Geom::Coord dbbpft = _bbox_points_for_translating.size() == 1 ? Geom::L2((_bbox_points_for_translating.at(0)).first - p) : NR_HUGE; + + if (translating) { + _bbox_points.clear(); + if (dsp > dbbpft) { + _snap_points.clear(); + } else { + _bbox_points_for_translating.clear(); + } + } else { + _bbox_points_for_translating.clear(); + if (dsp > dbbp) { + _snap_points.clear(); + } else { + _bbox_points.clear(); + } + } + + if ((_snap_points.size() + _bbox_points.size() + _bbox_points_for_translating.size()) > 1) { + g_warning("Checking number of snap sources failed; nothing serious, but please report to Diederik"); + } + + // Optionally, show the snap source + if (!(_state == STATE_ROTATE && x != 0.5 && y != 0.5)) { // but not when we're dragging a rotation handle, because that won't snap + // Now either _bbox_points or _snap_points has a single element, the other one has zero..... or both have zero elements + g_assert((_snap_points.size() + _bbox_points.size() + _bbox_points_for_translating.size()) == 1); + if (m.snapprefs.getSnapEnabledGlobally()) { + if (_bbox_points.size() == 1) { + _desktop->snapindicator->set_new_snapsource(_bbox_points.at(0)); + } else if (_bbox_points_for_translating.size() == 1) { + _desktop->snapindicator->set_new_snapsource(_bbox_points_for_translating.at(0)); + } else if (_snap_points.size() == 1){ + _desktop->snapindicator->set_new_snapsource(_snap_points.at(0)); + } + } + } } if ((x != -1) && (y != -1)) { @@ -793,7 +838,7 @@ void Inkscape::SelTrans::handleGrab(SPKnot *knot, guint /*state*/, SPSelTransHan break; } - grab(sp_knot_position(knot), handle.x, handle.y, FALSE); + grab(sp_knot_position(knot), handle.x, handle.y, FALSE, FALSE); } @@ -1397,17 +1442,17 @@ void Inkscape::SelTrans::moveTo(Geom::Point const &xy, guint state) ** FIXME: this will snap to more than just the grid, nowadays. */ - m.setup(_desktop, true, _items_const); - m.freeSnapReturnByRef(SnapPreferences::SNAPPOINT_NODE, dxy, Inkscape::SNAPSOURCE_UNDEFINED); + m.setup(_desktop, true, _items_const); + m.freeSnapReturnByRef(SnapPreferences::SNAPPOINT_NODE, dxy, Inkscape::SNAPSOURCE_UNDEFINED); } else if (shift) { - if (control) { // shift & control: constrained movement without snapping - if (fabs(dxy[Geom::X]) > fabs(dxy[Geom::Y])) { - dxy[Geom::Y] = 0; - } else { - dxy[Geom::X] = 0; - } - } + if (control) { // shift & control: constrained movement without snapping + if (fabs(dxy[Geom::X]) > fabs(dxy[Geom::Y])) { + dxy[Geom::Y] = 0; + } else { + dxy[Geom::X] = 0; + } + } } else { //!shift: with snapping /* We're snapping to things, possibly with a constraint to horizontal or @@ -1415,9 +1460,9 @@ void Inkscape::SelTrans::moveTo(Geom::Point const &xy, guint state) ** pick the smallest. */ - m.setup(_desktop, false, _items_const); + m.setup(_desktop, false, _items_const); - /* This will be our list of possible translations */ + /* This will be our list of possible translations */ std::list s; if (control) { // constrained movement with snapping @@ -1425,36 +1470,36 @@ void Inkscape::SelTrans::moveTo(Geom::Point const &xy, guint state) /* Snap to things, and also constrain to horizontal or vertical movement */ unsigned int dim = fabs(dxy[Geom::X]) > fabs(dxy[Geom::Y]) ? Geom::X : Geom::Y; - // When doing a constrained translation, all points will move in the same direction, i.e. - // either horizontally or vertically. Therefore we only have to specify the direction of - // the constraint-line once. The constraint lines are parallel, but might not be colinear. - // Therefore we will have to set the point through which the constraint-line runs - // individually for each point to be snapped; this will be handled however by _snapTransformed() - s.push_back(m.constrainedSnapTranslation(Inkscape::SnapPreferences::SNAPPOINT_BBOX, - _bbox_points, - _point, - Inkscape::Snapper::ConstraintLine(component_vectors[dim]), - dxy)); - - s.push_back(m.constrainedSnapTranslation(Inkscape::SnapPreferences::SNAPPOINT_NODE, - _snap_points, - _point, - Inkscape::Snapper::ConstraintLine(component_vectors[dim]), - dxy)); + // When doing a constrained translation, all points will move in the same direction, i.e. + // either horizontally or vertically. Therefore we only have to specify the direction of + // the constraint-line once. The constraint lines are parallel, but might not be colinear. + // Therefore we will have to set the point through which the constraint-line runs + // individually for each point to be snapped; this will be handled however by _snapTransformed() + s.push_back(m.constrainedSnapTranslation(Inkscape::SnapPreferences::SNAPPOINT_BBOX, + _bbox_points_for_translating, + _point, + Inkscape::Snapper::ConstraintLine(component_vectors[dim]), + dxy)); + + s.push_back(m.constrainedSnapTranslation(Inkscape::SnapPreferences::SNAPPOINT_NODE, + _snap_points, + _point, + Inkscape::Snapper::ConstraintLine(component_vectors[dim]), + dxy)); } else { // !control // Let's leave this timer code here for a while. I'll probably need it in the near future (Diederik van Lierop) /* GTimeVal starttime; GTimeVal endtime; - g_get_current_time(&starttime); */ + g_get_current_time(&starttime); */ /* Snap to things with no constraint */ - s.push_back(m.freeSnapTranslation(Inkscape::SnapPreferences::SNAPPOINT_BBOX, _bbox_points, _point, dxy)); - s.push_back(m.freeSnapTranslation(Inkscape::SnapPreferences::SNAPPOINT_NODE, _snap_points, _point, dxy)); + s.push_back(m.freeSnapTranslation(Inkscape::SnapPreferences::SNAPPOINT_BBOX, _bbox_points_for_translating, _point, dxy)); + s.push_back(m.freeSnapTranslation(Inkscape::SnapPreferences::SNAPPOINT_NODE, _snap_points, _point, dxy)); - /*g_get_current_time(&endtime); - double elapsed = ((((double)endtime.tv_sec - starttime.tv_sec) * G_USEC_PER_SEC + (endtime.tv_usec - starttime.tv_usec))) / 1000.0; - std::cout << "Time spent snapping: " << elapsed << std::endl; */ + /*g_get_current_time(&endtime); + double elapsed = ((((double)endtime.tv_sec - starttime.tv_sec) * G_USEC_PER_SEC + (endtime.tv_usec - starttime.tv_usec))) / 1000.0; + std::cout << "Time spent snapping: " << elapsed << std::endl; */ } /* Pick one */ @@ -1592,21 +1637,21 @@ Geom::Point Inkscape::SelTrans::_calcAbsAffineGeom(Geom::Scale const geom_scale) void Inkscape::SelTrans::_keepClosestPointOnly(std::vector > &points, const Geom::Point &reference) { - if (points.size() < 2) return; + if (points.size() < 2) return; - std::pair closest_point = std::make_pair(Geom::Point(NR_HUGE, NR_HUGE), SNAPSOURCE_UNDEFINED); - Geom::Coord closest_dist = NR_HUGE; + std::pair closest_point = std::make_pair(Geom::Point(NR_HUGE, NR_HUGE), SNAPSOURCE_UNDEFINED); + Geom::Coord closest_dist = NR_HUGE; - for(std::vector >::const_iterator i = points.begin(); i != points.end(); i++) { - Geom::Coord dist = Geom::L2((*i).first - reference); - if (i == points.begin() || dist < closest_dist) { - closest_point = *i; - closest_dist = dist; - } + for(std::vector >::const_iterator i = points.begin(); i != points.end(); i++) { + Geom::Coord dist = Geom::L2((*i).first - reference); + if (i == points.begin() || dist < closest_dist) { + closest_point = *i; + closest_dist = dist; + } } - points.clear(); - points.push_back(closest_point); + points.clear(); + points.push_back(closest_point); } /* diff --git a/src/seltrans.h b/src/seltrans.h index 4f47d8e20..d0ac5dccf 100644 --- a/src/seltrans.h +++ b/src/seltrans.h @@ -53,7 +53,7 @@ public: void increaseState(); void resetState(); void setCenter(Geom::Point const &p); - void grab(Geom::Point const &p, gdouble x, gdouble y, bool show_handles); + void grab(Geom::Point const &p, gdouble x, gdouble y, bool show_handles, bool translating); void transform(Geom::Matrix const &rel_affine, Geom::Point const &norm); void ungrab(); void stamp(); @@ -118,7 +118,8 @@ private: std::vector _items_centers; std::vector > _snap_points; - std::vector > _bbox_points; + std::vector > _bbox_points; // the bbox point of the selection as a whole, i.e. max. 4 corners plus optionally some midpoints + std::vector > _bbox_points_for_translating; // the bbox points of each selected item, only to be used for translating Inkscape::SelCue _selcue; -- cgit v1.2.3 From eefa2f85383f1de298bbf40ca3a397f2bcb4efc1 Mon Sep 17 00:00:00 2001 From: Diederik van Lierop Date: Sun, 9 Aug 2009 12:11:19 +0000 Subject: When translating too many items, then don't use the bbox of the selection as a whole but instead use the closest corner of one of the individual bboxes instead. (bzr r8450) --- src/seltrans.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/seltrans.cpp b/src/seltrans.cpp index 8f060725b..359038527 100644 --- a/src/seltrans.cpp +++ b/src/seltrans.cpp @@ -333,9 +333,9 @@ void Inkscape::SelTrans::grab(Geom::Point const &p, gdouble x, gdouble y, bool s // stroke width. (see get_scale_transform_with_stroke()). This however is currently only implemented for a single bbox. // That's why we have both _bbox_points_for_translating and _bbox_points. getBBoxPoints(selection->bounds(_snap_bbox_type), &_bbox_points, false, true, emp, mp); - if ((_items.size() > 0) && (_items.size() < 50)) { // more than 50 items will produce at least 200 bbox points, which might - // make Inkscape crawl (see the comment a few lines above). In that case we will use the bbox of the selection - // as a whole + if (((_items.size() > 0) && (_items.size() < 50)) || prefs->getBool("/options/snapclosestonly/value", false)) { + // More than 50 items will produce at least 200 bbox points, which might make Inkscape crawl + // (see the comment a few lines above). In that case we will use the bbox of the selection as a whole for (unsigned i = 0; i < _items.size(); i++) { getBBoxPoints(sp_item_bbox_desktop(_items[i], _snap_bbox_type), &_bbox_points_for_translating, false, true, emp, mp); } -- cgit v1.2.3 From 606ebb35498c3d750bb2906954195baaa0fbcad6 Mon Sep 17 00:00:00 2001 From: Maximilian Albert Date: Sun, 9 Aug 2009 14:23:52 +0000 Subject: Fix remaining glitches in the behaviour of the Save dialogs (w.r.t. remembering the last file type and folder). As part of the cleanup inkscape:output_extension was removed, too. (bzr r8454) --- src/dialogs/export.cpp | 3 +- src/extension/implementation/script.cpp | 13 +-- src/extension/input.cpp | 13 --- src/extension/system.cpp | 102 ++++++++++++++++++++- src/extension/system.h | 53 ++++++++++- src/file.cpp | 157 ++++++++++++++------------------ src/file.h | 4 +- src/ui/dialog/filedialog.cpp | 6 +- src/ui/dialog/filedialog.h | 6 +- src/ui/dialog/filedialogimpl-gtkmm.cpp | 18 ++-- src/ui/dialog/filedialogimpl-gtkmm.h | 8 +- src/ui/dialog/filedialogimpl-win32.cpp | 5 +- src/ui/dialog/filedialogimpl-win32.h | 2 +- src/ui/view/edit-widget.cpp | 2 +- src/widgets/desktop-widget.cpp | 4 +- 15 files changed, 254 insertions(+), 142 deletions(-) (limited to 'src') diff --git a/src/dialogs/export.cpp b/src/dialogs/export.cpp index 0cde76657..835003e5e 100644 --- a/src/dialogs/export.cpp +++ b/src/dialogs/export.cpp @@ -540,8 +540,7 @@ sp_export_dialog (void) gchar *name; SPDocument * doc = SP_ACTIVE_DOCUMENT; const gchar *uri = SP_DOCUMENT_URI (doc); - Inkscape::XML::Node * repr = sp_document_repr_root(doc); - const gchar * text_extension = repr->attribute("inkscape:output_extension"); + const gchar *text_extension = Inkscape::Preferences::get()->getString("/dialogs/save_as/default").c_str(); Inkscape::Extension::Output * oextension = NULL; if (text_extension != NULL) { diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp index e6ce40bc0..5f1bef8d1 100644 --- a/src/extension/implementation/script.cpp +++ b/src/extension/implementation/script.cpp @@ -477,7 +477,7 @@ ScriptDocCache::ScriptDocCache (Inkscape::UI::View::View * view) : Inkscape::Extension::save( Inkscape::Extension::db.get(SP_MODULE_KEY_OUTPUT_SVG_INKSCAPE), - view->doc(), _filename.c_str(), false, false, false); + view->doc(), _filename.c_str(), false, false, false, Inkscape::Extension::FILE_SAVE_METHOD_TEMPORARY); return; } @@ -641,11 +641,13 @@ Script::save(Inkscape::Extension::Output *module, if (helper_extension.size() == 0) { Inkscape::Extension::save( Inkscape::Extension::db.get(SP_MODULE_KEY_OUTPUT_SVG_INKSCAPE), - doc, tempfilename_in.c_str(), false, false, false); + doc, tempfilename_in.c_str(), false, false, false, + Inkscape::Extension::FILE_SAVE_METHOD_TEMPORARY); } else { Inkscape::Extension::save( Inkscape::Extension::db.get(helper_extension.c_str()), - doc, tempfilename_in.c_str(), false, false, false); + doc, tempfilename_in.c_str(), false, false, false, + Inkscape::Extension::FILE_SAVE_METHOD_TEMPORARY); } @@ -714,8 +716,6 @@ Script::effect(Inkscape::Extension::Effect *module, SPDesktop *desktop = (SPDesktop *)doc; sp_namedview_document_from_window(desktop); - gchar * orig_output_extension = g_strdup(sp_document_repr_root(desktop->doc())->attribute("inkscape:output_extension")); - std::list params; module->paramListString(params); @@ -779,10 +779,7 @@ Script::effect(Inkscape::Extension::Effect *module, doc->doc()->emitReconstructionFinish(); mydoc->release(); sp_namedview_update_layers_from_document(desktop); - - sp_document_repr_root(desktop->doc())->setAttribute("inkscape:output_extension", orig_output_extension); } - g_free(orig_output_extension); return; } diff --git a/src/extension/input.cpp b/src/extension/input.cpp index 689c1286f..b4599dbd0 100644 --- a/src/extension/input.cpp +++ b/src/extension/input.cpp @@ -138,12 +138,6 @@ Input::check (void) from a file. The first thing that this does is make sure that the file actually exists. If it doesn't, a NULL is returned. If the file exits, then it is opened using the implmentation of this extension. - - After opening the document the output_extension is set. What this - accomplishes is that save can try to use an extension that supports - the same fileformat. So something like opening and saveing an - Adobe Illustrator file can be transparent (not recommended, but - transparent). This is all done with undo being turned off. */ SPDocument * Input::open (const gchar *uri) @@ -157,13 +151,6 @@ Input::open (const gchar *uri) timer->touch(); SPDocument *const doc = imp->open(this, uri); - if (doc != NULL) { - Inkscape::XML::Node * repr = sp_document_repr_root(doc); - bool saved = sp_document_get_undo_sensitive(doc); - sp_document_set_undo_sensitive (doc, false); - repr->setAttribute("inkscape:output_extension", output_extension); - sp_document_set_undo_sensitive (doc, saved); - } return doc; } diff --git a/src/extension/system.cpp b/src/extension/system.cpp index d7e0eebf3..2251ac7b6 100644 --- a/src/extension/system.cpp +++ b/src/extension/system.cpp @@ -20,6 +20,8 @@ #include +#include "system.h" +#include "preferences.h" #include "extension.h" #include "db.h" #include "input.h" @@ -184,7 +186,8 @@ open_internal(Extension *in_plug, gpointer in_data) * Lastly, the save function is called in the module itself. */ void -save(Extension *key, SPDocument *doc, gchar const *filename, bool setextension, bool check_overwrite, bool official) +save(Extension *key, SPDocument *doc, gchar const *filename, bool setextension, bool check_overwrite, bool official, + Inkscape::Extension::FileSaveMethod save_method) { Output *omod; if (key == NULL) { @@ -254,7 +257,7 @@ save(Extension *key, SPDocument *doc, gchar const *filename, bool setextension, gchar *saved_output_extension = NULL; gchar *saved_dataloss = NULL; saved_modified = doc->isModifiedSinceSave(); - saved_output_extension = g_strdup(repr->attribute("inkscape:output_extension")); + saved_output_extension = g_strdup(get_file_save_extension(save_method).c_str()); saved_dataloss = g_strdup(repr->attribute("inkscape:dataloss")); if (official) { /* The document is changing name/uri. */ @@ -267,7 +270,7 @@ save(Extension *key, SPDocument *doc, gchar const *filename, bool setextension, sp_document_set_undo_sensitive(doc, false); { // also save the extension for next use - repr->setAttribute("inkscape:output_extension", omod->get_id()); + store_file_extension_in_prefs (omod->get_id(), save_method); // set the "dataloss" attribute if the chosen extension is lossy repr->setAttribute("inkscape:dataloss", NULL); if (omod->causes_dataloss()) { @@ -287,7 +290,7 @@ save(Extension *key, SPDocument *doc, gchar const *filename, bool setextension, bool const saved = sp_document_get_undo_sensitive(doc); sp_document_set_undo_sensitive(doc, false); { - repr->setAttribute("inkscape:output_extension", saved_output_extension); + store_file_extension_in_prefs (saved_output_extension, save_method); repr->setAttribute("inkscape:dataloss", saved_dataloss); } sp_document_set_undo_sensitive(doc, saved); @@ -309,7 +312,7 @@ save(Extension *key, SPDocument *doc, gchar const *filename, bool setextension, bool const saved = sp_document_get_undo_sensitive(doc); sp_document_set_undo_sensitive(doc, false); { - repr->setAttribute("inkscape:output_extension", saved_output_extension); + store_file_extension_in_prefs (saved_output_extension, save_method); repr->setAttribute("inkscape:dataloss", saved_dataloss); } sp_document_set_undo_sensitive(doc, saved); @@ -544,6 +547,95 @@ build_from_mem(gchar const *buffer, Implementation::Implementation *in_imp) return ext; } +/* + * TODO: Is it guaranteed that the returned extension is valid? If so, we can remove the check for + * filename_extension in sp_file_save_dialog(). + */ +Glib::ustring +get_file_save_extension (Inkscape::Extension::FileSaveMethod method) { + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + Glib::ustring extension; + switch (method) { + case FILE_SAVE_METHOD_SAVE_AS: + case FILE_SAVE_METHOD_TEMPORARY: + extension = prefs->getString("/dialogs/save_as/default"); + break; + case FILE_SAVE_METHOD_SAVE_COPY: + extension = prefs->getString("/dialogs/save_copy/default"); + break; + case FILE_SAVE_METHOD_INKSCAPE_SVG: + extension = SP_MODULE_KEY_OUTPUT_SVG_INKSCAPE; + break; + } + + // this is probably unnecessary, but just to be on the safe side ... + if(extension.empty()) + extension = SP_MODULE_KEY_OUTPUT_SVG_INKSCAPE; + + return extension; +} + +Glib::ustring +get_file_save_path (SPDocument *doc, FileSaveMethod method) { + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + Glib::ustring path; + switch (method) { + case FILE_SAVE_METHOD_SAVE_AS: + case FILE_SAVE_METHOD_TEMPORARY: + path = prefs->getString("/dialogs/save_as/path"); + break; + case FILE_SAVE_METHOD_SAVE_COPY: + path = prefs->getString("/dialogs/save_copy/path"); + break; + case FILE_SAVE_METHOD_INKSCAPE_SVG: + if (doc->uri) { + path = Glib::path_get_dirname(doc->uri); + } else { + // FIXME: should we use the save_as path here or the current directory or even something else? + path = prefs->getString("/dialogs/save_as/path"); + } + } + + // this is probably unnecessary, but just to be on the safe side ... + if(path.empty()) + path = g_get_current_dir(); // is this the most sensible solution? + + return path; +} + +void +store_file_extension_in_prefs (Glib::ustring extension, FileSaveMethod method) { + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + switch (method) { + case FILE_SAVE_METHOD_SAVE_AS: + case FILE_SAVE_METHOD_TEMPORARY: + prefs->setString("/dialogs/save_as/default", extension); + break; + case FILE_SAVE_METHOD_SAVE_COPY: + prefs->setString("/dialogs/save_copy/default", extension); + break; + case FILE_SAVE_METHOD_INKSCAPE_SVG: + // do nothing + break; + } +} + +void +store_save_path_in_prefs (Glib::ustring path, FileSaveMethod method) { + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + switch (method) { + case FILE_SAVE_METHOD_SAVE_AS: + case FILE_SAVE_METHOD_TEMPORARY: + prefs->setString("/dialogs/save_as/path", path); + break; + case FILE_SAVE_METHOD_SAVE_COPY: + prefs->setString("/dialogs/save_copy/path", path); + break; + case FILE_SAVE_METHOD_INKSCAPE_SVG: + // do nothing + break; + } +} } } /* namespace Inkscape::Extension */ diff --git a/src/extension/system.h b/src/extension/system.h index 6c23b2f0d..b6740e109 100644 --- a/src/extension/system.h +++ b/src/extension/system.h @@ -21,13 +21,64 @@ namespace Inkscape { namespace Extension { +/** + * Used to distinguish between the various invocations of the save dialogs (and thus to determine + * the file type and save path offered in the dialog) + */ +enum FileSaveMethod { + FILE_SAVE_METHOD_SAVE_AS, + FILE_SAVE_METHOD_SAVE_COPY, + FILE_SAVE_METHOD_EXPORT, + // Fallback for special cases (e.g., when saving a document for the first time or after saving + // it in a lossy format) + FILE_SAVE_METHOD_INKSCAPE_SVG, + // For saving temporary files; we return the same data as for FILE_SAVE_METHOD_SAVE_AS + FILE_SAVE_METHOD_TEMPORARY, +}; + SPDocument *open(Extension *key, gchar const *filename); void save(Extension *key, SPDocument *doc, gchar const *filename, - bool setextension, bool check_overwrite, bool official); + bool setextension, bool check_overwrite, bool official, + Inkscape::Extension::FileSaveMethod save_method); Print *get_print(gchar const *key); Extension *build_from_file(gchar const *filename); Extension *build_from_mem(gchar const *buffer, Implementation::Implementation *in_imp); +/** + * Determine the desired default file extension depending on the given file save method. + * The returned string is guaranteed to be non-empty. + * + * @param method the file save method of the dialog + * @return the corresponding default file extension + */ +Glib::ustring get_file_save_extension (FileSaveMethod method); + +/** + * Determine the desired default save path depending on the given FileSaveMethod. + * The returned string is guaranteed to be non-empty. + * + * @param method the file save method of the dialog + * @param doc the file's document + * @return the corresponding default save path + */ +Glib::ustring get_file_save_path (SPDocument *doc, FileSaveMethod method); + +/** + * Write the given file extension back to prefs so that it can be used later on. + * + * @param extension the file extension which should be written to prefs + * @param method the file save mathod of the dialog + */ +void store_file_extension_in_prefs (Glib::ustring extension, FileSaveMethod method); + +/** + * Write the given path back to prefs so that it can be used later on. + * + * @param path the path which should be written to prefs + * @param method the file save mathod of the dialog + */ +void store_save_path_in_prefs (Glib::ustring path, FileSaveMethod method); + } } /* namespace Inkscape::Extension */ #endif /* INKSCAPE_EXTENSION_SYSTEM_H__ */ diff --git a/src/file.cpp b/src/file.cpp index f16d87cbd..03fb7bd59 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -59,7 +59,6 @@ #include "selection.h" #include "sp-namedview.h" #include "style.h" -#include "ui/dialog/filedialog.h" #include "ui/dialog/ocaldialogs.h" #include "ui/view/view-widget.h" #include "uri.h" @@ -573,15 +572,17 @@ sp_file_vacuum() */ static bool file_save(Gtk::Window &parentWindow, SPDocument *doc, const Glib::ustring &uri, - Inkscape::Extension::Extension *key, bool saveas, bool official) + Inkscape::Extension::Extension *key, bool checkoverwrite, bool official, + Inkscape::Extension::FileSaveMethod save_method) { if (!doc || uri.size()<1) //Safety check return false; try { Inkscape::Extension::save(key, doc, uri.c_str(), - false, - saveas, official); + false, + checkoverwrite, official, + save_method); } catch (Inkscape::Extension::Output::no_extension_found &e) { gchar *safeUri = Inkscape::IO::sanitizeString(uri.c_str()); gchar *text = g_strdup_printf(_("No Inkscape extension found to save document (%s). This may have been caused by an unknown filename extension."), safeUri); @@ -602,7 +603,7 @@ file_save(Gtk::Window &parentWindow, SPDocument *doc, const Glib::ustring &uri, SP_ACTIVE_DESKTOP->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("Document not saved.")); return FALSE; } catch (Inkscape::Extension::Output::no_overwrite &e) { - return sp_file_save_dialog(parentWindow, doc); + return sp_file_save_dialog(parentWindow, doc, Inkscape::Extension::FILE_SAVE_METHOD_SAVE_AS); } SP_ACTIVE_DESKTOP->event_log->rememberFileSave(); @@ -698,85 +699,58 @@ file_save_remote(SPDocument */*doc*/, /** * Display a SaveAs dialog. Save the document if OK pressed. - * - * \param ascopy (optional) wether to set the documents->uri to the new filename or not */ bool -sp_file_save_dialog(Gtk::Window &parentWindow, SPDocument *doc, bool is_copy) +sp_file_save_dialog(Gtk::Window &parentWindow, SPDocument *doc, Inkscape::Extension::FileSaveMethod save_method) { - - Inkscape::XML::Node *repr = sp_document_repr_root(doc); Inkscape::Extension::Output *extension = 0; - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + bool is_copy = (save_method == Inkscape::Extension::FILE_SAVE_METHOD_SAVE_COPY); - //# Get the default extension name + // Note: default_extension has the format "org.inkscape.output.svg.inkscape", whereas + // filename_extension only uses ".svg" Glib::ustring default_extension; - char *attr = (char *)repr->attribute(is_copy ? "inkscape:output_extension_copy" : "inkscape:output_extension"); - if (!attr) { - Glib::ustring attr2 = prefs->getString(is_copy ? "/dialogs/save_copy/default" : "/dialogs/save_as/default"); - if(!attr2.empty()) default_extension = attr2; - } else { - default_extension = attr; - } + Glib::ustring filename_extension = ".svg"; + + default_extension= Inkscape::Extension::get_file_save_extension(save_method); //g_message("%s: extension name: '%s'", __FUNCTION__, default_extension); + extension = dynamic_cast + (Inkscape::Extension::db.get(default_extension.c_str())); + + if (extension) + filename_extension = extension->get_extension(); + Glib::ustring save_path; Glib::ustring save_loc; - if (!default_extension.empty()) { - extension = dynamic_cast - (Inkscape::Extension::db.get(default_extension.c_str())); - } else { - g_warning ("No default extension!!!! What to do?\n"); - } + save_path = Inkscape::Extension::get_file_save_path(doc, save_method); - if (doc->uri && !is_copy) { - // Saving as a regular file: recover the filename from the existing doc->uri - save_loc = Glib::build_filename(Glib::path_get_dirname(doc->uri), - Glib::path_get_basename(doc->uri)); - } else { - Glib::ustring filename_extension = ".svg"; - //g_warning("%s: extension ptr: 0x%x", __FUNCTION__, (unsigned int)extension); - if (extension) - filename_extension = extension->get_extension(); + if (!Inkscape::IO::file_test(save_path.c_str(), + (GFileTest)(G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))) + save_path = ""; - Glib::ustring attr3 = prefs->getString(is_copy ? "/dialogs/save_copy/path" : "/dialogs/save_as/path"); - if (!attr3.empty()) - save_path = attr3; - - if (!Inkscape::IO::file_test(save_path.c_str(), - (GFileTest)(G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))) - save_path = ""; + if (save_path.size()<1) + save_path = g_get_home_dir(); - if (save_path.size()<1) - save_path = g_get_home_dir(); + save_loc = save_path; + save_loc.append(G_DIR_SEPARATOR_S); - save_loc = save_path; - save_loc.append(G_DIR_SEPARATOR_S); + char formatBuf[256]; + int i = 1; + if (!doc->uri) { + // We are saving for the first time; create a unique default filename + snprintf(formatBuf, 255, _("drawing%s"), filename_extension.c_str()); + save_loc.append(formatBuf); - char formatBuf[256]; - int i = 1; - if (!doc->uri) { - // We are saving for the first time; create a unique default filename - snprintf(formatBuf, 255, _("drawing%s"), filename_extension.c_str()); + while (Inkscape::IO::file_test(save_loc.c_str(), G_FILE_TEST_EXISTS)) { + save_loc = save_path; + save_loc.append(G_DIR_SEPARATOR_S); + snprintf(formatBuf, 255, _("drawing-%d%s"), i++, filename_extension.c_str()); save_loc.append(formatBuf); - - while (Inkscape::IO::file_test(save_loc.c_str(), G_FILE_TEST_EXISTS)) { - save_loc = save_path; - save_loc.append(G_DIR_SEPARATOR_S); - snprintf(formatBuf, 255, _("drawing-%d%s"), i++, filename_extension.c_str()); - save_loc.append(formatBuf); - } - } else { - if (is_copy) { - // Use the document uri's base name as the filename but - // store in the directory last used for "Save a copy ..." - snprintf(formatBuf, 255, _("%s"), Glib::path_get_basename(doc->uri).c_str()); - save_loc.append(formatBuf); - } else { - g_assert_not_reached(); - } } + } else { + snprintf(formatBuf, 255, _("%s"), Glib::path_get_basename(doc->uri).c_str()); + save_loc.append(formatBuf); } // convert save_loc from utf-8 to locale @@ -803,7 +777,7 @@ sp_file_save_dialog(Gtk::Window &parentWindow, SPDocument *doc, bool is_copy) dialog_title, default_extension, doc_title ? doc_title : "", - is_copy + save_method ); saveDialog->setSelectionType(extension); @@ -834,15 +808,15 @@ sp_file_save_dialog(Gtk::Window &parentWindow, SPDocument *doc, bool is_copy) else g_warning( "Error converting save filename to UTF-8." ); - success = file_save(parentWindow, doc, fileName, selectionType, TRUE, !is_copy); + // FIXME: does the argument !is_copy really convey the correct meaning here? + success = file_save(parentWindow, doc, fileName, selectionType, TRUE, !is_copy, save_method); if (success && SP_DOCUMENT_URI(doc)) { sp_file_add_recent(SP_DOCUMENT_URI(doc)); } save_path = Glib::path_get_dirname(fileName); - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setString(is_copy ? "/dialogs/save_copy/path" : "/dialogs/save_as/path", save_path); + Inkscape::Extension::store_save_path_in_prefs(save_path, save_method); return success; } @@ -861,16 +835,26 @@ sp_file_save_document(Gtk::Window &parentWindow, SPDocument *doc) bool success = true; if (doc->isModifiedSinceSave()) { - Inkscape::XML::Node *repr = sp_document_repr_root(doc); - if ( doc->uri == NULL - || repr->attribute("inkscape:output_extension") == NULL ) + if ( doc->uri == NULL ) { - return sp_file_save_dialog(parentWindow, doc, FALSE); + // Hier sollte in Argument mitgegeben werden, das anzeigt, daß das Dokument das erste + // Mal gespeichert wird, so daß als default .svg ausgewählt wird und nicht die zuletzt + // benutzte "Save as ..."-Endung + return sp_file_save_dialog(parentWindow, doc, Inkscape::Extension::FILE_SAVE_METHOD_INKSCAPE_SVG); } else { - gchar const *fn = g_strdup(doc->uri); - gchar const *ext = repr->attribute("inkscape:output_extension"); - success = file_save(parentWindow, doc, fn, Inkscape::Extension::db.get(ext), FALSE, TRUE); - g_free((void *) fn); + Glib::ustring extension = Inkscape::Extension::get_file_save_extension(Inkscape::Extension::FILE_SAVE_METHOD_SAVE_AS); + Glib::ustring fn = g_strdup(doc->uri); + // Try to determine the extension from the uri; this may not lead to a valid extension, + // but this case is caught in the file_save method below (or rather in Extension::save() + // further down the line). + Glib::ustring ext = ""; + Glib::ustring::size_type pos = fn.rfind('.'); + if (pos != Glib::ustring::npos) { + // FIXME: this could/should be more sophisticated (see FileSaveDialog::appendExtension()), + // but hopefully it's a reasonable workaround for now + ext = fn.substr( pos ); + } + success = file_save(parentWindow, doc, fn, Inkscape::Extension::db.get(ext.c_str()), FALSE, TRUE, Inkscape::Extension::FILE_SAVE_METHOD_SAVE_AS); } } else { SP_ACTIVE_DESKTOP->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("No changes need to be saved.")); @@ -906,7 +890,7 @@ sp_file_save_as(Gtk::Window &parentWindow, gpointer /*object*/, gpointer /*data* if (!SP_ACTIVE_DOCUMENT) return false; sp_namedview_document_from_window(SP_ACTIVE_DESKTOP); - return sp_file_save_dialog(parentWindow, SP_ACTIVE_DOCUMENT, FALSE); + return sp_file_save_dialog(parentWindow, SP_ACTIVE_DOCUMENT, Inkscape::Extension::FILE_SAVE_METHOD_SAVE_AS); } @@ -920,7 +904,7 @@ sp_file_save_a_copy(Gtk::Window &parentWindow, gpointer /*object*/, gpointer /*d if (!SP_ACTIVE_DOCUMENT) return false; sp_namedview_document_from_window(SP_ACTIVE_DESKTOP); - return sp_file_save_dialog(parentWindow, SP_ACTIVE_DOCUMENT, TRUE); + return sp_file_save_dialog(parentWindow, SP_ACTIVE_DOCUMENT, Inkscape::Extension::FILE_SAVE_METHOD_SAVE_COPY); } @@ -1162,13 +1146,10 @@ sp_file_export_dialog(void *widget) Inkscape::Extension::Output *extension; //# Get the default extension name - Glib::ustring default_extension; - char *attr = (char *)repr->attribute("inkscape:output_extension_export"); - if (!attr) { - Glib::ustring attr2 = prefs->getString("/dialogs/save_export/default"); - if(!attr2.empty()) default_extension = attr2; - } else { - default_extension = attr; + Glib::ustring default_extension = prefs->getString("/dialogs/save_export/default"); + if(default_extension.empty()) { + // FIXME: Is this a good default? Should there be a macro for the string? + default_extension = "org.inkscape.output.png.cairo"; } //g_message("%s: extension name: '%s'", __FUNCTION__, default_extension); @@ -1360,7 +1341,7 @@ sp_file_export_to_ocal_dialog(Gtk::Window &parentWindow) fileName = filePath; - success = file_save(parentWindow, doc, filePath, selectionType, FALSE, FALSE); + success = file_save(parentWindow, doc, filePath, selectionType, FALSE, FALSE, Inkscape::Extension::FILE_SAVE_METHOD_EXPORT); if (!success){ gchar *text = g_strdup_printf(_("Error saving a temporary copy")); diff --git a/src/file.h b/src/file.h index ce75a61a7..9913fbe1a 100644 --- a/src/file.h +++ b/src/file.h @@ -20,6 +20,7 @@ #include #include "extension/extension-forward.h" +#include "extension/system.h" struct SPDesktop; struct SPDocument; @@ -30,6 +31,7 @@ namespace Inkscape { } } + /*###################### ## N E W ######################*/ @@ -111,7 +113,7 @@ bool sp_file_save_a_copy (Gtk::Window &parentWindow, gpointer object, gpointer d bool sp_file_save_document (Gtk::Window &parentWindow, SPDocument *document); /* Do the saveas dialog with a document as the parameter */ -bool sp_file_save_dialog (Gtk::Window &parentWindow, SPDocument *doc, bool bAsCopy = FALSE); +bool sp_file_save_dialog (Gtk::Window &parentWindow, SPDocument *doc, Inkscape::Extension::FileSaveMethod save_method); /*###################### diff --git a/src/ui/dialog/filedialog.cpp b/src/ui/dialog/filedialog.cpp index b1385195f..8e372c394 100644 --- a/src/ui/dialog/filedialog.cpp +++ b/src/ui/dialog/filedialog.cpp @@ -110,12 +110,12 @@ FileSaveDialog *FileSaveDialog::create(Gtk::Window& parentWindow, const char *title, const Glib::ustring &default_key, const gchar *docTitle, - const bool save_copy) + const Inkscape::Extension::FileSaveMethod save_method) { #ifdef WIN32 - FileSaveDialog *dialog = new FileSaveDialogImplWin32(parentWindow, path, fileTypes, title, default_key, docTitle, save_copy); + FileSaveDialog *dialog = new FileSaveDialogImplWin32(parentWindow, path, fileTypes, title, default_key, docTitle, save_method); #else - FileSaveDialog *dialog = new FileSaveDialogImplGtk(parentWindow, path, fileTypes, title, default_key, docTitle, save_copy); + FileSaveDialog *dialog = new FileSaveDialogImplGtk(parentWindow, path, fileTypes, title, default_key, docTitle, save_method); #endif return dialog; } diff --git a/src/ui/dialog/filedialog.h b/src/ui/dialog/filedialog.h index 6eab75a5b..f7be86ef3 100644 --- a/src/ui/dialog/filedialog.h +++ b/src/ui/dialog/filedialog.h @@ -21,6 +21,10 @@ #include #include +#include "extension/system.h" + +class SPDocument; + namespace Inkscape { namespace Extension { class Extension; @@ -164,7 +168,7 @@ public: const char *title, const Glib::ustring &default_key, const gchar *docTitle, - const bool save_copy); + const Inkscape::Extension::FileSaveMethod save_method); /** diff --git a/src/ui/dialog/filedialogimpl-gtkmm.cpp b/src/ui/dialog/filedialogimpl-gtkmm.cpp index 53faa075a..3e681bd3b 100644 --- a/src/ui/dialog/filedialogimpl-gtkmm.cpp +++ b/src/ui/dialog/filedialogimpl-gtkmm.cpp @@ -884,9 +884,10 @@ FileSaveDialogImplGtk::FileSaveDialogImplGtk( Gtk::Window &parentWindow, const Glib::ustring &title, const Glib::ustring &/*default_key*/, const gchar* docTitle, - const bool save_copy) : - FileDialogBaseGtk(parentWindow, title, Gtk::FILE_CHOOSER_ACTION_SAVE, fileTypes, save_copy ? "/dialogs/save_copy" : "/dialogs/save_as"), - is_copy(save_copy) + const Inkscape::Extension::FileSaveMethod save_method) : + FileDialogBaseGtk(parentWindow, title, Gtk::FILE_CHOOSER_ACTION_SAVE, fileTypes, + (save_method == Inkscape::Extension::FILE_SAVE_METHOD_SAVE_COPY) ? "/dialogs/save_copy" : "/dialogs/save_as"), + save_method(save_method) { FileSaveDialog::myDocTitle = docTitle; @@ -924,7 +925,7 @@ FileSaveDialogImplGtk::FileSaveDialogImplGtk( Gtk::Window &parentWindow, //###### Do we want the .xxx extension automatically added? Inkscape::Preferences *prefs = Inkscape::Preferences::get(); fileTypeCheckbox.set_label(Glib::ustring(_("Append filename extension automatically"))); - if (save_copy) { + if (save_method == Inkscape::Extension::FILE_SAVE_METHOD_SAVE_COPY) { fileTypeCheckbox.set_active(prefs->getBool("/dialogs/save_copy/append_extension", true)); } else { fileTypeCheckbox.set_active(prefs->getBool("/dialogs/save_as/append_extension", true)); @@ -1115,18 +1116,13 @@ FileSaveDialogImplGtk::show() Inkscape::Preferences *prefs = Inkscape::Preferences::get(); // Store changes of the "Append filename automatically" checkbox back to preferences. - if (is_copy) { + if (save_method == Inkscape::Extension::FILE_SAVE_METHOD_SAVE_COPY) { prefs->setBool("/dialogs/save_copy/append_extension", fileTypeCheckbox.get_active()); } else { prefs->setBool("/dialogs/save_as/append_extension", fileTypeCheckbox.get_active()); } - // Store the last used save-as filetype to preferences. - if (is_copy) { - prefs->setString("/dialogs/save_copy/default", ( extension != NULL ? extension->get_id() : "" )); - } else { - prefs->setString("/dialogs/save_as/default", ( extension != NULL ? extension->get_id() : "" )); - } + Inkscape::Extension::store_file_extension_in_prefs ((extension != NULL ? extension->get_id() : "" ), save_method); cleanup( true ); diff --git a/src/ui/dialog/filedialogimpl-gtkmm.h b/src/ui/dialog/filedialogimpl-gtkmm.h index 2a37aed2b..ac868fecc 100644 --- a/src/ui/dialog/filedialogimpl-gtkmm.h +++ b/src/ui/dialog/filedialogimpl-gtkmm.h @@ -18,6 +18,7 @@ #define __FILE_DIALOGIMPL_H__ #include "filedialog.h" +#include "extension/system.h" //General includes #include @@ -286,7 +287,7 @@ public: const Glib::ustring &title, const Glib::ustring &default_key, const gchar* docTitle, - const bool save_copy); + const Inkscape::Extension::FileSaveMethod save_method); virtual ~FileSaveDialogImplGtk(); @@ -303,9 +304,10 @@ private: void updateNameAndExtension(); /** - * Whether the dialog was invoked by "Save as ..." or "Save a copy ..." + * The file save method (essentially whether the dialog was invoked by "Save as ..." or "Save a + * copy ..."), which is used to determine file extensions and save paths. */ - bool is_copy; + Inkscape::Extension::FileSaveMethod save_method; /** * Fix to allow the user to type the file name diff --git a/src/ui/dialog/filedialogimpl-win32.cpp b/src/ui/dialog/filedialogimpl-win32.cpp index c703d3c75..690c74004 100644 --- a/src/ui/dialog/filedialogimpl-win32.cpp +++ b/src/ui/dialog/filedialogimpl-win32.cpp @@ -1498,8 +1498,9 @@ FileSaveDialogImplWin32::FileSaveDialogImplWin32(Gtk::Window &parent, const char *title, const Glib::ustring &/*default_key*/, const char *docTitle, - const bool save_copy) : - FileDialogBaseWin32(parent, dir, title, fileTypes, save_copy ? "dialogs.save_copy" : "dialogs.save_as"), + const FileSaveMethod save_method) : + FileDialogBaseWin32(parent, dir, title, fileTypes, + (save_method == FILE_SAVE_METHOD_SAVE_COPY) ? "dialogs.save_copy" : "dialogs.save_as"), _title_label(NULL), _title_edit(NULL) { diff --git a/src/ui/dialog/filedialogimpl-win32.h b/src/ui/dialog/filedialogimpl-win32.h index f74d9fccf..1f4a417f2 100644 --- a/src/ui/dialog/filedialogimpl-win32.h +++ b/src/ui/dialog/filedialogimpl-win32.h @@ -311,7 +311,7 @@ public: const char *title, const Glib::ustring &default_key, const char *docTitle, - const bool save_copy); + const FileSaveMethod save_method); /// Destructor virtual ~FileSaveDialogImplWin32(); diff --git a/src/ui/view/edit-widget.cpp b/src/ui/view/edit-widget.cpp index 756f4df73..1d319f97f 100644 --- a/src/ui/view/edit-widget.cpp +++ b/src/ui/view/edit-widget.cpp @@ -1247,7 +1247,7 @@ EditWidget::shutdown() _("The file \"%s\" was saved with a format (%s) that may cause data loss!\n\n" "Do you want to save this file as an Inkscape SVG?"), SP_DOCUMENT_NAME(doc), - Inkscape::Extension::db.get(sp_document_repr_root(doc)->attribute("inkscape:output_extension"))->get_name()); + SP_MODULE_KEY_OUTPUT_SVG_INKSCAPE); Gtk::MessageDialog dlg (*this, markup, diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index a2f88c16d..6d9a61329 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -892,7 +892,7 @@ SPDesktopWidget::shutdown() _("The file \"%s\" was saved with a format (%s) that may cause data loss!\n\n" "Do you want to save this file as an Inkscape SVG?"), SP_DOCUMENT_NAME(doc), - Inkscape::Extension::db.get(sp_document_repr_root(doc)->attribute("inkscape:output_extension"))->get_name()); + SP_MODULE_KEY_OUTPUT_SVG_INKSCAPE); // fix for bug 1767940: GTK_WIDGET_UNSET_FLAGS(GTK_WIDGET(GTK_MESSAGE_DIALOG(dialog)->label), GTK_CAN_FOCUS); @@ -919,7 +919,7 @@ SPDesktopWidget::shutdown() Gtk::Window *window = (Gtk::Window*)gtk_object_get_data (GTK_OBJECT(this), "window"); - if (sp_file_save_dialog(*window, doc)) { + if (sp_file_save_dialog(*window, doc, Inkscape::Extension::FILE_SAVE_METHOD_INKSCAPE_SVG)) { sp_document_unref(doc); } else { // save dialog cancelled or save failed sp_document_unref(doc); -- cgit v1.2.3 From 39559f543f4034819b2ccc3fccac1ef8c1b1b049 Mon Sep 17 00:00:00 2001 From: Maximilian Albert Date: Sun, 9 Aug 2009 16:43:14 +0000 Subject: Cleanup (remove unused variable; use generic function to determine the file extension) (bzr r8455) --- src/dialogs/export.cpp | 2 +- src/file.cpp | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/dialogs/export.cpp b/src/dialogs/export.cpp index 835003e5e..ee7852924 100644 --- a/src/dialogs/export.cpp +++ b/src/dialogs/export.cpp @@ -540,7 +540,7 @@ sp_export_dialog (void) gchar *name; SPDocument * doc = SP_ACTIVE_DOCUMENT; const gchar *uri = SP_DOCUMENT_URI (doc); - const gchar *text_extension = Inkscape::Preferences::get()->getString("/dialogs/save_as/default").c_str(); + const gchar *text_extension = get_file_save_extension (Inkscape::Extension::FILE_SAVE_METHOD_SAVE_AS).c_str(); Inkscape::Extension::Output * oextension = NULL; if (text_extension != NULL) { diff --git a/src/file.cpp b/src/file.cpp index 03fb7bd59..8f40d7e4b 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -1141,7 +1141,6 @@ sp_file_export_dialog(void *widget) Glib::ustring export_path; Glib::ustring export_loc; - Inkscape::XML::Node *repr = sp_document_repr_root(doc); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); Inkscape::Extension::Output *extension; -- cgit v1.2.3 From 9289c1726bbd97cb2befcfa19f21a79dd6a45d78 Mon Sep 17 00:00:00 2001 From: Maximilian Albert Date: Sun, 9 Aug 2009 16:43:39 +0000 Subject: Put #ifdefs around all code related to the so-called "new" ExportDialog (whatever that is) (bzr r8456) --- src/file.cpp | 5 +---- src/ui/dialog/filedialog.cpp | 4 ++++ src/ui/dialog/filedialog.h | 5 ++++- src/ui/dialog/filedialogimpl-gtkmm.cpp | 4 ++++ src/ui/dialog/filedialogimpl-gtkmm.h | 3 +++ 5 files changed, 16 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/file.cpp b/src/file.cpp index 8f40d7e4b..420eaec63 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -1123,9 +1123,6 @@ sp_file_import(Gtk::Window &parentWindow) ## E X P O R T ######################*/ -//#define NEW_EXPORT_DIALOG - - #ifdef NEW_EXPORT_DIALOG @@ -1192,7 +1189,7 @@ sp_file_export_dialog(void *widget) if ( export_path_local.size() > 0) export_path = export_path_local; - //# Show the SaveAs dialog + //# Show the Export dialog Inkscape::UI::Dialog::FileExportDialog *exportDialogInstance = Inkscape::UI::Dialog::FileExportDialog::create( export_path, diff --git a/src/ui/dialog/filedialog.cpp b/src/ui/dialog/filedialog.cpp index 8e372c394..68c0926aa 100644 --- a/src/ui/dialog/filedialog.cpp +++ b/src/ui/dialog/filedialog.cpp @@ -166,6 +166,8 @@ void FileSaveDialog::appendExtension(Glib::ustring& path, Inkscape::Extension::O //# F I L E E X P O R T //######################################################################## +#ifdef NEW_EXPORT_DIALOG + /** * Public factory method. Used in file.cpp */ @@ -179,6 +181,8 @@ FileExportDialog *FileExportDialog::create(Gtk::Window& parentWindow, return dialog; } +#endif // NEW_EXPORT_DIALOG + } //namespace Dialog } //namespace UI diff --git a/src/ui/dialog/filedialog.h b/src/ui/dialog/filedialog.h index f7be86ef3..472c4ac0b 100644 --- a/src/ui/dialog/filedialog.h +++ b/src/ui/dialog/filedialog.h @@ -228,7 +228,9 @@ protected: }; //FileSaveDialog +//#define NEW_EXPORT_DIALOG +#ifdef NEW_EXPORT_DIALOG /** * This class provides an implementation-independent API for @@ -366,12 +368,13 @@ public: }; //FileExportDialog +#endif // NEW_EXPORT_DIALOG + } //namespace Dialog } //namespace UI } //namespace Inkscape - #endif /* __FILE_DIALOG_H__ */ /* diff --git a/src/ui/dialog/filedialogimpl-gtkmm.cpp b/src/ui/dialog/filedialogimpl-gtkmm.cpp index 3e681bd3b..e650cf842 100644 --- a/src/ui/dialog/filedialogimpl-gtkmm.cpp +++ b/src/ui/dialog/filedialogimpl-gtkmm.cpp @@ -1251,6 +1251,8 @@ void FileSaveDialogImplGtk::updateNameAndExtension() } +#ifdef NEW_EXPORT_DIALOG + //######################################################################## //# F I L E E X P O R T //######################################################################## @@ -1607,6 +1609,8 @@ FileExportDialogImpl::getFilename() return myFilename; } +#endif // NEW_EXPORT_DIALOG + } //namespace Dialog } //namespace UI diff --git a/src/ui/dialog/filedialogimpl-gtkmm.h b/src/ui/dialog/filedialogimpl-gtkmm.h index ac868fecc..65bb38971 100644 --- a/src/ui/dialog/filedialogimpl-gtkmm.h +++ b/src/ui/dialog/filedialogimpl-gtkmm.h @@ -357,6 +357,8 @@ private: +#ifdef NEW_EXPORT_DIALOG + //######################################################################## //# F I L E E X P O R T //######################################################################## @@ -573,6 +575,7 @@ private: Glib::ustring myFilename; }; +#endif // NEW_EXPORT_DIALOG } // namespace Dialog } // namespace UI -- cgit v1.2.3 From 13fc2f2a9f44e43e79e698612993d4d8e63ccb94 Mon Sep 17 00:00:00 2001 From: Maximilian Albert Date: Sun, 9 Aug 2009 16:43:57 +0000 Subject: Fix compile when NEW_EXPORT_DIALOG is defined (however, the dialog crashes when trying to export files, dunno why) (bzr r8457) --- src/file.cpp | 7 ++++--- src/file.h | 2 +- src/verbs.cpp | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/file.cpp b/src/file.cpp index 420eaec63..fd1438eb6 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -1130,7 +1130,7 @@ sp_file_import(Gtk::Window &parentWindow) * Display an Export dialog, export as the selected type if OK pressed */ bool -sp_file_export_dialog(void *widget) +sp_file_export_dialog(Gtk::Window &parentWindow) { //# temp hack for 'doc' until we can switch to this dialog SPDocument *doc = SP_ACTIVE_DOCUMENT; @@ -1192,6 +1192,7 @@ sp_file_export_dialog(void *widget) //# Show the Export dialog Inkscape::UI::Dialog::FileExportDialog *exportDialogInstance = Inkscape::UI::Dialog::FileExportDialog::create( + parentWindow, export_path, Inkscape::UI::Dialog::EXPORT_TYPES, (char const *) _("Select file to export to"), @@ -1220,7 +1221,7 @@ sp_file_export_dialog(void *widget) else g_warning( "Error converting save filename to UTF-8." ); - success = file_save(doc, fileName, selectionType, TRUE, FALSE); + success = file_save(parentWindow, doc, fileName, selectionType, TRUE, FALSE, Inkscape::Extension::FILE_SAVE_METHOD_EXPORT); if (success) { Glib::RefPtr recent = Gtk::RecentManager::get_default(); @@ -1243,7 +1244,7 @@ sp_file_export_dialog(void *widget) * */ bool -sp_file_export_dialog(void */*widget*/) +sp_file_export_dialog(Gtk::Window &/*parentWindow*/) { sp_export_dialog(); return true; diff --git a/src/file.h b/src/file.h index 9913fbe1a..770e519ab 100644 --- a/src/file.h +++ b/src/file.h @@ -141,7 +141,7 @@ void file_import(SPDocument *in_doc, const Glib::ustring &uri, * additional type selection, to allow the user to export * the a document as a given type. */ -bool sp_file_export_dialog (void *widget); +bool sp_file_export_dialog (Gtk::Window &parentWindow); /*###################### diff --git a/src/verbs.cpp b/src/verbs.cpp index 43ddc1459..b634e2a44 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -799,7 +799,7 @@ FileVerb::perform(SPAction *action, void *data, void */*pdata*/) sp_file_import(*parent); break; case SP_VERB_FILE_EXPORT: - sp_file_export_dialog(NULL); + sp_file_export_dialog(*parent); break; case SP_VERB_FILE_IMPORT_FROM_OCAL: sp_file_import_from_ocal(*parent); -- cgit v1.2.3 From 093888a015ccaed8332ced7f0aaaa6ee7acb9517 Mon Sep 17 00:00:00 2001 From: Maximilian Albert Date: Mon, 10 Aug 2009 01:27:02 +0000 Subject: Add missing namespaces in win32 code (thanks to Yann Papouin for pointing this out) (bzr r8460) --- src/ui/dialog/filedialogimpl-win32.cpp | 4 ++-- src/ui/dialog/filedialogimpl-win32.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ui/dialog/filedialogimpl-win32.cpp b/src/ui/dialog/filedialogimpl-win32.cpp index 690c74004..2196ef0de 100644 --- a/src/ui/dialog/filedialogimpl-win32.cpp +++ b/src/ui/dialog/filedialogimpl-win32.cpp @@ -1498,9 +1498,9 @@ FileSaveDialogImplWin32::FileSaveDialogImplWin32(Gtk::Window &parent, const char *title, const Glib::ustring &/*default_key*/, const char *docTitle, - const FileSaveMethod save_method) : + const Inkscape::Extension::FileSaveMethod save_method) : FileDialogBaseWin32(parent, dir, title, fileTypes, - (save_method == FILE_SAVE_METHOD_SAVE_COPY) ? "dialogs.save_copy" : "dialogs.save_as"), + (save_method == Inkscape::Extension::FILE_SAVE_METHOD_SAVE_COPY) ? "dialogs.save_copy" : "dialogs.save_as"), _title_label(NULL), _title_edit(NULL) { diff --git a/src/ui/dialog/filedialogimpl-win32.h b/src/ui/dialog/filedialogimpl-win32.h index 1f4a417f2..4234c1782 100644 --- a/src/ui/dialog/filedialogimpl-win32.h +++ b/src/ui/dialog/filedialogimpl-win32.h @@ -311,7 +311,7 @@ public: const char *title, const Glib::ustring &default_key, const char *docTitle, - const FileSaveMethod save_method); + const Inkscape::Extension::FileSaveMethod save_method); /// Destructor virtual ~FileSaveDialogImplWin32(); -- cgit v1.2.3 From 9403760eddc285464243365298cf6424ce916924 Mon Sep 17 00:00:00 2001 From: bulia byak Date: Tue, 11 Aug 2009 01:40:49 +0000 Subject: patch 168780 (bzr r8464) --- src/dropper-context.cpp | 16 ++++++++++++++++ src/dropper-context.h | 1 + src/node-context.cpp | 17 +++++++++++++++++ src/node-context.h | 1 + src/zoom-context.cpp | 22 ++++++++++++++++++++++ src/zoom-context.h | 1 + 6 files changed, 58 insertions(+) (limited to 'src') diff --git a/src/dropper-context.cpp b/src/dropper-context.cpp index 985e3ac51..aa17ea859 100644 --- a/src/dropper-context.cpp +++ b/src/dropper-context.cpp @@ -129,6 +129,11 @@ static void sp_dropper_context_finish(SPEventContext *ec) SPDropperContext *dc = SP_DROPPER_CONTEXT(ec); ec->enableGrDrag(false); + + if (dc->grabbed) { + sp_canvas_item_ungrab(dc->grabbed, GDK_CURRENT_TIME); + dc->grabbed = NULL; + } if (dc->area) { gtk_object_destroy(GTK_OBJECT(dc->area)); @@ -171,6 +176,12 @@ static gint sp_dropper_context_root_handler(SPEventContext *event_context, GdkEv dc->dragging = TRUE; ret = TRUE; } + + sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate), + GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK, + NULL, event->button.time); + dc->grabbed = SP_CANVAS_ITEM(desktop->acetate); + break; case GDK_MOTION_NOTIFY: if (event->motion.state & GDK_BUTTON2_MASK) { @@ -311,6 +322,11 @@ static gint sp_dropper_context_root_handler(SPEventContext *event_context, GdkEv { sp_canvas_item_hide(dc->area); dc->dragging = FALSE; + + if (dc->grabbed) { + sp_canvas_item_ungrab(dc->grabbed, event->button.time); + dc->grabbed = NULL; + } double alpha_to_set = setalpha? dc->alpha : 1.0; diff --git a/src/dropper-context.h b/src/dropper-context.h index 678ab6b47..64181e3c8 100644 --- a/src/dropper-context.h +++ b/src/dropper-context.h @@ -32,6 +32,7 @@ struct SPDropperContext { unsigned int dragging : 1; + SPCanvasItem *grabbed; SPCanvasItem *area; Geom::Point centre; diff --git a/src/node-context.cpp b/src/node-context.cpp index a0fb78ba1..3535ae9e0 100644 --- a/src/node-context.cpp +++ b/src/node-context.cpp @@ -117,6 +117,11 @@ sp_node_context_dispose(GObject *object) SPEventContext *ec = SP_EVENT_CONTEXT(object); ec->enableGrDrag(false); + + if (nc->grabbed) { + sp_canvas_item_ungrab(nc->grabbed, GDK_CURRENT_TIME); + nc->grabbed = NULL; + } nc->sel_changed_connection.disconnect(); nc->sel_changed_connection.~connection(); @@ -327,6 +332,12 @@ sp_node_context_root_handler(SPEventContext *event_context, GdkEvent *event) event->button.y); Geom::Point const button_dt(desktop->w2d(button_w)); Inkscape::Rubberband::get(desktop)->start(desktop, button_dt); + + sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate), + GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK, + NULL, event->button.time); + nc->grabbed = SP_CANVAS_ITEM(desktop->acetate); + nc->current_state = SP_NODE_CONTEXT_INACTIVE; desktop->updateNow(); ret = TRUE; @@ -483,6 +494,12 @@ sp_node_context_root_handler(SPEventContext *event_context, GdkEvent *event) } ret = TRUE; Inkscape::Rubberband::get(desktop)->stop(); + + if (nc->grabbed) { + sp_canvas_item_ungrab(nc->grabbed, event->button.time); + nc->grabbed = NULL; + } + desktop->updateNow(); nc->rb_escaped = false; nc->drag = FALSE; diff --git a/src/node-context.h b/src/node-context.h index 0e141274f..2345ffc7e 100644 --- a/src/node-context.h +++ b/src/node-context.h @@ -57,6 +57,7 @@ struct SPNodeContext { unsigned int current_state; SPItem * flashed_item; + SPCanvasItem *grabbed; Inkscape::Display::TemporaryItem * flash_tempitem; int remove_flash_counter; }; diff --git a/src/zoom-context.cpp b/src/zoom-context.cpp index 2f0185731..f8212069e 100644 --- a/src/zoom-context.cpp +++ b/src/zoom-context.cpp @@ -18,6 +18,7 @@ #include "macros.h" #include "rubberband.h" +#include "display/sp-canvas-util.h" #include "desktop.h" #include "pixmaps/cursor-zoom.xpm" #include "pixmaps/cursor-zoom-out.xpm" @@ -86,7 +87,14 @@ static void sp_zoom_context_init (SPZoomContext *zoom_context) static void sp_zoom_context_finish (SPEventContext *ec) { + SPZoomContext *zc = SP_ZOOM_CONTEXT(ec); + ec->enableGrDrag(false); + + if (zc->grabbed) { + sp_canvas_item_ungrab(zc->grabbed, GDK_CURRENT_TIME); + zc->grabbed = NULL; + } } static void sp_zoom_context_setup(SPEventContext *ec) @@ -119,6 +127,8 @@ static gint sp_zoom_context_root_handler(SPEventContext *event_context, GdkEvent { SPDesktop *desktop = event_context->desktop; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + + SPZoomContext *zc = SP_ZOOM_CONTEXT(event_context); tolerance = prefs->getIntLimited("/options/dragtolerance/value", 0, 0, 100); double const zoom_inc = prefs->getDoubleLimited("/options/zoomincrement/value", M_SQRT2, 1.01, 10); @@ -147,6 +157,12 @@ static gint sp_zoom_context_root_handler(SPEventContext *event_context, GdkEvent desktop->zoom_relative_keep_point(button_dt, zoom_rel); ret = TRUE; } + + sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate), + GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK, + NULL, event->button.time); + zc->grabbed = SP_CANVAS_ITEM(desktop->acetate); + break; } @@ -188,6 +204,12 @@ static gint sp_zoom_context_root_handler(SPEventContext *event_context, GdkEvent ret = TRUE; } Inkscape::Rubberband::get(desktop)->stop(); + + if (zc->grabbed) { + sp_canvas_item_ungrab(zc->grabbed, event->button.time); + zc->grabbed = NULL; + } + xp = yp = 0; escaped = false; break; diff --git a/src/zoom-context.h b/src/zoom-context.h index aadba9551..133267135 100644 --- a/src/zoom-context.h +++ b/src/zoom-context.h @@ -24,6 +24,7 @@ class SPZoomContextClass; struct SPZoomContext { SPEventContext event_context; + SPCanvasItem *grabbed; }; struct SPZoomContextClass { -- cgit v1.2.3 From 3df4d57cdf2cecad461fffb4bc386cf7c08fe144 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Tue, 11 Aug 2009 13:02:58 +0000 Subject: Maximum value of alpha is 255 (not 256). (bzr r8467) --- src/extension/internal/javafx-out.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/extension/internal/javafx-out.cpp b/src/extension/internal/javafx-out.cpp index 417755e19..a2f387406 100644 --- a/src/extension/internal/javafx-out.cpp +++ b/src/extension/internal/javafx-out.cpp @@ -141,7 +141,7 @@ static JavaFXOutput::String rgba(guint32 rgba) unsigned int a = SP_RGBA32_A_U(rgba); char buf[80]; snprintf(buf, 79, "Color.rgb(0x%02x, 0x%02x, 0x%02x, %s)", - r, g, b, DSTR((double)a/256.0)); + r, g, b, DSTR((double)a/255.0)); JavaFXOutput::String s = buf; return s; } -- cgit v1.2.3 From 6c696361c850c76914684b5ebb04ea64800763ad Mon Sep 17 00:00:00 2001 From: Alexandre Prokoudine Date: Tue, 11 Aug 2009 18:08:04 +0000 Subject: Deweirdification of user visible messages as proposed by Tav (bzr r8468) --- src/live_effects/lpe-knot.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/live_effects/lpe-knot.cpp b/src/live_effects/lpe-knot.cpp index f6cf5ea78..793061b2f 100644 --- a/src/live_effects/lpe-knot.cpp +++ b/src/live_effects/lpe-knot.cpp @@ -320,10 +320,10 @@ CrossingPoints::inherit_signs(CrossingPoints const &other, int default_value) LPEKnot::LPEKnot(LivePathEffectObject *lpeobject) : Effect(lpeobject), // initialise your parameters here: - interruption_width(_("Interruption width"), _("Size of hidden region of lower string"), "interruption_width", &wr, this, 3), - prop_to_stroke_width(_("unit of stroke width"), _("Consider 'Interruption width' as a ratio of stroke width."), "prop_to_stroke_width", &wr, this, true), - add_stroke_width(_("add stroke width to interruption size"), _("Add the stroke width to the interruption size."), "add_stroke_width", &wr, this, true), - add_other_stroke_width(_("add other's stroke width to interruption size"), _("Add crossed stroke width to the interruption size."), "add_other_stroke_width", &wr, this, true), + interruption_width(_("Fixed width"), _("Size of hidden region of lower string"), "interruption_width", &wr, this, 3), + prop_to_stroke_width(_("In units of stroke width"), _("Consider 'Interruption width' as a ratio of stroke width"), "prop_to_stroke_width", &wr, this, true), + add_stroke_width(_("Stroke width"), _("Add the stroke width to the interruption size"), "add_stroke_width", &wr, this, true), + add_other_stroke_width(_("Crossing path stroke width"), _("Add crossed stroke width to the interruption size"), "add_other_stroke_width", &wr, this, true), switcher_size(_("Switcher size"), _("Orientation indicator/switcher size"), "switcher_size", &wr, this, 15), crossing_points_vector(_("Crossing Signs"), _("Crossings signs"), "crossing_points_vector", &wr, this), gpaths(),gstroke_widths() -- cgit v1.2.3 From a36ae9f53eb376e246ff02d295796a6fead04eab Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Wed, 12 Aug 2009 06:45:56 +0000 Subject: Fix for Bug #373309 (Print has offset on page), by Adrian Johnson. (bzr r8469) --- src/ui/dialog/print.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ui/dialog/print.cpp b/src/ui/dialog/print.cpp index d15773ecb..214b1a6db 100644 --- a/src/ui/dialog/print.cpp +++ b/src/ui/dialog/print.cpp @@ -13,6 +13,7 @@ #endif #ifdef WIN32 #include +#include #endif #include @@ -31,7 +32,7 @@ static void -draw_page (GtkPrintOperation */*operation*/, +draw_page (GtkPrintOperation *operation, GtkPrintContext *context, gint /*page_nr*/, gpointer user_data) @@ -106,6 +107,24 @@ draw_page (GtkPrintOperation */*operation*/, cairo_surface_t *surface = cairo_get_target(cr); cairo_matrix_t ctm; cairo_get_matrix(cr, &ctm); +#ifdef WIN32 + //Gtk+ does not take the non printable area into account + //http://bugzilla.gnome.org/show_bug.cgi?id=381371 + // + // This workaround translates the origin from the top left of the + // printable area to the top left of the page. + GtkPrintSettings *settings = gtk_print_operation_get_print_settings(operation); + const gchar *printerName = gtk_print_settings_get_printer(settings); + HDC hdc = CreateDC("WINSPOOL", printerName, NULL, NULL); + if (hdc) { + cairo_matrix_t mat; + int x_off = GetDeviceCaps (hdc, PHYSICALOFFSETX); + int y_off = GetDeviceCaps (hdc, PHYSICALOFFSETY); + cairo_matrix_init_translate(&mat, -x_off, -y_off); + cairo_matrix_multiply (&ctm, &ctm, &mat); + DeleteDC(hdc); + } +#endif bool ret = ctx->setSurfaceTarget (surface, true, &ctm); if (ret) { ret = renderer.setupDocument (ctx, junk->_doc, TRUE, NULL); -- cgit v1.2.3 From 9f9e21dec8cc697d91646924da431fc04a2b78bd Mon Sep 17 00:00:00 2001 From: Maximilian Albert Date: Wed, 12 Aug 2009 13:18:51 +0000 Subject: Don't open 'Save as ...' dialog inside the application bundle on OS X when it is invoked for the first time (bzr r8472) --- src/extension/system.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/extension/system.cpp b/src/extension/system.cpp index 2251ac7b6..365ea925b 100644 --- a/src/extension/system.cpp +++ b/src/extension/system.cpp @@ -568,7 +568,6 @@ get_file_save_extension (Inkscape::Extension::FileSaveMethod method) { break; } - // this is probably unnecessary, but just to be on the safe side ... if(extension.empty()) extension = SP_MODULE_KEY_OUTPUT_SVG_INKSCAPE; @@ -591,14 +590,17 @@ get_file_save_path (SPDocument *doc, FileSaveMethod method) { if (doc->uri) { path = Glib::path_get_dirname(doc->uri); } else { - // FIXME: should we use the save_as path here or the current directory or even something else? + // FIXME: should we use the save_as path here or something else? Maybe we should + // leave this as a choice to the user. path = prefs->getString("/dialogs/save_as/path"); } } - // this is probably unnecessary, but just to be on the safe side ... if(path.empty()) - path = g_get_current_dir(); // is this the most sensible solution? + path = g_get_home_dir(); // Is this the most sensible solution? Note that we should avoid + // g_get_current_dir because this leads to problems on OS X where + // Inkscape opens the dialog inside application bundle when it is + // invoked for the first teim. return path; } -- cgit v1.2.3 From 3c5b9a5d0a9df79c757435ad63514287cd5b211b Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Wed, 12 Aug 2009 14:00:19 +0000 Subject: Fix for Bug #166678 (Paper size or orientation are not used when printing) by Adrian Johnson. (bzr r8473) --- src/document.cpp | 19 +++++++++++++++++++ src/document.h | 2 ++ src/sp-root.h | 1 + src/ui/dialog/print.cpp | 15 +++++++++++---- src/ui/widget/page-sizer.cpp | 23 ++++++++++++----------- 5 files changed, 45 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/document.cpp b/src/document.cpp index 288e52c6d..17057e1dc 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -572,6 +572,25 @@ gdouble sp_document_height(SPDocument *document) return root->height.computed; } +void sp_document_set_landscape (SPDocument *document, gboolean landscape) +{ + SPRoot *root = SP_ROOT(document->root); + + root->landscape = landscape; + SP_OBJECT (root)->updateRepr(); +} + +gboolean sp_document_landscape(SPDocument *document) +{ + g_return_val_if_fail(document != NULL, 0.0); + g_return_val_if_fail(document->priv != NULL, 0.0); + g_return_val_if_fail(document->root != NULL, 0.0); + + SPRoot *root = SP_ROOT(document->root); + + return root->landscape; +} + Geom::Point sp_document_dimensions(SPDocument *doc) { return Geom::Point(sp_document_width(doc), sp_document_height(doc)); diff --git a/src/document.h b/src/document.h index 696e568ad..63ca221a2 100644 --- a/src/document.h +++ b/src/document.h @@ -185,12 +185,14 @@ SPDocument *sp_document_create(Inkscape::XML::Document *rdoc, gchar const *uri, gdouble sp_document_width(SPDocument *document); gdouble sp_document_height(SPDocument *document); +gboolean sp_document_landscape(SPDocument *document); Geom::Point sp_document_dimensions(SPDocument *document); struct SPUnit; void sp_document_set_width(SPDocument *document, gdouble width, const SPUnit *unit); void sp_document_set_height(SPDocument *document, gdouble height, const SPUnit *unit); +void sp_document_set_landscape(SPDocument *document, gboolean landscape); #define SP_DOCUMENT_URI(d) (d->uri) #define SP_DOCUMENT_NAME(d) (d->name) diff --git a/src/sp-root.h b/src/sp-root.h index 7976eb2f4..8b3cb4f0c 100644 --- a/src/sp-root.h +++ b/src/sp-root.h @@ -36,6 +36,7 @@ struct SPRoot : public SPGroup { SVGLength y; SVGLength width; SVGLength height; + gboolean landscape; /* viewBox; */ unsigned int viewBox_set : 1; diff --git a/src/ui/dialog/print.cpp b/src/ui/dialog/print.cpp index 214b1a6db..d98d6a49e 100644 --- a/src/ui/dialog/print.cpp +++ b/src/ui/dialog/print.cpp @@ -188,12 +188,19 @@ Print::Print(SPDocument *doc, SPItem *base) : GtkPageSetup *page_setup = gtk_page_setup_new(); gdouble doc_width = sp_document_width(_doc) * PT_PER_PX; gdouble doc_height = sp_document_height(_doc) * PT_PER_PX; - GtkPaperSize *paper_size = gtk_paper_size_new_custom("custom", "custom", - doc_width, doc_height, GTK_UNIT_POINTS); + GtkPaperSize *paper_size; + if (sp_document_landscape(_doc)) { + gtk_page_setup_set_orientation (page_setup, GTK_PAGE_ORIENTATION_LANDSCAPE); + paper_size = gtk_paper_size_new_custom("custom", "custom", + doc_height, doc_width, GTK_UNIT_POINTS); + } else { + gtk_page_setup_set_orientation (page_setup, GTK_PAGE_ORIENTATION_PORTRAIT); + paper_size = gtk_paper_size_new_custom("custom", "custom", + doc_width, doc_height, GTK_UNIT_POINTS); + } + gtk_page_setup_set_paper_size (page_setup, paper_size); -#ifndef WIN32 gtk_print_operation_set_default_page_setup (_printop, page_setup); -#endif gtk_print_operation_set_use_full_page (_printop, TRUE); // set up signals diff --git a/src/ui/widget/page-sizer.cpp b/src/ui/widget/page-sizer.cpp index 02688a55e..6817d815b 100644 --- a/src/ui/widget/page-sizer.cpp +++ b/src/ui/widget/page-sizer.cpp @@ -345,11 +345,23 @@ PageSizer::setDim (double w, double h, bool changeList) _changedw_connection.block(); _changedh_connection.block(); + if ( w != h ) { + _landscapeButton.set_sensitive(true); + _portraitButton.set_sensitive (true); + _landscape = ( w > h ); + _landscapeButton.set_active(_landscape ? true : false); + _portraitButton.set_active (_landscape ? false : true); + } else { + _landscapeButton.set_sensitive(false); + _portraitButton.set_sensitive (false); + } + if (SP_ACTIVE_DESKTOP && !_widgetRegistry->isUpdating()) { SPDocument *doc = sp_desktop_document(SP_ACTIVE_DESKTOP); double const old_height = sp_document_height(doc); sp_document_set_width (doc, w, &_px_unit); sp_document_set_height (doc, h, &_px_unit); + sp_document_set_landscape (doc, _landscape); // The origin for the user is in the lower left corner; this point should remain stationary when // changing the page size. The SVG's origin however is in the upper left corner, so we must compensate for this Geom::Translate const vert_offset(Geom::Point(0, (old_height - h))); @@ -357,17 +369,6 @@ PageSizer::setDim (double w, double h, bool changeList) sp_document_done (doc, SP_VERB_NONE, _("Set page size")); } - if ( w != h ) { - _landscapeButton.set_sensitive(true); - _portraitButton.set_sensitive (true); - _landscape = ( w > h ); - _landscapeButton.set_active(_landscape ? true : false); - _portraitButton.set_active (_landscape ? false : true); - } else { - _landscapeButton.set_sensitive(false); - _portraitButton.set_sensitive (false); - } - if (changeList) { Gtk::TreeModel::Row row = (*find_paper_size(w, h)); -- cgit v1.2.3 From 988f9269e7bea39f6216936a350332fec9df5de8 Mon Sep 17 00:00:00 2001 From: bulia byak Date: Thu, 13 Aug 2009 15:54:17 +0000 Subject: fix pulling out second handle when the segment was a lineto (bzr r8479) --- src/nodepath.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/nodepath.cpp b/src/nodepath.cpp index f9a615583..74d0758a7 100644 --- a/src/nodepath.cpp +++ b/src/nodepath.cpp @@ -1219,6 +1219,7 @@ void sp_nodepath_convert_node_type(Inkscape::NodePath::Node *node, Inkscape::Nod Radial handle (node->pos - node->p.pos); if (fabs(line.a - handle.a) < 1e-3) { // lined up // already half-smooth; pull opposite handle too making it fully smooth + node->n.other->code = NR_CURVETO; node->n.pos = node->pos + (node->n.other->pos - node->pos) / 3; } else { // do nothing, adjust_handles will line the handle up, producing a half-smooth node @@ -1228,6 +1229,7 @@ void sp_nodepath_convert_node_type(Inkscape::NodePath::Node *node, Inkscape::Nod Radial handle (node->pos - node->n.pos); if (fabs(line.a - handle.a) < 1e-3) { // lined up // already half-smooth; pull opposite handle too making it fully smooth + node->code = NR_CURVETO; node->p.pos = node->pos + (node->p.other->pos - node->pos) / 3; } else { // do nothing, adjust_handles will line the handle up, producing a half-smooth node -- cgit v1.2.3 From e5ccc7af7d7a3b93a1121c3ef8d75151f559a7b7 Mon Sep 17 00:00:00 2001 From: bulia byak Date: Thu, 13 Aug 2009 20:18:16 +0000 Subject: fix 304018 (bzr r8481) --- src/nodepath.cpp | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/nodepath.cpp b/src/nodepath.cpp index 74d0758a7..5b2a738d3 100644 --- a/src/nodepath.cpp +++ b/src/nodepath.cpp @@ -201,6 +201,19 @@ sp_nodepath_create_helperpaths(Inkscape::NodePath::Path *np) { } } +static void +sp_nodepath_destroy_helperpaths(Inkscape::NodePath::Path *np) { + for (HelperPathList::iterator i = np->helper_path_vec.begin(); i != np->helper_path_vec.end(); ++i) { + for (std::vector::iterator j = (*i).second.begin(); j != (*i).second.end(); ++j) { + GtkObject *temp = *j; + *j = NULL; + gtk_object_destroy(temp); + } + } + np->helper_path_vec.clear(); +} + +/** updates canvas items from the effect's helper paths */ void sp_nodepath_update_helperpaths(Inkscape::NodePath::Path *np) { //std::map > helper_path_vec; @@ -211,13 +224,15 @@ sp_nodepath_update_helperpaths(Inkscape::NodePath::Path *np) { SPLPEItem *lpeitem = SP_LPE_ITEM(np->item); PathEffectList lpelist = sp_lpe_item_get_effect_list(lpeitem); + + /* The number or type or LPEs may have changed, so we need to clear and recreate our + * helper_path_vec to make sure it is in sync */ + sp_nodepath_destroy_helperpaths(np); + sp_nodepath_create_helperpaths(np); + for (PathEffectList::iterator i = lpelist.begin(); i != lpelist.end(); ++i) { Inkscape::LivePathEffect::Effect *lpe = (*i)->lpeobject->get_lpe(); if (lpe) { - /* update canvas items from the effect's helper paths; note that this code relies on the - * fact that getHelperPaths() will always return the same number of helperpaths in the same - * order as during their creation in sp_nodepath_create_helperpaths - */ std::vector hpaths = lpe->getHelperPaths(lpeitem); for (unsigned int j = 0; j < hpaths.size(); ++j) { SPCurve *curve = new SPCurve(hpaths[j]); @@ -229,19 +244,6 @@ sp_nodepath_update_helperpaths(Inkscape::NodePath::Path *np) { } } -static void -sp_nodepath_destroy_helperpaths(Inkscape::NodePath::Path *np) { - for (HelperPathList::iterator i = np->helper_path_vec.begin(); i != np->helper_path_vec.end(); ++i) { - for (std::vector::iterator j = (*i).second.begin(); j != (*i).second.end(); ++j) { - GtkObject *temp = *j; - *j = NULL; - gtk_object_destroy(temp); - } - } - np->helper_path_vec.clear(); -} - - /** * \brief Creates new nodepath from item * -- cgit v1.2.3 From 75cef41a56f87c4fc7ac88d4107321ae5d6e543a Mon Sep 17 00:00:00 2001 From: bulia byak Date: Thu, 13 Aug 2009 22:15:00 +0000 Subject: fix 376068 (bzr r8483) --- src/widgets/gradient-vector.cpp | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/widgets/gradient-vector.cpp b/src/widgets/gradient-vector.cpp index 1f0c07754..ba31470f6 100644 --- a/src/widgets/gradient-vector.cpp +++ b/src/widgets/gradient-vector.cpp @@ -793,7 +793,6 @@ sp_gradient_vector_widget_new (SPGradient *gradient, SPStop *select_stop) gtk_widget_show (w); gtk_box_pack_start (GTK_BOX (vb), w, TRUE, TRUE, PAD); - gtk_object_set_data (GTK_OBJECT (vb), "gradient", gradient); sp_repr_add_listener (SP_OBJECT_REPR(gradient), &grad_edit_dia_repr_events, vb); GtkTooltips *tt = gtk_tooltips_new (); @@ -1013,6 +1012,8 @@ sp_gradient_vector_widget_load_gradient (GtkWidget *widget, SPGradient *gradient g_object_set_data (G_OBJECT (widget), "gradient", gradient); if (gradient) { + gtk_widget_set_sensitive (widget, TRUE); + sp_gradient_ensure_vector (gradient); GtkOptionMenu *mnu = (GtkOptionMenu *)g_object_get_data (G_OBJECT(widget), "stopmenu"); @@ -1026,22 +1027,23 @@ sp_gradient_vector_widget_load_gradient (GtkWidget *widget, SPGradient *gradient SPColor color( SP_RGBA32_R_F (c), SP_RGBA32_G_F (c), SP_RGBA32_B_F (c) ); // set color csel->base->setColor( color ); - } - /* Fill preview */ - GtkWidget *w = static_cast(g_object_get_data(G_OBJECT(widget), "preview")); - sp_gradient_image_set_gradient (SP_GRADIENT_IMAGE (w), gradient); + /* Fill preview */ + GtkWidget *w = static_cast(g_object_get_data(G_OBJECT(widget), "preview")); + sp_gradient_image_set_gradient (SP_GRADIENT_IMAGE (w), gradient); - GtkWidget *mnu = static_cast(g_object_get_data(G_OBJECT(widget), "stopmenu")); - update_stop_list (GTK_WIDGET(mnu), gradient, NULL); + update_stop_list (GTK_WIDGET(mnu), gradient, NULL); - // Once the user edits a gradient, it stops being auto-collectable - if (SP_OBJECT_REPR(gradient)->attribute("inkscape:collect")) { - SPDocument *document = SP_OBJECT_DOCUMENT (gradient); - bool saved = sp_document_get_undo_sensitive(document); - sp_document_set_undo_sensitive (document, false); - SP_OBJECT_REPR(gradient)->setAttribute("inkscape:collect", NULL); - sp_document_set_undo_sensitive (document, saved); + // Once the user edits a gradient, it stops being auto-collectable + if (SP_OBJECT_REPR(gradient)->attribute("inkscape:collect")) { + SPDocument *document = SP_OBJECT_DOCUMENT (gradient); + bool saved = sp_document_get_undo_sensitive(document); + sp_document_set_undo_sensitive (document, false); + SP_OBJECT_REPR(gradient)->setAttribute("inkscape:collect", NULL); + sp_document_set_undo_sensitive (document, saved); + } + } else { // no gradient, disable everything + gtk_widget_set_sensitive (widget, FALSE); } blocked = FALSE; -- cgit v1.2.3 From 928016ccf76555455afa7f7c2818c5b42b847d7b Mon Sep 17 00:00:00 2001 From: bulia byak Date: Thu, 13 Aug 2009 23:57:40 +0000 Subject: fix 407893 (bzr r8484) --- src/widgets/toolbox.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index 8bb15ae6f..25b6e5b94 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -6089,8 +6089,8 @@ sp_text_toolbox_family_changed (GtkComboBoxEntry *, // If querying returned nothing, set the default style of the tool (for new texts) if (result_fontspec == QUERY_STYLE_NOTHING) { - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setStyle("/tools/text/style", css); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + prefs->mergeStyle("/tools/text/style", css); sp_text_edit_dialog_default_set_insensitive (); //FIXME: Replace trough a verb } else @@ -6164,7 +6164,7 @@ sp_text_toolbox_anchoring_toggled (GtkRadioButton *button, if (result_numbers == QUERY_STYLE_NOTHING) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setStyle("/tools/text/style", css); + prefs->mergeStyle("/tools/text/style", css); } sp_style_unref(query); @@ -6243,7 +6243,7 @@ sp_text_toolbox_style_toggled (GtkToggleButton *button, if (result_fontspec == QUERY_STYLE_NOTHING) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setStyle("/tools/text/style", css); + prefs->mergeStyle("/tools/text/style", css); } sp_style_unref(query); @@ -6292,7 +6292,7 @@ sp_text_toolbox_orientation_toggled (GtkRadioButton *button, if (result_numbers == QUERY_STYLE_NOTHING) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setStyle("/tools/text/style", css); + prefs->mergeStyle("/tools/text/style", css); } sp_desktop_set_style (desktop, css, true, true); @@ -6404,7 +6404,7 @@ sp_text_toolbox_size_changed (GtkComboBox *cbox, if (result_numbers == QUERY_STYLE_NOTHING) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setStyle("/tools/text/style", css); + prefs->mergeStyle("/tools/text/style", css); } sp_style_unref(query); -- cgit v1.2.3 From 20bdf3ce1b6adbad380d9a40ac625bf14792f477 Mon Sep 17 00:00:00 2001 From: theAdib Date: Fri, 14 Aug 2009 19:06:19 +0000 Subject: additional file for building nr-test (bzr r8487) --- src/libnr/Makefile_insert | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/libnr/Makefile_insert b/src/libnr/Makefile_insert index 0b90236b8..019dba548 100644 --- a/src/libnr/Makefile_insert +++ b/src/libnr/Makefile_insert @@ -15,6 +15,7 @@ ink_common_sources += \ libnr/nr-blit.h \ libnr/nr-compose-transform.cpp \ libnr/nr-compose-transform.h \ + libnr/nr-compose-reference.h libnr/nr-compose.cpp \ libnr/nr-compose.h \ libnr/nr-convert2geom.h \ -- cgit v1.2.3 From 6640f9b1704d899f258abce4bc2a688e43292666 Mon Sep 17 00:00:00 2001 From: Luca Bruno Date: Sat, 15 Aug 2009 10:38:53 +0000 Subject: * Bug-fixing src/libnr/Makefile_insert to avoid build failure (bzr r8489) --- src/libnr/Makefile_insert | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/libnr/Makefile_insert b/src/libnr/Makefile_insert index 019dba548..5cd2717be 100644 --- a/src/libnr/Makefile_insert +++ b/src/libnr/Makefile_insert @@ -15,7 +15,7 @@ ink_common_sources += \ libnr/nr-blit.h \ libnr/nr-compose-transform.cpp \ libnr/nr-compose-transform.h \ - libnr/nr-compose-reference.h + libnr/nr-compose-reference.h \ libnr/nr-compose.cpp \ libnr/nr-compose.h \ libnr/nr-convert2geom.h \ -- cgit v1.2.3 From d0360261daf192a5bc8a015bfc2273bf81d49faa Mon Sep 17 00:00:00 2001 From: bulia byak Date: Mon, 17 Aug 2009 13:47:20 +0000 Subject: some more ungrabbing needed (bzr r8497) --- src/node-context.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src') diff --git a/src/node-context.cpp b/src/node-context.cpp index 3535ae9e0..7efa57290 100644 --- a/src/node-context.cpp +++ b/src/node-context.cpp @@ -332,6 +332,11 @@ sp_node_context_root_handler(SPEventContext *event_context, GdkEvent *event) event->button.y); Geom::Point const button_dt(desktop->w2d(button_w)); Inkscape::Rubberband::get(desktop)->start(desktop, button_dt); + + if (nc->grabbed) { + sp_canvas_item_ungrab(nc->grabbed, event->button.time); + nc->grabbed = NULL; + } sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate), GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK, @@ -471,6 +476,10 @@ sp_node_context_root_handler(SPEventContext *event_context, GdkEvent *event) desktop->updateNow(); } Inkscape::Rubberband::get(desktop)->stop(); + if (nc->grabbed) { + sp_canvas_item_ungrab(nc->grabbed, event->button.time); + nc->grabbed = NULL; + } ret = TRUE; break; } -- cgit v1.2.3 From 8d957abb36e5610457306c59bc99ee31ea7c153b Mon Sep 17 00:00:00 2001 From: bulia byak Date: Mon, 17 Aug 2009 16:59:56 +0000 Subject: fix ctrl+arrow keys not working after startup (bzr r8498) --- src/widgets/desktop-widget.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index 6d9a61329..0bf09410d 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -555,6 +555,8 @@ sp_desktop_widget_init (SPDesktopWidget *dtw) gtk_box_pack_start (GTK_BOX (dtw->statusbar), dtw->select_status_eventbox, TRUE, TRUE, 0); gtk_widget_show_all (dtw->vbox); + + gtk_widget_grab_focus (GTK_WIDGET(dtw->canvas)); } /** -- cgit v1.2.3 From 6938e3ea9b244c90189ea1df9902f407d2f832a3 Mon Sep 17 00:00:00 2001 From: bulia byak Date: Mon, 17 Aug 2009 18:32:35 +0000 Subject: fix remaining issues of bug 407893 (bzr r8499) --- src/ui/dialog/inkscape-preferences.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 7275165a7..ba07597e7 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -321,7 +321,7 @@ void StyleFromSelectionToTool(Glib::ustring const &prefs_path, StyleSwatch *swat if (!css) return; // only store text style for the text tool - if (prefs_path == "/tools/text") { + if (prefs_path != "/tools/text") { css = sp_css_attr_unset_text (css); } -- cgit v1.2.3 From e6fc7252065fa1d48183d162a74013e533cf4240 Mon Sep 17 00:00:00 2001 From: bulia byak Date: Mon, 17 Aug 2009 23:09:16 +0000 Subject: fix 396851: move absolutizing relative path (added by Ted) out of sp_export_png_file and make sure it works only for rel filenames from hints (both on command line and on batch export), but not for filenames specified on command line or in export dialog; reenable export-id with export-use-hints; fix errors in string comparisons when choosing command line mode; fix crash when opening nonexistent file in command line mode (bzr r8500) --- src/dialogs/export.cpp | 28 ++++++++++++++++++----- src/helper/png-write.cpp | 21 +++--------------- src/main.cpp | 58 +++++++++++++++++++++++++++++++++++++++--------- 3 files changed, 72 insertions(+), 35 deletions(-) (limited to 'src') diff --git a/src/dialogs/export.cpp b/src/dialogs/export.cpp index ee7852924..2e41850ed 100644 --- a/src/dialogs/export.cpp +++ b/src/dialogs/export.cpp @@ -1067,6 +1067,7 @@ sp_export_export_clicked (GtkButton */*button*/, GtkObject *base) if (!SP_ACTIVE_DESKTOP) return; SPNamedView *nv = sp_desktop_namedview(SP_ACTIVE_DESKTOP); + SPDocument *doc = sp_desktop_document (SP_ACTIVE_DESKTOP); GtkWidget *be = (GtkWidget *)gtk_object_get_data(base, "batch_checkbox"); GtkWidget *he = (GtkWidget *)gtk_object_get_data(base, "hide_checkbox"); @@ -1088,10 +1089,24 @@ sp_export_export_clicked (GtkButton */*button*/, GtkObject *base) i != NULL; i = i->next) { SPItem *item = (SPItem *) i->data; + // retrieve export filename hint - const gchar *fn = SP_OBJECT_REPR(item)->attribute("inkscape:export-filename"); - if (!fn) { - fn = create_filepath_from_id (SP_OBJECT_ID(item), NULL); + const gchar *filename = SP_OBJECT_REPR(item)->attribute("inkscape:export-filename"); + gchar *path = 0; + if (!filename) { + path = create_filepath_from_id (SP_OBJECT_ID(item), NULL); + } else { + //Make relative paths go from the document location, if possible: + if (!g_path_is_absolute(filename) && doc->uri) { + gchar *dirname = g_path_get_dirname(doc->uri); + if (dirname) { + path = g_build_filename(dirname, filename, NULL); + g_free(dirname); + } + } + if (!path) { + path = g_strdup(filename); + } } // retrieve export dpi hints @@ -1112,14 +1127,14 @@ sp_export_export_clicked (GtkButton */*button*/, GtkObject *base) if (width > 1 && height > 1) { /* Do export */ - if (!sp_export_png_file (sp_desktop_document (SP_ACTIVE_DESKTOP), fn, + if (!sp_export_png_file (doc, path, *area, width, height, dpi, dpi, nv->pagecolor, NULL, NULL, TRUE, // overwrite without asking hide ? (GSList *) sp_desktop_selection(SP_ACTIVE_DESKTOP)->itemList() : NULL )) { gchar * error; - gchar * safeFile = Inkscape::IO::sanitizeString(fn); + gchar * safeFile = Inkscape::IO::sanitizeString(path); error = g_strdup_printf(_("Could not export to filename %s.\n"), safeFile); sp_ui_error_dialog(error); g_free(safeFile); @@ -1128,6 +1143,7 @@ sp_export_export_clicked (GtkButton */*button*/, GtkObject *base) } } n++; + g_free(path); sp_export_progress_callback((float)n/num, base); } @@ -1178,9 +1194,9 @@ sp_export_export_clicked (GtkButton */*button*/, GtkObject *base) gtk_entry_set_text(GTK_ENTRY(fe), filename_ext); gchar *fn = g_path_get_basename (filename_ext); - gchar *progress_text = g_strdup_printf (_("Exporting %s (%lu x %lu)"), fn, width, height); g_free (fn); + GtkWidget *prog_dlg = create_progress_dialog (base, progress_text); g_free (progress_text); diff --git a/src/helper/png-write.cpp b/src/helper/png-write.cpp index 3ac900680..b1c135db0 100644 --- a/src/helper/png-write.cpp +++ b/src/helper/png-write.cpp @@ -414,20 +414,7 @@ sp_export_png_file(SPDocument *doc, gchar const *filename, g_return_val_if_fail(height >= 1, false); g_return_val_if_fail(!area.hasZeroArea(), false); - //Make relative paths absolute, if possible: - gchar *path = 0; - if (!g_path_is_absolute(filename) && doc->uri) { - gchar *dirname = g_path_get_dirname(doc->uri); - if (dirname) { - path = g_build_filename(dirname, filename, NULL); - g_free(dirname); - } - } - if (!path) { - path = g_strdup(filename); - } - - if (!force_overwrite && !sp_ui_overwrite_file(path)) { + if (!force_overwrite && !sp_ui_overwrite_file(filename)) { /* Remark: We return true so as not to invoke an error dialog in case export is cancelled by the user; currently this is safe because the callers only act when false is returned. If this changes in the future we need better distinction of return types (e.g., use int) @@ -493,12 +480,12 @@ sp_export_png_file(SPDocument *doc, gchar const *filename, if ((width < 256) || ((width * height) < 32768)) { ebp.px = nr_pixelstore_64K_new(FALSE, 0); ebp.sheight = 65536 / (4 * width); - write_status = sp_png_write_rgba_striped(doc, path, width, height, xdpi, ydpi, sp_export_get_rows, &ebp); + write_status = sp_png_write_rgba_striped(doc, filename, width, height, xdpi, ydpi, sp_export_get_rows, &ebp); nr_pixelstore_64K_free(ebp.px); } else { ebp.sheight = 64; ebp.px = g_try_new(guchar, 4 * ebp.sheight * width); - write_status = sp_png_write_rgba_striped(doc, path, width, height, xdpi, ydpi, sp_export_get_rows, &ebp); + write_status = sp_png_write_rgba_striped(doc, filename, width, height, xdpi, ydpi, sp_export_get_rows, &ebp); g_free(ebp.px); } @@ -508,8 +495,6 @@ sp_export_png_file(SPDocument *doc, gchar const *filename, /* Free arena */ nr_object_unref((NRObject *) arena); - g_free(path); - return write_status; } diff --git a/src/main.cpp b/src/main.cpp index 12732ef2c..f96d99e11 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -91,6 +91,7 @@ #include #include #include +#include #ifdef WIN32 //#define REPLACEARGS_ANSI @@ -628,13 +629,13 @@ main(int argc, char **argv) || !strcmp(argv[i], "-e") || !strncmp(argv[i], "--export-png", 12) || !strcmp(argv[i], "-l") - || !strncmp(argv[i], "--export-plain-svg", 12) + || !strncmp(argv[i], "--export-plain-svg", 18) || !strcmp(argv[i], "-i") || !strncmp(argv[i], "--export-area-drawing", 21) || !strcmp(argv[i], "-D") - || !strncmp(argv[i], "--export-area-page", 20) + || !strncmp(argv[i], "--export-area-page", 18) || !strcmp(argv[i], "-C") - || !strncmp(argv[i], "--export-id", 12) + || !strncmp(argv[i], "--export-id", 11) || !strcmp(argv[i], "-P") || !strncmp(argv[i], "--export-ps", 11) || !strcmp(argv[i], "-E") @@ -652,11 +653,11 @@ main(int argc, char **argv) || !strcmp(argv[i], "-S") || !strncmp(argv[i], "--query-all", 11) || !strcmp(argv[i], "-X") - || !strncmp(argv[i], "--query-x", 13) + || !strncmp(argv[i], "--query-x", 9) || !strcmp(argv[i], "-Y") - || !strncmp(argv[i], "--query-y", 14) + || !strncmp(argv[i], "--query-y", 9) || !strcmp(argv[i], "--vacuum-defs") - || !strncmp(argv[i], "--shell", 7) + || !strcmp(argv[i], "--shell") ) { /* main_console handles any exports -- not the gui */ @@ -962,12 +963,27 @@ void sp_process_file_list(GSList *fl) { while (fl) { const gchar *filename = (gchar *)fl->data; - SPDocument *doc = Inkscape::Extension::open(NULL, filename); + + SPDocument *doc = NULL; + try { + doc = Inkscape::Extension::open(NULL, filename); + } catch (Inkscape::Extension::Input::no_extension_found &e) { + doc = NULL; + } catch (Inkscape::Extension::Input::open_failed &e) { + doc = NULL; + } + if (doc == NULL) { - doc = Inkscape::Extension::open(Inkscape::Extension::db.get(SP_MODULE_KEY_INPUT_SVG), filename); + try { + doc = Inkscape::Extension::open(Inkscape::Extension::db.get(SP_MODULE_KEY_INPUT_SVG), filename); + } catch (Inkscape::Extension::Input::no_extension_found &e) { + doc = NULL; + } catch (Inkscape::Extension::Input::open_failed &e) { + doc = NULL; + } } if (doc == NULL) { - g_warning("Specified document %s cannot be opened (is it a valid SVG file?)", filename); + g_warning("Specified document %s cannot be opened (does not exist or not a valid SVG file)", filename); } else { if (sp_vacuum_defs) { vacuum_document(doc); @@ -979,7 +995,7 @@ void sp_process_file_list(GSList *fl) if (sp_global_printer) { sp_print_document_to_file(doc, sp_global_printer); } - if (sp_export_png) { + if (sp_export_png || (sp_export_id && sp_export_use_hints)) { sp_do_export_png(doc); } if (sp_export_svg) { @@ -1208,6 +1224,7 @@ static void sp_do_export_png(SPDocument *doc) { const gchar *filename = NULL; + bool filename_from_hint = false; gdouble dpi = 0.0; if (sp_export_use_hints && (!sp_export_id && !sp_export_area_drawing)) { @@ -1254,6 +1271,7 @@ sp_do_export_png(SPDocument *doc) filename = sp_export_png; } else { filename = fn_hint; + filename_from_hint = true; } } else { g_warning ("Export filename hint not found for the object."); @@ -1393,6 +1411,23 @@ sp_do_export_png(SPDocument *doc) } } + gchar *path = 0; + if (filename_from_hint) { + //Make relative paths go from the document location, if possible: + if (!g_path_is_absolute(filename) && doc->uri) { + gchar *dirname = g_path_get_dirname(doc->uri); + if (dirname) { + path = g_build_filename(dirname, filename, NULL); + g_free(dirname); + } + } + if (!path) { + path = g_strdup(filename); + } + } else { + path = g_strdup(filename); + } + g_print("Background RRGGBBAA: %08x\n", bgcolor); g_print("Area %g:%g:%g:%g exported to %lu x %lu pixels (%g dpi)\n", area[Geom::X][0], area[Geom::Y][0], area[Geom::X][1], area[Geom::Y][1], width, height, dpi); @@ -1400,11 +1435,12 @@ sp_do_export_png(SPDocument *doc) g_print("Bitmap saved as: %s\n", filename); if ((width >= 1) && (height >= 1) && (width <= PNG_UINT_31_MAX) && (height <= PNG_UINT_31_MAX)) { - sp_export_png_file(doc, filename, area, width, height, dpi, dpi, bgcolor, NULL, NULL, true, sp_export_id_only ? items : NULL); + sp_export_png_file(doc, path, area, width, height, dpi, dpi, bgcolor, NULL, NULL, true, sp_export_id_only ? items : NULL); } else { g_warning("Calculated bitmap dimensions %lu %lu are out of range (1 - %lu). Nothing exported.", width, height, (unsigned long int)PNG_UINT_31_MAX); } + g_free (path); g_slist_free (items); } -- cgit v1.2.3 From d51d8cb08911f192062bf4ab2783044dc42dbc90 Mon Sep 17 00:00:00 2001 From: bulia byak Date: Tue, 18 Aug 2009 01:18:17 +0000 Subject: patch by Alvin Penner for bug 415079 (bzr r8503) --- src/live_effects/spiro.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/live_effects/spiro.cpp b/src/live_effects/spiro.cpp index 612348ab8..c734f91ee 100644 --- a/src/live_effects/spiro.cpp +++ b/src/live_effects/spiro.cpp @@ -731,6 +731,8 @@ spiro_iter(spiro_seg *s, bandmat *m, int *perm, double *v, int n) add_mat_line(m, v, derivs[1][1], -ends[1][1], 1, j, jk0r, jinc, nmat); add_mat_line(m, v, derivs[2][1], -ends[1][2], 1, j, jk1r, jinc, nmat); add_mat_line(m, v, derivs[3][1], -ends[1][3], 1, j, jk2r, jinc, nmat); + v[jthl] = mod_2pi(v[jthl]); + v[jthr] = mod_2pi(v[jthr]); j += jinc; } if (cyclic) { -- cgit v1.2.3 From 5998f4cf01cf342e9c3e119627d995b4478331ae Mon Sep 17 00:00:00 2001 From: bulia byak Date: Tue, 18 Aug 2009 21:57:49 +0000 Subject: fix for 415168 (bzr r8507) --- src/seltrans.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/seltrans.cpp b/src/seltrans.cpp index 359038527..1087ec7b5 100644 --- a/src/seltrans.cpp +++ b/src/seltrans.cpp @@ -525,10 +525,10 @@ void Inkscape::SelTrans::ungrab() if (_current_relative_affine.isTranslation()) { sp_document_done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT, _("Move")); - } else if (_current_relative_affine.isScale()) { + } else if (_current_relative_affine.without_translation().isScale()) { sp_document_done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT, _("Scale")); - } else if (_current_relative_affine.isRotation()) { + } else if (_current_relative_affine.without_translation().isRotation()) { sp_document_done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT, _("Rotate")); } else { -- cgit v1.2.3 From 52875b77bb19f1dc4aeb8afd94fee05252681322 Mon Sep 17 00:00:00 2001 From: bulia byak Date: Tue, 18 Aug 2009 22:53:04 +0000 Subject: patch from 289774 (bzr r8508) --- src/pen-context.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/pen-context.cpp b/src/pen-context.cpp index 4c9627071..144717332 100644 --- a/src/pen-context.cpp +++ b/src/pen-context.cpp @@ -538,9 +538,6 @@ static gint pen_handle_button_press(SPPenContext *const pc, GdkEventButton const p = event_dt; spdc_endpoint_snap(pc, p, bevent.state); /* Snap node only if not hitting anchor. */ spdc_pen_set_subsequent_point(pc, p, true); - if (pc->polylines_only) { - spdc_pen_finish_segment(pc, p, bevent.state); - } } } @@ -784,10 +781,8 @@ pen_handle_button_release(SPPenContext *const pc, GdkEventButton const &revent) switch (pc->state) { case SP_PEN_CONTEXT_POINT: case SP_PEN_CONTEXT_CONTROL: - if (!pc->polylines_only) { - spdc_endpoint_snap(pc, p, revent.state); - spdc_pen_finish_segment(pc, p, revent.state); - } + spdc_endpoint_snap(pc, p, revent.state); + spdc_pen_finish_segment(pc, p, revent.state); break; case SP_PEN_CONTEXT_CLOSE: spdc_endpoint_snap(pc, p, revent.state); -- cgit v1.2.3 From cdbf85902231b4d70c122dcd1c6e0a4d682ddbf9 Mon Sep 17 00:00:00 2001 From: bulia byak Date: Wed, 19 Aug 2009 00:10:57 +0000 Subject: fix 167857 (bzr r8509) --- src/inkscape.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/inkscape.cpp b/src/inkscape.cpp index 01e11a916..fc9aff78e 100644 --- a/src/inkscape.cpp +++ b/src/inkscape.cpp @@ -805,8 +805,10 @@ inkscape_application_init (const gchar *argv0, gboolean use_gui) } } - inkscape_load_menus(inkscape); - sp_input_load_from_preferences(); + if (use_gui) { + inkscape_load_menus(inkscape); + sp_input_load_from_preferences(); + } /* set language for user interface according setting in preferences */ Glib::ustring ui_language = prefs->getString("/ui/language"); -- cgit v1.2.3 From 77fcf0fd68cb88879c317a41c59b7ab3a2bbb751 Mon Sep 17 00:00:00 2001 From: bulia byak Date: Fri, 21 Aug 2009 15:26:16 +0000 Subject: absolutize user-entered path from doc location (bzr r8514) --- src/dialogs/export.cpp | 49 ++++++++++++++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/dialogs/export.cpp b/src/dialogs/export.cpp index 2e41850ed..ce0786a01 100644 --- a/src/dialogs/export.cpp +++ b/src/dialogs/export.cpp @@ -1060,6 +1060,23 @@ filename_add_extension (const gchar *filename, const gchar *extension) } } +gchar *absolutize_path_from_document_location (SPDocument *doc, const gchar *filename) +{ + gchar *path = 0; + //Make relative paths go from the document location, if possible: + if (!g_path_is_absolute(filename) && doc->uri) { + gchar *dirname = g_path_get_dirname(doc->uri); + if (dirname) { + path = g_build_filename(dirname, filename, NULL); + g_free(dirname); + } + } + if (!path) { + path = g_strdup(filename); + } + return path; +} + /// Called when export button is clicked static void sp_export_export_clicked (GtkButton */*button*/, GtkObject *base) @@ -1096,17 +1113,7 @@ sp_export_export_clicked (GtkButton */*button*/, GtkObject *base) if (!filename) { path = create_filepath_from_id (SP_OBJECT_ID(item), NULL); } else { - //Make relative paths go from the document location, if possible: - if (!g_path_is_absolute(filename) && doc->uri) { - gchar *dirname = g_path_get_dirname(doc->uri); - if (dirname) { - path = g_build_filename(dirname, filename, NULL); - g_free(dirname); - } - } - if (!path) { - path = g_strdup(filename); - } + path = absolutize_path_from_document_location(doc, filename); } // retrieve export dpi hints @@ -1174,7 +1181,13 @@ sp_export_export_clicked (GtkButton */*button*/, GtkObject *base) return; } - gchar *dirname = g_path_get_dirname(filename); + // make sure that .png is the extension of the file: + gchar * filename_ext = filename_add_extension(filename, "png"); + gtk_entry_set_text(GTK_ENTRY(fe), filename_ext); + + gchar *path = absolutize_path_from_document_location(doc, filename_ext); + + gchar *dirname = g_path_get_dirname(path); if ( dirname == NULL || !Inkscape::IO::file_test(dirname, (GFileTest)(G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)) ) { @@ -1185,15 +1198,12 @@ sp_export_export_clicked (GtkButton */*button*/, GtkObject *base) g_free(safeDir); g_free(error); g_free(dirname); + g_free(path); return; } g_free(dirname); - // make sure that .png is the extension of the file: - gchar * filename_ext = filename_add_extension(filename, "png"); - gtk_entry_set_text(GTK_ENTRY(fe), filename_ext); - - gchar *fn = g_path_get_basename (filename_ext); + gchar *fn = g_path_get_basename (path); gchar *progress_text = g_strdup_printf (_("Exporting %s (%lu x %lu)"), fn, width, height); g_free (fn); @@ -1201,14 +1211,14 @@ sp_export_export_clicked (GtkButton */*button*/, GtkObject *base) g_free (progress_text); /* Do export */ - if (!sp_export_png_file (sp_desktop_document (SP_ACTIVE_DESKTOP), filename_ext, + if (!sp_export_png_file (sp_desktop_document (SP_ACTIVE_DESKTOP), path, Geom::Rect(Geom::Point(x0, y0), Geom::Point(x1, y1)), width, height, xdpi, ydpi, nv->pagecolor, sp_export_progress_callback, base, FALSE, hide ? (GSList *) sp_desktop_selection(SP_ACTIVE_DESKTOP)->itemList() : NULL )) { gchar * error; - gchar * safeFile = Inkscape::IO::sanitizeString(filename); + gchar * safeFile = Inkscape::IO::sanitizeString(path); error = g_strdup_printf(_("Could not export to filename %s.\n"), safeFile); sp_ui_error_dialog(error); g_free(safeFile); @@ -1304,6 +1314,7 @@ sp_export_export_clicked (GtkButton */*button*/, GtkObject *base) } g_free (filename_ext); + g_free (path); } -- cgit v1.2.3 From 7f9a43abd614c3cd3f7d389adab029fbc1ccb808 Mon Sep 17 00:00:00 2001 From: bulia byak Date: Fri, 21 Aug 2009 22:30:43 +0000 Subject: fix 379817 (bzr r8515) --- src/nodepath.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/nodepath.cpp b/src/nodepath.cpp index 5b2a738d3..29a04c92b 100644 --- a/src/nodepath.cpp +++ b/src/nodepath.cpp @@ -1201,7 +1201,9 @@ void sp_nodepath_convert_node_type(Inkscape::NodePath::Node *node, Inkscape::Nod // pull opposite handle in line with the existing one } } else if (no_handles) { - if (both_segments_are_lines OR both_segments_are_curves) { + if (both_segments_are_lines + OR both_segments_are_curves + OR one_is_line_but_the_curveside_node_is_selected_and_has_two_handles) { //pull both handles } else { // pull the handle opposite to line segment, making node half-smooth @@ -1213,6 +1215,10 @@ void sp_nodepath_convert_node_type(Inkscape::NodePath::Node *node, Inkscape::Nod bool p_is_line = sp_node_side_is_line(node, &node->p); bool n_is_line = sp_node_side_is_line(node, &node->n); +#define NODE_HAS_P_HANDLE(node) ((Geom::L2(node->pos - node->p.pos) > 1e-6)) +#define NODE_HAS_N_HANDLE(node) ((Geom::L2(node->pos - node->n.pos) > 1e-6)) +#define NODE_HAS_BOTH_HANDLES(node) ((Geom::L2(node->pos - node->n.pos) > 1e-6) && (Geom::L2(node->pos - node->p.pos) > 1e-6)) + if (p_has_handle && n_has_handle) { // do nothing, adjust_handles will line them up } else if (p_has_handle || n_has_handle) { @@ -1252,9 +1258,13 @@ void sp_nodepath_convert_node_type(Inkscape::NodePath::Node *node, Inkscape::Nod node->p.pos = node->pos - (len / Geom::L2(node->n.pos - node->pos)) * (node->n.pos - node->pos); } } else if (!p_has_handle && !n_has_handle) { - if ((p_is_line && n_is_line) || (!p_is_line && node->p.other && !n_is_line && node->n.other)) { - // no handles, but both segments are either lnes or curves: - //pull both handles + if ((p_is_line && n_is_line) || (!p_is_line && node->p.other && !n_is_line && node->n.other) || + (n_is_line && node->p.other && node->p.other->selected && NODE_HAS_BOTH_HANDLES(node->p.other)) || + (p_is_line && node->n.other && node->n.other->selected && NODE_HAS_BOTH_HANDLES(node->n.other)) + ) { + // no handles, but: both segments are either lines or curves; or: one is line and the + // node at the other side is selected (so it was just smoothed too!) and now has both + // handles: then pull both handles here // convert both to curves: node->code = NR_CURVETO; -- cgit v1.2.3 From 3eb6bebd0ebc2b5543b10b56e9b5760541f3ed66 Mon Sep 17 00:00:00 2001 From: bulia byak Date: Sat, 22 Aug 2009 00:29:34 +0000 Subject: fix 166186 (bzr r8516) --- src/object-edit.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/object-edit.cpp b/src/object-edit.cpp index ac62a12db..c8e3ab204 100644 --- a/src/object-edit.cpp +++ b/src/object-edit.cpp @@ -1111,7 +1111,7 @@ public: * [control] constrain inner arg to round per PI/4 */ void -SpiralKnotHolderEntityInner::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint state) +SpiralKnotHolderEntityInner::knot_set(Geom::Point const &p, Geom::Point const &origin, guint state) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); int snaps = prefs->getInt("/options/rotationsnapsperpi/value", 12); @@ -1121,10 +1121,16 @@ SpiralKnotHolderEntityInner::knot_set(Geom::Point const &p, Geom::Point const &/ gdouble dx = p[Geom::X] - spiral->cx; gdouble dy = p[Geom::Y] - spiral->cy; + gdouble moved_y = p[Geom::Y] - origin[Geom::Y]; + if (state & GDK_MOD1_MASK) { // adjust divergence by vertical drag, relative to rad - double new_exp = (spiral->rad + dy)/(spiral->rad); - spiral->exp = new_exp > 0? new_exp : 0; + if (spiral->rad > 0) { + double exp_delta = 0.1*moved_y/(spiral->rad); // arbitrary multiplier to slow it down + spiral->exp += exp_delta; + if (spiral->exp < 1e-3) + spiral->exp = 1e-3; + } } else { // roll/unroll from inside gdouble arg_t0; -- cgit v1.2.3 From 9806e07e0d9c6229cd023a3871c29f0d5af5c978 Mon Sep 17 00:00:00 2001 From: bulia byak Date: Sat, 22 Aug 2009 02:21:36 +0000 Subject: fix 416940 (bzr r8517) --- src/widgets/gradient-vector.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/widgets/gradient-vector.cpp b/src/widgets/gradient-vector.cpp index ba31470f6..c884604a2 100644 --- a/src/widgets/gradient-vector.cpp +++ b/src/widgets/gradient-vector.cpp @@ -1084,10 +1084,18 @@ sp_gradient_vector_widget_destroy (GtkObject *object, gpointer /*data*/) gradient = (GObject*)g_object_get_data (G_OBJECT (object), "gradient"); - if (gradient && SP_OBJECT_REPR(gradient)) { - /* Remove signals connected to us */ - /* fixme: may use _connect_while_alive as well */ + sigc::connection *release_connection = (sigc::connection *)g_object_get_data(G_OBJECT(object), "gradient_release_connection"); + sigc::connection *modified_connection = (sigc::connection *)g_object_get_data(G_OBJECT(object), "gradient_modified_connection"); + + if (gradient) { + g_assert( release_connection != NULL ); + g_assert( modified_connection != NULL ); + release_connection->disconnect(); + modified_connection->disconnect(); sp_signal_disconnect_by_data (gradient, object); + } + + if (gradient && SP_OBJECT_REPR(gradient)) { sp_repr_remove_listener_by_data (SP_OBJECT_REPR(gradient), object); } } -- cgit v1.2.3 From 9cc89eaa165ec2a27c81bca683dfd5f546f890eb Mon Sep 17 00:00:00 2001 From: bulia byak Date: Sat, 22 Aug 2009 18:16:34 +0000 Subject: fix 272408 and address fixmes: fix inheriting of dasharray and dashoffset, make them correctly handle inherit values; test case for the bug is added to the testsuite (bzr r8519) --- src/style.cpp | 45 +++++++++++++++++++++++++++++---------------- src/style.h | 1 + 2 files changed, 30 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/style.cpp b/src/style.cpp index dd8169282..0b946f348 100644 --- a/src/style.cpp +++ b/src/style.cpp @@ -711,11 +711,14 @@ sp_style_read(SPStyle *style, SPObject *object, Inkscape::XML::Node *repr) sp_style_read_dash(style, val); } } + if (!style->stroke_dashoffset_set) { - /* fixme */ val = repr->attribute("stroke-dashoffset"); if (sp_svg_number_read_d(val, &style->stroke_dash.offset)) { style->stroke_dashoffset_set = TRUE; + } else if (val && !strcmp(val, "inherit")) { + style->stroke_dashoffset_set = TRUE; + style->stroke_dashoffset_inherit = TRUE; } else { style->stroke_dashoffset_set = FALSE; } @@ -1146,9 +1149,11 @@ sp_style_merge_property(SPStyle *style, gint id, gchar const *val) break; case SP_PROP_STROKE_DASHOFFSET: if (!style->stroke_dashoffset_set) { - /* fixme */ if (sp_svg_number_read_d(val, &style->stroke_dash.offset)) { style->stroke_dashoffset_set = TRUE; + } else if (val && !strcmp(val, "inherit")) { + style->stroke_dashoffset_set = TRUE; + style->stroke_dashoffset_inherit = TRUE; } else { style->stroke_dashoffset_set = FALSE; } @@ -1526,11 +1531,7 @@ sp_style_merge_from_parent(SPStyle *const style, SPStyle const *const parent) style->stroke_miterlimit.value = parent->stroke_miterlimit.value; } - if (!style->stroke_dasharray_set && parent->stroke_dasharray_set) { - /** \todo - * This code looks wrong. Why does the logic differ from the - * above properties? Similarly dashoffset below. - */ + if (!style->stroke_dasharray_set || style->stroke_dasharray_inherit) { style->stroke_dash.n_dash = parent->stroke_dash.n_dash; if (style->stroke_dash.n_dash > 0) { style->stroke_dash.dash = g_new(gdouble, style->stroke_dash.n_dash); @@ -1538,7 +1539,7 @@ sp_style_merge_from_parent(SPStyle *const style, SPStyle const *const parent) } } - if (!style->stroke_dashoffset_set && parent->stroke_dashoffset_set) { + if (!style->stroke_dashoffset_set || style->stroke_dashoffset_inherit) { style->stroke_dash.offset = parent->stroke_dash.offset; } @@ -2100,10 +2101,11 @@ sp_style_merge_from_dying_parent(SPStyle *const style, SPStyle const *const pare } /* Note: this will need length handling once dasharray_offset supports units. */ - if (!style->stroke_dashoffset_set && parent->stroke_dashoffset_set) { + if ((!style->stroke_dashoffset_set || style->stroke_dashoffset_inherit) && parent->stroke_dashoffset_set && !parent->stroke_dashoffset_inherit) { style->stroke_dash.offset = parent->stroke_dash.offset; style->stroke_dashoffset_set = parent->stroke_dashoffset_set; - /* fixme: we don't currently allow stroke-dashoffset to be `inherit'. TODO: Try to + style->stroke_dashoffset_inherit = parent->stroke_dashoffset_inherit; + /* TODO: Try to * represent it as a normal SPILength; though will need to do something about existing * users of stroke_dash.offset and stroke_dashoffset_set. */ } @@ -2326,9 +2328,13 @@ sp_style_write_string(SPStyle const *const style, guint const flags) /** \todo fixme: */ if (style->stroke_dashoffset_set) { - Inkscape::CSSOStringStream os; - os << "stroke-dashoffset:" << style->stroke_dash.offset << ";"; - p += g_strlcpy(p, os.str().c_str(), c + BMAX - p); + if (style->stroke_dashoffset_inherit) { + p += g_snprintf(p, c + BMAX - p, "stroke-dashoffset:inherit;"); + } else { + Inkscape::CSSOStringStream os; + os << "stroke-dashoffset:" << style->stroke_dash.offset << ";"; + p += g_strlcpy(p, os.str().c_str(), c + BMAX - p); + } } else if (flags == SP_STYLE_FLAG_ALWAYS) { p += g_snprintf(p, c + BMAX - p, "stroke-dashoffset:0;"); } @@ -2478,9 +2484,13 @@ sp_style_write_difference(SPStyle const *const from, SPStyle const *const to) } /* fixme: */ if (from->stroke_dashoffset_set) { - Inkscape::CSSOStringStream os; - os << "stroke-dashoffset:" << from->stroke_dash.offset << ";"; - p += g_strlcpy(p, os.str().c_str(), c + BMAX - p); + if (from->stroke_dashoffset_inherit) { + p += g_snprintf(p, c + BMAX - p, "stroke-dashoffset:inherit;"); + } else { + Inkscape::CSSOStringStream os; + os << "stroke-dashoffset:" << from->stroke_dash.offset << ";"; + p += g_strlcpy(p, os.str().c_str(), c + BMAX - p); + } } p += sp_style_write_iscale24(p, c + BMAX - p, "stroke-opacity", &from->stroke_opacity, &to->stroke_opacity, SP_STYLE_FLAG_IFDIFF); } @@ -2559,6 +2569,9 @@ sp_style_clear(SPStyle *style) g_free(style->stroke_dash.dash); } + style->stroke_dasharray_inherit = FALSE; + style->stroke_dashoffset_inherit = FALSE; + /** \todo fixme: Do that text manipulation via parents */ SPObject *object = style->object; SPDocument *document = style->document; diff --git a/src/style.h b/src/style.h index d5ccc4901..9a2c72f16 100644 --- a/src/style.h +++ b/src/style.h @@ -336,6 +336,7 @@ struct SPStyle { unsigned stroke_dasharray_set : 1; unsigned stroke_dasharray_inherit : 1; unsigned stroke_dashoffset_set : 1; + unsigned stroke_dashoffset_inherit : 1; /** stroke-opacity */ SPIScale24 stroke_opacity; -- cgit v1.2.3 From 6c059afd9ecdd6fc153e8e9ce0a9e5817fa3086c Mon Sep 17 00:00:00 2001 From: bulia byak Date: Sat, 22 Aug 2009 21:49:32 +0000 Subject: fix rendering of testcase errorhandling-nosuchlpe.svg: make sure shapes do not calculate the curve if they have a broken lpe, instead reading it directly from d= and issuing a warning (bzr r8520) --- src/sp-ellipse.cpp | 13 +++++++++++++ src/sp-lpe-item.cpp | 18 ++++++++++++++++++ src/sp-lpe-item.h | 1 + src/sp-spiral.cpp | 17 +++++++++++++++-- src/sp-star.cpp | 29 ++++++++++++++++++++++++++++- 5 files changed, 75 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/sp-ellipse.cpp b/src/sp-ellipse.cpp index ff2e39044..769fa54fd 100644 --- a/src/sp-ellipse.cpp +++ b/src/sp-ellipse.cpp @@ -28,6 +28,7 @@ #include "display/curve.h" #include #include <2geom/transforms.h> +#include <2geom/pathvector.h> #include "document.h" #include "sp-ellipse.h" @@ -184,6 +185,18 @@ sp_genericellipse_update_patheffect(SPLPEItem *lpeitem, bool write) /* Can't we use arcto in this method? */ static void sp_genericellipse_set_shape(SPShape *shape) { + if (sp_lpe_item_has_broken_path_effect(SP_LPE_ITEM(shape))) { + 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"); + if (SP_OBJECT_REPR(shape)->attribute("d")) { + // unconditionally read the curve from d, if any, to preserve appearance + Geom::PathVector pv = sp_svg_read_pathv(SP_OBJECT_REPR(shape)->attribute("d")); + SPCurve *cold = new SPCurve(pv); + sp_shape_set_curve_insync (shape, cold, TRUE); + cold->unref(); + } + return; + } + double rx, ry, s, e; double x0, y0, x1, y1, x2, y2, x3, y3; double len; diff --git a/src/sp-lpe-item.cpp b/src/sp-lpe-item.cpp index 90e9b2d6d..a27344ebc 100644 --- a/src/sp-lpe-item.cpp +++ b/src/sp-lpe-item.cpp @@ -598,6 +598,24 @@ void sp_lpe_item_up_current_path_effect(SPLPEItem *lpeitem) sp_lpe_item_cleanup_original_path_recursive(lpeitem); } +/** used for shapes so they can see if they should also disable shape calculation and read from d= */ +bool sp_lpe_item_has_broken_path_effect(SPLPEItem *lpeitem) +{ + if (lpeitem->path_effect_list->empty()) + return false; + + // go through the list; if some are unknown or invalid, return true + PathEffectList effect_list = sp_lpe_item_get_effect_list(lpeitem); + for (PathEffectList::iterator it = effect_list.begin(); it != effect_list.end(); it++) + { + LivePathEffectObject *lpeobj = (*it)->lpeobject; + if (!lpeobj || !lpeobj->get_lpe()) + return true; + } + + return false; +} + bool sp_lpe_item_has_path_effect(SPLPEItem *lpeitem) { diff --git a/src/sp-lpe-item.h b/src/sp-lpe-item.h index e9561c2c2..5b6cc241e 100644 --- a/src/sp-lpe-item.h +++ b/src/sp-lpe-item.h @@ -64,6 +64,7 @@ void sp_lpe_item_remove_current_path_effect(SPLPEItem *lpeitem, bool keep_paths) void sp_lpe_item_down_current_path_effect(SPLPEItem *lpeitem); void sp_lpe_item_up_current_path_effect(SPLPEItem *lpeitem); bool sp_lpe_item_has_path_effect(SPLPEItem *lpeitem); +bool sp_lpe_item_has_broken_path_effect(SPLPEItem *lpeitem); bool sp_lpe_item_has_path_effect_recursive(SPLPEItem *lpeitem); Inkscape::LivePathEffect::Effect* sp_lpe_item_has_path_effect_of_type(SPLPEItem *lpeitem, int type); bool sp_lpe_item_can_accept_freehand_shape(SPLPEItem *lpeitem); diff --git a/src/sp-spiral.cpp b/src/sp-spiral.cpp index 71906fcc0..629715332 100644 --- a/src/sp-spiral.cpp +++ b/src/sp-spiral.cpp @@ -20,6 +20,7 @@ #include "svg/svg.h" #include "attributes.h" #include <2geom/bezier-utils.h> +#include <2geom/pathvector.h> #include "display/curve.h" #include #include "xml/repr.h" @@ -418,11 +419,23 @@ sp_spiral_fit_and_draw (SPSpiral const *spiral, static void sp_spiral_set_shape (SPShape *shape) { + SPSpiral *spiral = SP_SPIRAL(shape); + + if (sp_lpe_item_has_broken_path_effect(SP_LPE_ITEM(shape))) { + g_warning ("The spiral shape has unknown LPE on it! Convert to path to make it editable preserving the appearance; editing it as spiral will remove the bad LPE"); + if (SP_OBJECT_REPR(shape)->attribute("d")) { + // unconditionally read the curve from d, if any, to preserve appearance + Geom::PathVector pv = sp_svg_read_pathv(SP_OBJECT_REPR(shape)->attribute("d")); + SPCurve *cold = new SPCurve(pv); + sp_shape_set_curve_insync (shape, cold, TRUE); + cold->unref(); + } + return; + } + Geom::Point darray[SAMPLE_SIZE + 1]; double t; - SPSpiral *spiral = SP_SPIRAL(shape); - SP_OBJECT (spiral)->requestModified(SP_OBJECT_MODIFIED_FLAG); SPCurve *c = new SPCurve (); diff --git a/src/sp-star.cpp b/src/sp-star.cpp index 71c9ad1c7..9cffd952c 100644 --- a/src/sp-star.cpp +++ b/src/sp-star.cpp @@ -28,6 +28,8 @@ #include "xml/repr.h" #include "document.h" +#include <2geom/pathvector.h> + #include "sp-star.h" static void sp_star_class_init (SPStarClass *klass); @@ -428,6 +430,21 @@ sp_star_set_shape (SPShape *shape) { SPStar *star = SP_STAR (shape); + // perhaps we should convert all our shapes into LPEs without source path + // and with knotholders for parameters, then this situation will be handled automatically + // by disabling the entire stack (including the shape LPE) + if (sp_lpe_item_has_broken_path_effect(SP_LPE_ITEM(shape))) { + g_warning ("The star shape has unknown LPE on it! Convert to path to make it editable preserving the appearance; editing it as star will remove the bad LPE"); + if (SP_OBJECT_REPR(shape)->attribute("d")) { + // unconditionally read the curve from d, if any, to preserve appearance + Geom::PathVector pv = sp_svg_read_pathv(SP_OBJECT_REPR(shape)->attribute("d")); + SPCurve *cold = new SPCurve(pv); + sp_shape_set_curve_insync (shape, cold, TRUE); + cold->unref(); + } + return; + } + SPCurve *c = new SPCurve (); gint sides = star->sides; @@ -500,7 +517,7 @@ sp_star_set_shape (SPShape *shape) bool success = sp_lpe_item_perform_path_effect(SP_LPE_ITEM (shape), c_lpe); if (success) { sp_shape_set_curve_insync (shape, c_lpe, TRUE); - } + } c_lpe->unref(); } c->unref(); @@ -587,3 +604,13 @@ sp_star_get_xy (SPStar *star, SPStarPoint point, gint index, bool randomized) } } +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : -- cgit v1.2.3 From f095e3d40934d8fd36c36c7062955f4ad819cb4b Mon Sep 17 00:00:00 2001 From: bulia byak Date: Sun, 23 Aug 2009 00:21:12 +0000 Subject: fix half-smooth nodes updating when next to a line but with curve code (bzr r8521) --- src/nodepath.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/nodepath.cpp b/src/nodepath.cpp index 29a04c92b..8f17ae013 100644 --- a/src/nodepath.cpp +++ b/src/nodepath.cpp @@ -1215,8 +1215,6 @@ void sp_nodepath_convert_node_type(Inkscape::NodePath::Node *node, Inkscape::Nod bool p_is_line = sp_node_side_is_line(node, &node->p); bool n_is_line = sp_node_side_is_line(node, &node->n); -#define NODE_HAS_P_HANDLE(node) ((Geom::L2(node->pos - node->p.pos) > 1e-6)) -#define NODE_HAS_N_HANDLE(node) ((Geom::L2(node->pos - node->n.pos) > 1e-6)) #define NODE_HAS_BOTH_HANDLES(node) ((Geom::L2(node->pos - node->n.pos) > 1e-6) && (Geom::L2(node->pos - node->p.pos) > 1e-6)) if (p_has_handle && n_has_handle) { @@ -1319,7 +1317,7 @@ void sp_node_moveto(Inkscape::NodePath::Node *node, Geom::Point p) Inkscape::NodePath::Node *node_n = NULL; if (node->p.other) { - if (node->code == NR_LINETO) { + if (sp_node_side_is_line(node, &node->p)) { sp_node_adjust_handle(node, 1); sp_node_adjust_handle(node->p.other, -1); node_p = node->p.other; @@ -1330,7 +1328,7 @@ void sp_node_moveto(Inkscape::NodePath::Node *node, Geom::Point p) } } if (node->n.other) { - if (node->n.other->code == NR_LINETO) { + if (sp_node_side_is_line(node, &node->n)) { sp_node_adjust_handle(node, -1); sp_node_adjust_handle(node->n.other, 1); node_n = node->n.other; -- cgit v1.2.3 From d8f681faf74d46b77fed976d16c52ac7404517d1 Mon Sep 17 00:00:00 2001 From: bulia byak Date: Sun, 23 Aug 2009 01:40:44 +0000 Subject: patch from 416549 (bzr r8522) --- src/xml/rebase-hrefs.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/xml/rebase-hrefs.cpp b/src/xml/rebase-hrefs.cpp index ec43bb178..c3876725d 100644 --- a/src/xml/rebase-hrefs.cpp +++ b/src/xml/rebase-hrefs.cpp @@ -201,6 +201,9 @@ Inkscape::XML::calc_abs_doc_base(gchar const *const doc_base) */ void Inkscape::XML::rebase_hrefs(SPDocument *const doc, gchar const *const new_base, bool const spns) { + if (!doc->base) + return; + gchar *const old_abs_base = calc_abs_doc_base(doc->base); gchar *const new_abs_base = calc_abs_doc_base(new_base); -- cgit v1.2.3 From b3f3d7ad268f67e27792ecfbcebab1bbbe646b74 Mon Sep 17 00:00:00 2001 From: Diederik van Lierop Date: Sun, 23 Aug 2009 13:55:47 +0000 Subject: When dragging a knot along a constraint line, then allow snapping the position of the mouse pointer instead of its projection onto the constraint line (for this a check box has been added to the preferences dialog) (bzr r8523) --- src/knot-holder-entity.cpp | 25 +++++++++++++++++++++++-- src/object-snapper.cpp | 6 +++--- src/snap.cpp | 3 +++ src/ui/dialog/inkscape-preferences.cpp | 4 ++++ src/ui/dialog/inkscape-preferences.h | 2 +- 5 files changed, 34 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/knot-holder-entity.cpp b/src/knot-holder-entity.cpp index 4225dd9e3..bf7505f3c 100644 --- a/src/knot-holder-entity.cpp +++ b/src/knot-holder-entity.cpp @@ -91,9 +91,12 @@ KnotHolderEntity::snap_knot_position(Geom::Point const &p) { Geom::Matrix const i2d (sp_item_i2d_affine(item)); Geom::Point s = p * i2d; + SnapManager &m = desktop->namedview->snap_manager; m.setup(desktop, true, item); + m.freeSnapReturnByRef(Inkscape::SnapPreferences::SNAPPOINT_NODE, s, Inkscape::SNAPSOURCE_HANDLE); + return s * i2d.inverse(); } @@ -102,10 +105,28 @@ KnotHolderEntity::snap_knot_position_constrained(Geom::Point const &p, Inkscape: { Geom::Matrix const i2d (sp_item_i2d_affine(item)); Geom::Point s = p * i2d; - Inkscape::Snapper::ConstraintLine transformed_constraint = Inkscape::Snapper::ConstraintLine(constraint.getPoint() * i2d, (constraint.getPoint() + constraint.getDirection()) * i2d - constraint.getPoint() * i2d); + SnapManager &m = desktop->namedview->snap_manager; m.setup(desktop, true, item); - m.constrainedSnapReturnByRef(Inkscape::SnapPreferences::SNAPPOINT_NODE, s, Inkscape::SNAPSOURCE_HANDLE, transformed_constraint); + + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + if ((prefs->getBool("/options/snapmousepointer/value", false))) { // legacy behavior (pre v0.47) + // Snapping the mouse pointer instead of the constrained position of the knot allows to snap to + // things which don't intersect with the constraint line. This should be handled by the + // smart dynamic guides which are yet to be implemented, making this behavior more clean and + // transparent. With the current implementation it leads to unexpected results, and it doesn't + // allow accurately controlling what is being snapped to. + + // freeSnap() will try snapping point p. This will not take into account the constraint, which + // is therefore to be enforced after snap_knot_position_constrained() has finished + m.freeSnapReturnByRef(Inkscape::SnapPreferences::SNAPPOINT_NODE, s, Inkscape::SNAPSOURCE_HANDLE); + } else { + // constrainedSnap() will first project the point p onto the constraint line and then try to snap along that line. + // This way the constraint is already enforced, no need to worry about that later on + Inkscape::Snapper::ConstraintLine transformed_constraint = Inkscape::Snapper::ConstraintLine(constraint.getPoint() * i2d, (constraint.getPoint() + constraint.getDirection()) * i2d - constraint.getPoint() * i2d); + m.constrainedSnapReturnByRef(Inkscape::SnapPreferences::SNAPPOINT_NODE, s, Inkscape::SNAPSOURCE_HANDLE, transformed_constraint); + } + return s * i2d.inverse(); } diff --git a/src/object-snapper.cpp b/src/object-snapper.cpp index aece2e9ec..af0d9f1a2 100644 --- a/src/object-snapper.cpp +++ b/src/object-snapper.cpp @@ -161,8 +161,8 @@ void Inkscape::ObjectSnapper::_findCandidates(SPObject* parent, // This item is within snapping range, so record it as a candidate _candidates->push_back(SnapCandidate(item, clip_or_mask, additional_affine)); // For debugging: print the id of the candidate to the console - // SPObject *obj = (SPObject*)item; - // std::cout << "Snap candidate added: " << obj->id << std::endl; + //SPObject *obj = (SPObject*)item; + //std::cout << "Snap candidate added: " << obj->id << std::endl; } } } @@ -554,7 +554,7 @@ void Inkscape::ObjectSnapper::_snapPathsConstrained(SnappedConstraints &sc, // The intersection point of the constraint line with any path, // must lie within two points on the constraintline: p_min_on_cl and p_max_on_cl // The distance between those points is twice the snapping tolerance - Geom::Point const p_proj_on_cl = c.projection(p); + Geom::Point const p_proj_on_cl = p; // projection has already been taken care of in constrainedSnap in the snapmanager; Geom::Point const p_min_on_cl = _snapmanager->getDesktop()->dt2doc(p_proj_on_cl - getSnapperTolerance() * direction_vector); Geom::Point const p_max_on_cl = _snapmanager->getDesktop()->dt2doc(p_proj_on_cl + getSnapperTolerance() * direction_vector); diff --git a/src/snap.cpp b/src/snap.cpp index f0769e0a1..c03f2e1e6 100644 --- a/src/snap.cpp +++ b/src/snap.cpp @@ -378,7 +378,10 @@ Inkscape::SnappedPoint SnapManager::constrainedSnap(Inkscape::SnapPreferences::P items_to_ignore = _items_to_ignore; } + + // First project the mouse pointer onto the constraint Geom::Point pp = constraint.projection(p); + // Then try to snap the projected point SnappedConstraints sc; SnapperList const snappers = getSnappers(); diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index ba07597e7..9b6d9e084 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -230,6 +230,10 @@ void InkscapePreferences::initPageSnapping() _page_snapping.add_line( false, _("Weight factor:"), _snap_weight, "", _("When multiple snap solutions are found, then Inkscape can either prefer the closest transformation (when set to 0), or prefer the node that was initially the closest to the pointer (when set to 1)"), true); + _snap_mouse_pointer.init( _("Snap the mouse pointer when dragging a constrained knot"), "/options/snapmousepointer/value", false); + _page_snapping.add_line( false, "", _snap_mouse_pointer, "", + _("When dragging a knot along a constraint line, then snap the position of the mouse pointer instead of snapping the projection of the knot onto the constraint line")); + this->AddPage(_page_snapping, _("Snapping"), PREFS_PAGE_SNAPPING); } diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h index 7bcbe7d49..aa0da3a37 100644 --- a/src/ui/dialog/inkscape-preferences.h +++ b/src/ui/dialog/inkscape-preferences.h @@ -131,7 +131,7 @@ protected: PrefCheckButton _wheel_zoom; Gtk::HScale *_slider_snapping_delay; - PrefCheckButton _snap_indicator, _snap_closest_only; + PrefCheckButton _snap_indicator, _snap_closest_only, _snap_mouse_pointer; PrefCombo _steps_rot_snap; PrefCheckButton _steps_compass; -- cgit v1.2.3 From 1be1c60bf07ae15b7e6be8a9944d9e8ddcbe7dc2 Mon Sep 17 00:00:00 2001 From: bulia byak Date: Sun, 23 Aug 2009 15:16:44 +0000 Subject: fix 417676 (bzr r8525) --- src/rdf.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/rdf.cpp b/src/rdf.cpp index f0b174922..0a8fd51f6 100644 --- a/src/rdf.cpp +++ b/src/rdf.cpp @@ -205,7 +205,7 @@ struct rdf_license_t rdf_licenses [] = { }, { N_("FreeArt"), - "http://artlibre.org/licence.php/lalgb.html", + "http://artlibre.org/licence/lal", rdf_license_freeart, }, -- cgit v1.2.3 From ac652771931c1730c623848c75e8cbdd3f9fde84 Mon Sep 17 00:00:00 2001 From: Diederik van Lierop Date: Sun, 23 Aug 2009 19:56:43 +0000 Subject: - fix bug #414142 (Moving path nodes twice is hard when snap is enabled) - constrained snap: use projected point to calculate the snap distance (bzr r8526) --- src/desktop.cpp | 9 ++++++++- src/snap.cpp | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/desktop.cpp b/src/desktop.cpp index 6b7c20094..8c070786e 100644 --- a/src/desktop.cpp +++ b/src/desktop.cpp @@ -226,11 +226,18 @@ SPDesktop::init (SPNamedView *nv, SPCanvas *aCanvas) setDisplayModeNormal(); } + // The order in which these canvas items are added determines the z-order. It's therefore + // important to add the tempgroup (which will contain the snapindicator) before adding the + // controls. Only this way one will be able to quickly (before the snap indicator has + // disappeared) reselect a node after snapping it. If the z-order is wrong however, this + // will not work (the snap indicator is on top of the node handler; is the snapindicator + // being selected? or does it intercept some of the events that should have gone to the + // node handler? see bug https://bugs.launchpad.net/inkscape/+bug/414142) gridgroup = (SPCanvasGroup *) sp_canvas_item_new (main, SP_TYPE_CANVAS_GROUP, NULL); guides = (SPCanvasGroup *) sp_canvas_item_new (main, SP_TYPE_CANVAS_GROUP, NULL); sketch = (SPCanvasGroup *) sp_canvas_item_new (main, SP_TYPE_CANVAS_GROUP, NULL); - controls = (SPCanvasGroup *) sp_canvas_item_new (main, SP_TYPE_CANVAS_GROUP, NULL); tempgroup = (SPCanvasGroup *) sp_canvas_item_new (main, SP_TYPE_CANVAS_GROUP, NULL); + controls = (SPCanvasGroup *) sp_canvas_item_new (main, SP_TYPE_CANVAS_GROUP, NULL); /* Push select tool to the bottom of stack */ /** \todo diff --git a/src/snap.cpp b/src/snap.cpp index c03f2e1e6..545607889 100644 --- a/src/snap.cpp +++ b/src/snap.cpp @@ -393,7 +393,7 @@ Inkscape::SnappedPoint SnapManager::constrainedSnap(Inkscape::SnapPreferences::P delete items_to_ignore; } - return findBestSnap(p, source_type, sc, true); + return findBestSnap(pp, source_type, sc, true); } /** -- cgit v1.2.3 From 9ffb0ad4544d606b7ff3a04fc8e0b5f11ef7befe Mon Sep 17 00:00:00 2001 From: bulia byak Date: Mon, 24 Aug 2009 19:56:23 +0000 Subject: patch from 417179 by Alvin (bzr r8530) --- src/live_effects/spiro.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/live_effects/spiro.cpp b/src/live_effects/spiro.cpp index c734f91ee..4aad25f08 100644 --- a/src/live_effects/spiro.cpp +++ b/src/live_effects/spiro.cpp @@ -773,6 +773,7 @@ spiro_iter(spiro_seg *s, bandmat *m, int *perm, double *v, int n) s[i].ks[k] += dk; norm += dk * dk; } + s[i].ks[0] = 2.0*mod_2pi(s[i].ks[0]/2.0); } return norm; } -- cgit v1.2.3 From 8c1ee442de482d936402052dce5fa598f8b63e5e Mon Sep 17 00:00:00 2001 From: bulia byak Date: Wed, 26 Aug 2009 01:10:16 +0000 Subject: patch for divisor limit (bzr r8533) --- src/ui/dialog/filter-effects-dialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp index baf46970a..9301d20b7 100644 --- a/src/ui/dialog/filter-effects-dialog.cpp +++ b/src/ui/dialog/filter-effects-dialog.cpp @@ -2192,7 +2192,7 @@ void FilterEffectsDialog::init_settings_widgets() //TRANSLATORS: for info on "Kernel", see http://en.wikipedia.org/wiki/Kernel_(matrix) _convolve_matrix = _settings->add_matrix(SP_ATTR_KERNELMATRIX, _("Kernel:"), _("This matrix describes the convolve operation that is applied to the input image in order to calculate the pixel colors at the output. Different arrangements of values in this matrix result in various possible visual effects. An identity matrix would lead to a motion blur effect (parallel to the matrix diagonal) while a matrix filled with a constant non-zero value would lead to a common blur effect.")); _convolve_order->signal_attr_changed().connect(sigc::mem_fun(*this, &FilterEffectsDialog::convolve_order_changed)); - _settings->add_spinslider(0, SP_ATTR_DIVISOR, _("Divisor:"), 0, 20, 1, 0.1, 2, _("After applying the kernelMatrix to the input image to yield a number, that number is divided by divisor to yield the final destination color value. A divisor that is the sum of all the matrix values tends to have an evening effect on the overall color intensity of the result.")); + _settings->add_spinslider(0, SP_ATTR_DIVISOR, _("Divisor:"), 0, 1000, 1, 0.1, 2, _("After applying the kernelMatrix to the input image to yield a number, that number is divided by divisor to yield the final destination color value. A divisor that is the sum of all the matrix values tends to have an evening effect on the overall color intensity of the result.")); _settings->add_spinslider(0, SP_ATTR_BIAS, _("Bias:"), -10, 10, 1, 0.01, 1, _("This value is added to each component. This is useful to define a constant value as the zero response of the filter.")); _settings->add_combo(CONVOLVEMATRIX_EDGEMODE_DUPLICATE, SP_ATTR_EDGEMODE, _("Edge Mode:"), ConvolveMatrixEdgeModeConverter, _("Determines how to extend the input image as necessary with color values so that the matrix operations can be applied when the kernel is positioned at or near the edge of the input image.")); _settings->add_checkbutton(false, SP_ATTR_PRESERVEALPHA, _("Preserve Alpha"), "true", "false", _("If set, the alpha channel won't be altered by this filter primitive.")); -- cgit v1.2.3 From 4c098e924f306852e7489c181e0224a958c49003 Mon Sep 17 00:00:00 2001 From: bulia byak Date: Wed, 26 Aug 2009 01:48:34 +0000 Subject: patch by Richard Hughes for 417777 (bzr r8534) --- src/sp-text.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/sp-text.cpp b/src/sp-text.cpp index 61947311c..0d3fd791b 100644 --- a/src/sp-text.cpp +++ b/src/sp-text.cpp @@ -937,11 +937,11 @@ void TextTagAttributes::addToRotate(unsigned index, double delta) SVGLength zero_length; zero_length = 0.0; - if (attributes.rotate.size() < index + 1) { + if (attributes.rotate.size() < index + 2) { if (attributes.rotate.empty()) - attributes.rotate.resize(index + 1, zero_length); + attributes.rotate.resize(index + 2, zero_length); else - attributes.rotate.resize(index + 1, attributes.rotate.back()); + attributes.rotate.resize(index + 2, attributes.rotate.back()); } attributes.rotate[index] = mod360(attributes.rotate[index].computed + delta); } -- cgit v1.2.3 From 652e8a65fb563f02f8613b98094056e62f9deaf8 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Wed, 26 Aug 2009 21:57:36 +0000 Subject: fix bug #377958: don't write inkscape:path-effect to plain svg (bzr r8540) --- src/sp-lpe-item.cpp | 12 +++++++----- src/sp-path.cpp | 16 +++++++++------- 2 files changed, 16 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/sp-lpe-item.cpp b/src/sp-lpe-item.cpp index a27344ebc..e4d278e34 100644 --- a/src/sp-lpe-item.cpp +++ b/src/sp-lpe-item.cpp @@ -283,11 +283,13 @@ sp_lpe_item_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape:: { SPLPEItem *lpeitem = (SPLPEItem *) object; - if ( sp_lpe_item_has_path_effect(lpeitem) ) { - std::string href = patheffectlist_write_svg(*lpeitem->path_effect_list); - repr->setAttribute("inkscape:path-effect", href.c_str()); - } else { - repr->setAttribute("inkscape:path-effect", NULL); + if (flags & SP_OBJECT_WRITE_EXT) { + if ( sp_lpe_item_has_path_effect(lpeitem) ) { + std::string href = patheffectlist_write_svg(*lpeitem->path_effect_list); + repr->setAttribute("inkscape:path-effect", href.c_str()); + } else { + repr->setAttribute("inkscape:path-effect", NULL); + } } if (((SPObjectClass *)(parent_class))->write) { diff --git a/src/sp-path.cpp b/src/sp-path.cpp index 04ad386d9..a2f0f3169 100644 --- a/src/sp-path.cpp +++ b/src/sp-path.cpp @@ -328,13 +328,15 @@ sp_path_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML: repr->setAttribute("d", NULL); } - SPPath *path = (SPPath *) object; - if ( path->original_curve != NULL ) { - gchar *str = sp_svg_write_path(path->original_curve->get_pathvector()); - repr->setAttribute("inkscape:original-d", str); - g_free(str); - } else { - repr->setAttribute("inkscape:original-d", NULL); + if (flags & SP_OBJECT_WRITE_EXT) { + SPPath *path = (SPPath *) object; + if ( path->original_curve != NULL ) { + gchar *str = sp_svg_write_path(path->original_curve->get_pathvector()); + repr->setAttribute("inkscape:original-d", str); + g_free(str); + } else { + repr->setAttribute("inkscape:original-d", NULL); + } } SP_PATH(shape)->connEndPair.writeRepr(repr); -- cgit v1.2.3 From b2767f2f915bdbda8b80e0373a3b6c1d74c0a0fb Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Wed, 26 Aug 2009 22:36:23 +0000 Subject: lpe-spiro: fix problem with rounding and very nearly zero closing line segments (bzr r8541) --- src/live_effects/lpe-spiro.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/live_effects/lpe-spiro.cpp b/src/live_effects/lpe-spiro.cpp index 72b77622d..794fd980e 100644 --- a/src/live_effects/lpe-spiro.cpp +++ b/src/live_effects/lpe-spiro.cpp @@ -158,7 +158,9 @@ LPESpiro::doEffect(SPCurve * curve) Geom::Path::const_iterator curve_endit = path_it->end_default(); // this determines when the loop has to stop if (path_it->closed()) { // if the path is closed, maybe we have to stop a bit earlier because the closing line segment has zerolength. - if (path_it->back_closed().isDegenerate()) { + const Geom::Curve &closingline = path_it->back_closed(); // the closing line segment is always of type Geom::LineSegment. + if (are_near(closingline.initialPoint(), closingline.finalPoint())) { + // closingline.isDegenerate() did not work, because it only checks for *exact* zero length, which goes wrong for relative coordinates and rounding errors... // the closing line segment has zero-length. So stop before that one! curve_endit = path_it->end_open(); } -- cgit v1.2.3 From 1852e80a93d680cb4ae0d4fb9938d1a10132d243 Mon Sep 17 00:00:00 2001 From: bulia byak Date: Sat, 29 Aug 2009 03:00:10 +0000 Subject: patch by Alvin for 418798 (bzr r8545) --- src/live_effects/spiro.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/live_effects/spiro.cpp b/src/live_effects/spiro.cpp index 4aad25f08..abc9c94ca 100644 --- a/src/live_effects/spiro.cpp +++ b/src/live_effects/spiro.cpp @@ -731,8 +731,10 @@ spiro_iter(spiro_seg *s, bandmat *m, int *perm, double *v, int n) add_mat_line(m, v, derivs[1][1], -ends[1][1], 1, j, jk0r, jinc, nmat); add_mat_line(m, v, derivs[2][1], -ends[1][2], 1, j, jk1r, jinc, nmat); add_mat_line(m, v, derivs[3][1], -ends[1][3], 1, j, jk2r, jinc, nmat); - v[jthl] = mod_2pi(v[jthl]); - v[jthr] = mod_2pi(v[jthr]); + if (jthl >= 0) + v[jthl] = mod_2pi(v[jthl]); + if (jthr >= 0) + v[jthr] = mod_2pi(v[jthr]); j += jinc; } if (cyclic) { -- cgit v1.2.3 From e3967c89d45350487cf0738f7158a7541ef0fb18 Mon Sep 17 00:00:00 2001 From: bulia byak Date: Sun, 30 Aug 2009 21:57:40 +0000 Subject: remove debug warning (bzr r8549) --- src/filters/componenttransfer.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/filters/componenttransfer.cpp b/src/filters/componenttransfer.cpp index 557d884e0..27e63eaa6 100644 --- a/src/filters/componenttransfer.cpp +++ b/src/filters/componenttransfer.cpp @@ -142,7 +142,6 @@ static void sp_feComponentTransfer_children_modified(SPFeComponentTransfer *sp_c static void sp_feComponentTransfer_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref) { - g_warning("child_added"); SPFeComponentTransfer *f = SP_FECOMPONENTTRANSFER(object); if (((SPObjectClass *) feComponentTransfer_parent_class)->child_added) -- cgit v1.2.3 From cec295d1ec0e76e198c841f3cd6f8c216e5d1de8 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Mon, 31 Aug 2009 05:21:41 +0000 Subject: Fixed crash when invoked and no profile is set. (bzr r8551) --- src/widgets/sp-color-icc-selector.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/widgets/sp-color-icc-selector.cpp b/src/widgets/sp-color-icc-selector.cpp index 392a52c6d..80a551f6a 100644 --- a/src/widgets/sp-color-icc-selector.cpp +++ b/src/widgets/sp-color-icc-selector.cpp @@ -753,7 +753,7 @@ void ColorICCSelector::_updateSliders( gint ignore ) gtk_adjustment_set_value( _fooAdj[i], val ); } - if ( _prof->getTransfToSRGB8() ) { + if ( _prof && _prof->getTransfToSRGB8() ) { for ( guint i = 0; i < _profChannelCount; i++ ) { if ( static_cast(i) != ignore ) { icUInt16Number* scratch = getScratch(); -- cgit v1.2.3 From f08220ae5271d5a642b9ad8611db9febc599b2f2 Mon Sep 17 00:00:00 2001 From: Josh Andler Date: Tue, 1 Sep 2009 21:18:27 +0000 Subject: Commenting out Whiteboard configure flag (bzr r8552) --- src/Makefile.am | 10 +++++----- src/ui/dialog/Makefile_insert | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index fb876f231..4d57de850 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -16,9 +16,9 @@ bin_PROGRAMS = inkscape inkview # Libraries which should be compiled by "make" but not installed. # Use this only for libraries that are really standalone, rather than for # source tree subdirectories. -if WITH_INKBOARD -libpedro = pedro/libpedro.a -endif +#if WITH_INKBOARD +#libpedro = pedro/libpedro.a +#endif noinst_LIBRARIES = \ libinkscape.a \ dom/libdom.a \ @@ -111,8 +111,8 @@ include filters/Makefile_insert include helper/Makefile_insert include inkjar/Makefile_insert include io/Makefile_insert -include pedro/Makefile_insert -include jabber_whiteboard/Makefile_insert +#include pedro/Makefile_insert +#include jabber_whiteboard/Makefile_insert include libcroco/Makefile_insert include libgdl/Makefile_insert include libnr/Makefile_insert diff --git a/src/ui/dialog/Makefile_insert b/src/ui/dialog/Makefile_insert index 5cd437c26..565a24ecc 100644 --- a/src/ui/dialog/Makefile_insert +++ b/src/ui/dialog/Makefile_insert @@ -1,6 +1,6 @@ ## Makefile.am fragment sourced by src/Makefile.am. -if WITH_INKBOARD +##if WITH_INKBOARD ## inkboard_dialogs = \ ## ui/dialog/whiteboard-connect.cpp \ ## ui/dialog/whiteboard-connect.h \ @@ -8,7 +8,7 @@ if WITH_INKBOARD ## ui/dialog/whiteboard-sharewithchat.h \ ## ui/dialog/whiteboard-sharewithuser.cpp \ ## ui/dialog/whiteboard-sharewithuser.h -endif +##endif ink_common_sources += \ ui/dialog/aboutbox.cpp \ -- cgit v1.2.3 From eaa130a15fed549fe4fb7202155a68e345eca68a Mon Sep 17 00:00:00 2001 From: Josh Andler Date: Wed, 2 Sep 2009 18:23:50 +0000 Subject: Remove preference entry for dot size in Pencil tool since it no longer creates dots (bzr r8553) --- src/ui/dialog/inkscape-preferences.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 9b6d9e084..b75fdc6c2 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -486,7 +486,6 @@ void InkscapePreferences::initPageTools() this->AddPage(_page_pencil, _("Pencil"), iter_tools, PREFS_PAGE_TOOLS_PENCIL); this->AddSelcueCheckbox(_page_pencil, "/tools/freehand/pencil", true); this->AddNewObjectsStyle(_page_pencil, "/tools/freehand/pencil"); - this->AddDotSizeSpinbutton(_page_pencil, "/tools/freehand/pencil", 3.0); _page_pencil.add_group_header( _("Sketch mode")); _page_pencil.add_line( true, "", _pencil_average_all_sketches, "", _("If on, the sketch result will be the normal average of all sketches made, instead of averaging the old result with the new sketch.")); -- cgit v1.2.3 From 68fad804cd97a9b170e15a18f706d1a795016cdf Mon Sep 17 00:00:00 2001 From: bulia byak Date: Thu, 3 Sep 2009 16:22:43 +0000 Subject: restore ctrl+click dots in pencil (bzr r8555) --- src/pencil-context.cpp | 13 ++++++++++++- src/ui/dialog/inkscape-preferences.cpp | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/pencil-context.cpp b/src/pencil-context.cpp index 31b7441d4..d6050ba04 100644 --- a/src/pencil-context.cpp +++ b/src/pencil-context.cpp @@ -256,6 +256,14 @@ pencil_handle_button_press(SPPencilContext *const pc, GdkEventButton const &beve SnapManager &m = desktop->namedview->snap_manager; m.setup(desktop); + if (bevent.state & GDK_CONTROL_MASK) { + if (!(bevent.state & GDK_SHIFT_MASK)) { + m.freeSnapReturnByRef(Inkscape::SnapPreferences::SNAPPOINT_NODE, p, Inkscape::SNAPSOURCE_HANDLE); + } + spdc_create_single_dot(event_context, p, "/tools/freehand/pencil", bevent.state); + ret = true; + break; + } if (anchor) { p = anchor->dp; desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Continuing selected path")); @@ -415,7 +423,10 @@ pencil_handle_button_release(SPPencilContext *const pc, GdkEventButton const &re case SP_PENCIL_CONTEXT_IDLE: /* Releasing button in idle mode means single click */ /* We have already set up start point/anchor in button_press */ - pc->state = SP_PENCIL_CONTEXT_ADDLINE; + if (!(revent.state & GDK_CONTROL_MASK)) { + // Ctrl+click creates a single point so only set context in ADDLINE mode when Ctrl isn't pressed + pc->state = SP_PENCIL_CONTEXT_ADDLINE; + } ret = TRUE; break; case SP_PENCIL_CONTEXT_ADDLINE: diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index b75fdc6c2..9b6d9e084 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -486,6 +486,7 @@ void InkscapePreferences::initPageTools() this->AddPage(_page_pencil, _("Pencil"), iter_tools, PREFS_PAGE_TOOLS_PENCIL); this->AddSelcueCheckbox(_page_pencil, "/tools/freehand/pencil", true); this->AddNewObjectsStyle(_page_pencil, "/tools/freehand/pencil"); + this->AddDotSizeSpinbutton(_page_pencil, "/tools/freehand/pencil", 3.0); _page_pencil.add_group_header( _("Sketch mode")); _page_pencil.add_line( true, "", _pencil_average_all_sketches, "", _("If on, the sketch result will be the normal average of all sketches made, instead of averaging the old result with the new sketch.")); -- cgit v1.2.3 From fc45282a2bdcd65fe35ab5d766f3ff143dab4968 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 3 Sep 2009 21:50:20 -0500 Subject: Removing the caligraphic presets file and making the same strings translatable in the preferences-skeleton.h (bzr r8558) --- src/preferences-skeleton.h | 17 +++++++++++------ src/ui/dialog/calligraphic-presets.h | 14 -------------- 2 files changed, 11 insertions(+), 20 deletions(-) delete mode 100644 src/ui/dialog/calligraphic-presets.h (limited to 'src') diff --git a/src/preferences-skeleton.h b/src/preferences-skeleton.h index db21697ca..6185ff729 100644 --- a/src/preferences-skeleton.h +++ b/src/preferences-skeleton.h @@ -3,6 +3,11 @@ #include +#ifdef N_ +#undef N_ +#endif +#define N_(x) x + /* The root's "version" attribute describes the preferences file format version. * It should only increase when a backwards-incompatible change is made, * and special handling has to be added to the preferences class to update @@ -90,12 +95,12 @@ static char const preferences_skeleton[] = " mass=\"2\" angle=\"30\" width=\"15\" thinning=\"10\" flatness=\"90\" cap_rounding=\"0.0\" usecurrent=\"1\"\n" " tracebackground=\"0\" usepressure=\"1\" usetilt=\"0\" keep_selected=\"1\">\n" " \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" " \n" " \n" " Date: Sat, 5 Sep 2009 22:01:24 +0000 Subject: patch by Adrian Johnson for 166678 (bzr r8561) --- src/document.cpp | 19 ------------------- src/document.h | 2 -- src/sp-root.h | 1 - src/ui/dialog/print.cpp | 2 +- src/ui/widget/page-sizer.cpp | 23 +++++++++++------------ 5 files changed, 12 insertions(+), 35 deletions(-) (limited to 'src') diff --git a/src/document.cpp b/src/document.cpp index 17057e1dc..288e52c6d 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -572,25 +572,6 @@ gdouble sp_document_height(SPDocument *document) return root->height.computed; } -void sp_document_set_landscape (SPDocument *document, gboolean landscape) -{ - SPRoot *root = SP_ROOT(document->root); - - root->landscape = landscape; - SP_OBJECT (root)->updateRepr(); -} - -gboolean sp_document_landscape(SPDocument *document) -{ - g_return_val_if_fail(document != NULL, 0.0); - g_return_val_if_fail(document->priv != NULL, 0.0); - g_return_val_if_fail(document->root != NULL, 0.0); - - SPRoot *root = SP_ROOT(document->root); - - return root->landscape; -} - Geom::Point sp_document_dimensions(SPDocument *doc) { return Geom::Point(sp_document_width(doc), sp_document_height(doc)); diff --git a/src/document.h b/src/document.h index 63ca221a2..696e568ad 100644 --- a/src/document.h +++ b/src/document.h @@ -185,14 +185,12 @@ SPDocument *sp_document_create(Inkscape::XML::Document *rdoc, gchar const *uri, gdouble sp_document_width(SPDocument *document); gdouble sp_document_height(SPDocument *document); -gboolean sp_document_landscape(SPDocument *document); Geom::Point sp_document_dimensions(SPDocument *document); struct SPUnit; void sp_document_set_width(SPDocument *document, gdouble width, const SPUnit *unit); void sp_document_set_height(SPDocument *document, gdouble height, const SPUnit *unit); -void sp_document_set_landscape(SPDocument *document, gboolean landscape); #define SP_DOCUMENT_URI(d) (d->uri) #define SP_DOCUMENT_NAME(d) (d->name) diff --git a/src/sp-root.h b/src/sp-root.h index 8b3cb4f0c..7976eb2f4 100644 --- a/src/sp-root.h +++ b/src/sp-root.h @@ -36,7 +36,6 @@ struct SPRoot : public SPGroup { SVGLength y; SVGLength width; SVGLength height; - gboolean landscape; /* viewBox; */ unsigned int viewBox_set : 1; diff --git a/src/ui/dialog/print.cpp b/src/ui/dialog/print.cpp index d98d6a49e..f9db265d6 100644 --- a/src/ui/dialog/print.cpp +++ b/src/ui/dialog/print.cpp @@ -189,7 +189,7 @@ Print::Print(SPDocument *doc, SPItem *base) : gdouble doc_width = sp_document_width(_doc) * PT_PER_PX; gdouble doc_height = sp_document_height(_doc) * PT_PER_PX; GtkPaperSize *paper_size; - if (sp_document_landscape(_doc)) { + if (doc_width > doc_height) { gtk_page_setup_set_orientation (page_setup, GTK_PAGE_ORIENTATION_LANDSCAPE); paper_size = gtk_paper_size_new_custom("custom", "custom", doc_height, doc_width, GTK_UNIT_POINTS); diff --git a/src/ui/widget/page-sizer.cpp b/src/ui/widget/page-sizer.cpp index 6817d815b..02688a55e 100644 --- a/src/ui/widget/page-sizer.cpp +++ b/src/ui/widget/page-sizer.cpp @@ -345,23 +345,11 @@ PageSizer::setDim (double w, double h, bool changeList) _changedw_connection.block(); _changedh_connection.block(); - if ( w != h ) { - _landscapeButton.set_sensitive(true); - _portraitButton.set_sensitive (true); - _landscape = ( w > h ); - _landscapeButton.set_active(_landscape ? true : false); - _portraitButton.set_active (_landscape ? false : true); - } else { - _landscapeButton.set_sensitive(false); - _portraitButton.set_sensitive (false); - } - if (SP_ACTIVE_DESKTOP && !_widgetRegistry->isUpdating()) { SPDocument *doc = sp_desktop_document(SP_ACTIVE_DESKTOP); double const old_height = sp_document_height(doc); sp_document_set_width (doc, w, &_px_unit); sp_document_set_height (doc, h, &_px_unit); - sp_document_set_landscape (doc, _landscape); // The origin for the user is in the lower left corner; this point should remain stationary when // changing the page size. The SVG's origin however is in the upper left corner, so we must compensate for this Geom::Translate const vert_offset(Geom::Point(0, (old_height - h))); @@ -369,6 +357,17 @@ PageSizer::setDim (double w, double h, bool changeList) sp_document_done (doc, SP_VERB_NONE, _("Set page size")); } + if ( w != h ) { + _landscapeButton.set_sensitive(true); + _portraitButton.set_sensitive (true); + _landscape = ( w > h ); + _landscapeButton.set_active(_landscape ? true : false); + _portraitButton.set_active (_landscape ? false : true); + } else { + _landscapeButton.set_sensitive(false); + _portraitButton.set_sensitive (false); + } + if (changeList) { Gtk::TreeModel::Row row = (*find_paper_size(w, h)); -- cgit v1.2.3 From ef549e445f821e4472c71d1c43f3738c7857bafc Mon Sep 17 00:00:00 2001 From: bulia byak Date: Sat, 5 Sep 2009 23:58:47 +0000 Subject: patch by Adib for 406470 (bzr r8562) --- src/extension/internal/cairo-render-context.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/extension/internal/cairo-render-context.cpp b/src/extension/internal/cairo-render-context.cpp index d1462e52e..364dfcfa8 100644 --- a/src/extension/internal/cairo-render-context.cpp +++ b/src/extension/internal/cairo-render-context.cpp @@ -192,6 +192,8 @@ CairoRenderContext::cloneMe(double width, double height) const (int)ceil(width), (int)ceil(height)); new_context->_cr = cairo_create(surface); new_context->_surface = surface; + new_context->_width = width; + new_context->_height = height; new_context->_is_valid = TRUE; return new_context; @@ -749,6 +751,9 @@ CairoRenderContext::setupSurface(double width, double height) if (_vector_based_target && _stream == NULL) return false; + _width = width; + _height = height; + cairo_surface_t *surface = NULL; switch (_target) { case CAIRO_SURFACE_TYPE_IMAGE: @@ -796,13 +801,16 @@ bool CairoRenderContext::_finishSurfaceSetup(cairo_surface_t *surface, cairo_matrix_t *ctm) { if(surface == NULL) { - return FALSE; + return false; } if(CAIRO_STATUS_SUCCESS != cairo_surface_status(surface)) { - return FALSE; + return false; } _cr = cairo_create(surface); + if(CAIRO_STATUS_SUCCESS != cairo_status(_cr)) { + return false; + } if (ctm) cairo_set_matrix(_cr, ctm); _surface = surface; -- cgit v1.2.3 From 89abf2d35ba202b184df4e791da3903c16d1d91c Mon Sep 17 00:00:00 2001 From: bulia byak Date: Sun, 6 Sep 2009 02:34:31 +0000 Subject: textual patch from bug 408093 (bzr r8563) --- src/extension/execution-env.cpp | 2 +- src/live_effects/lpe-rough-hatches.cpp | 30 +++++++++++++++--------------- src/live_effects/lpe-vonkoch.cpp | 2 +- src/object-edit.cpp | 2 +- src/sp-item.cpp | 2 +- src/ui/dialog/inkscape-preferences.cpp | 4 ++-- src/widgets/sp-color-icc-selector.cpp | 4 ++-- 7 files changed, 23 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/extension/execution-env.cpp b/src/extension/execution-env.cpp index 4a13890d7..e8d7c4baf 100644 --- a/src/extension/execution-env.cpp +++ b/src/extension/execution-env.cpp @@ -131,7 +131,7 @@ ExecutionEnv::createWorkingDialog (void) { return; Gtk::Window *window = Glib::wrap(GTK_WINDOW(toplevel), false); - gchar * dlgmessage = g_strdup_printf(_("'%s' working, please wait..."), _effect->get_name()); + gchar * dlgmessage = g_strdup_printf(_("'%s' working, please wait..."), _(_effect->get_name())); _visibleDialog = new Gtk::MessageDialog(*window, dlgmessage, false, // use markup diff --git a/src/live_effects/lpe-rough-hatches.cpp b/src/live_effects/lpe-rough-hatches.cpp index 4df1064ce..bcfd0f373 100644 --- a/src/live_effects/lpe-rough-hatches.cpp +++ b/src/live_effects/lpe-rough-hatches.cpp @@ -226,24 +226,24 @@ LPERoughHatches::LPERoughHatches(LivePathEffectObject *lpeobject) : dist_rdm(_("Frequency randomness"), _("Variation of distance between hatches, in %."), "dist_rdm", &wr, this, 75), growth(_("Growth"), _("Growth of distance between hatches."), "growth", &wr, this, 0.), //FIXME: top/bottom names are inverted in the UI/svg and in the code!! - scale_tf(_("Half turns smoothness: 1st side, in"), _("Set smoothness/sharpness of path when reaching a 'bottom' halfturn. 0=sharp, 1=default"), "scale_bf", &wr, this, 1.), - scale_tb(_("1st side, out"), _("Set smoothness/sharpness of path when leaving a 'bottom' halfturn. 0=sharp, 1=default"), "scale_bb", &wr, this, 1.), - scale_bf(_("2nd side, in"), _("Set smoothness/sharpness of path when reaching a 'top' halfturn. 0=sharp, 1=default"), "scale_tf", &wr, this, 1.), - scale_bb(_("2nd side, out"), _("Set smoothness/sharpness of path when leaving a 'top' halfturn. 0=sharp, 1=default"), "scale_tb", &wr, this, 1.), - top_edge_variation(_("Magnitude jitter: 1st side"), _("Randomly moves 'bottom' halfsturns to produce magnitude variations."), "bottom_edge_variation", &wr, this, 0), - bot_edge_variation(_("2nd side"), _("Randomly moves 'top' halfsturns to produce magnitude variations."), "top_edge_variation", &wr, this, 0), - top_tgt_variation(_("Parallelism jitter: 1st side"), _("Add direction randomness by moving 'bottom' halfsturns tangentially to the boundary."), "bottom_tgt_variation", &wr, this, 0), - bot_tgt_variation(_("2nd side"), _("Add direction randomness by randomly moving 'top' halfsturns tangentially to the boundary."), "top_tgt_variation", &wr, this, 0), - top_smth_variation(_("Variance: 1st side"), _("Randomness of 'bottom' halfturns smoothness"), "top_smth_variation", &wr, this, 0), - bot_smth_variation(_("2nd side"), _("Randomness of 'top' halfturns smoothness"), "bottom_smth_variation", &wr, this, 0), + scale_tf(_("Half-turns smoothness: 1st side, in"), _("Set smoothness/sharpness of path when reaching a 'bottom' half-turn. 0=sharp, 1=default"), "scale_bf", &wr, this, 1.), + scale_tb(_("1st side, out"), _("Set smoothness/sharpness of path when leaving a 'bottom' half-turn. 0=sharp, 1=default"), "scale_bb", &wr, this, 1.), + scale_bf(_("2nd side, in"), _("Set smoothness/sharpness of path when reaching a 'top' half-turn. 0=sharp, 1=default"), "scale_tf", &wr, this, 1.), + scale_bb(_("2nd side, out"), _("Set smoothness/sharpness of path when leaving a 'top' half-turn. 0=sharp, 1=default"), "scale_tb", &wr, this, 1.), + top_edge_variation(_("Magnitude jitter: 1st side"), _("Randomly moves 'bottom' half-turns to produce magnitude variations."), "bottom_edge_variation", &wr, this, 0), + bot_edge_variation(_("2nd side"), _("Randomly moves 'top' half-turns to produce magnitude variations."), "top_edge_variation", &wr, this, 0), + top_tgt_variation(_("Parallelism jitter: 1st side"), _("Add direction randomness by moving 'bottom' half-turns tangentially to the boundary."), "bottom_tgt_variation", &wr, this, 0), + bot_tgt_variation(_("2nd side"), _("Add direction randomness by randomly moving 'top' half-turns tangentially to the boundary."), "top_tgt_variation", &wr, this, 0), + top_smth_variation(_("Variance: 1st side"), _("Randomness of 'bottom' half-turns smoothness"), "top_smth_variation", &wr, this, 0), + bot_smth_variation(_("2nd side"), _("Randomness of 'top' half-turns smoothness"), "bottom_smth_variation", &wr, this, 0), // - fat_output(_("Generate thick/thin path"), _("Simulate a stroke of varrying width"), "fat_output", &wr, this, true), + fat_output(_("Generate thick/thin path"), _("Simulate a stroke of varying width"), "fat_output", &wr, this, true), do_bend(_("Bend hatches"), _("Add a global bend to the hatches (slower)"), "do_bend", &wr, this, true), - stroke_width_top(_("Thickness: at 1st side"), _("Width at 'bottom' half turns"), "stroke_width_top", &wr, this, 1.), - stroke_width_bot(_("at 2nd side"), _("Width at 'top' halfturns"), "stroke_width_bottom", &wr, this, 1.), + stroke_width_top(_("Thickness: at 1st side"), _("Width at 'bottom' half-turns"), "stroke_width_top", &wr, this, 1.), + stroke_width_bot(_("at 2nd side"), _("Width at 'top' half-turns"), "stroke_width_bottom", &wr, this, 1.), // - front_thickness(_("from 2nd to 1st side"), _("Width of paths from 'top' to 'bottom' halfturns"), "front_thickness", &wr, this, 1.), - back_thickness(_("from 1st to 2nd side"), _("Width of paths from 'top' to 'bottom' halfturns"), "back_thickness", &wr, this, .25), + front_thickness(_("from 2nd to 1st side"), _("Width from 'top' to 'bottom'"), "front_thickness", &wr, this, 1.), + back_thickness(_("from 1st to 2nd side"), _("Width from 'bottom' to 'top'"), "back_thickness", &wr, this, .25), direction(_("Hatches width and dir"), _("Defines hatches frequency and direction"), "direction", &wr, this, Geom::Point(50,0)), // diff --git a/src/live_effects/lpe-vonkoch.cpp b/src/live_effects/lpe-vonkoch.cpp index 32fb763d3..7fd0ac0b4 100644 --- a/src/live_effects/lpe-vonkoch.cpp +++ b/src/live_effects/lpe-vonkoch.cpp @@ -49,7 +49,7 @@ LPEVonKoch::LPEVonKoch(LivePathEffectObject *lpeobject) : similar_only(_("Use uniform transforms only"), _("2 consecutive segments are used to reverse/preserve orientation only (otherwise, they define a general transform)."), "similar_only", &wr, this, false), drawall(_("Draw all generations"), _("If unchecked, draw only the last generation"), "drawall", &wr, this, true), //,draw_boxes(_("Display boxes"), _("Display boxes instead of paths only"), "draw_boxes", &wr, this, true) - ref_path(_("Reference segment"), _("The reference segment. Defaults to bbox diameter."), "ref_path", &wr, this, "M0,0 L10,0"), + ref_path(_("Reference segment"), _("The reference segment. Defaults to the horizontal midline of the bbox."), "ref_path", &wr, this, "M0,0 L10,0"), //refA(_("Ref Start"), _("Left side middle of the reference box"), "refA", &wr, this), //refB(_("Ref End"), _("Right side middle of the reference box"), "refB", &wr, this), //FIXME: a path is used here instead of 2 points to work around path/point param incompatibility bug. diff --git a/src/object-edit.cpp b/src/object-edit.cpp index c8e3ab204..6b83413e4 100644 --- a/src/object-edit.cpp +++ b/src/object-edit.cpp @@ -930,7 +930,7 @@ ArcKnotHolder::ArcKnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolderRelea _("Adjust ellipse height, with Ctrl to make circle"), SP_KNOT_SHAPE_SQUARE, SP_KNOT_MODE_XOR); entity_start->create(desktop, item, this, - _("Position the start point of the arc or segment; with Ctrl" + _("Position the start point of the arc or segment; with Ctrl " "to snap angle; drag inside the ellipse for arc, outside for segment"), SP_KNOT_SHAPE_CIRCLE, SP_KNOT_MODE_XOR); entity_end->create(desktop, item, this, diff --git a/src/sp-item.cpp b/src/sp-item.cpp index 662dc1cac..395048280 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -1062,7 +1062,7 @@ sp_item_description(SPItem *item) const gchar *label = SP_OBJECT_STYLE(item)->filter.href->getObject()->label(); gchar *snew; if (label) { - snew = g_strdup_printf (_("%s; filtered (%s)"), s, label); + snew = g_strdup_printf (_("%s; filtered (%s)"), s, _(label)); } else { snew = g_strdup_printf (_("%s; filtered"), s); } diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 9b6d9e084..438371b8c 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -220,11 +220,11 @@ void InkscapePreferences::initPageSnapping() _snap_delay.init("/options/snapdelay/value", 0, 1000, 50, 100, 300, 0); _page_snapping.add_line( false, _("Delay (in ms):"), _snap_delay, "", - _("Postpone snapping as long as the mouse is moving, and then wait an additional fraction of a second. This additional delay is specified here. When set to zero or to a very small number, snapping will be immediate"), true); + _("Postpone snapping as long as the mouse is moving, and then wait an additional fraction of a second. This additional delay is specified here. When set to zero or to a very small number, snapping will be immediate."), true); _snap_closest_only.init( _("Only snap the node closest to the pointer"), "/options/snapclosestonly/value", false); _page_snapping.add_line( false, "", _snap_closest_only, "", - _("Only try to snap the node that is initialy closest to the mouse pointer")); + _("Only try to snap the node that is initially closest to the mouse pointer")); _snap_weight.init("/options/snapweight/value", 0, 1, 0.1, 0.2, 0.5, 1); _page_snapping.add_line( false, _("Weight factor:"), _snap_weight, "", diff --git a/src/widgets/sp-color-icc-selector.cpp b/src/widgets/sp-color-icc-selector.cpp index 80a551f6a..916e4363c 100644 --- a/src/widgets/sp-color-icc-selector.cpp +++ b/src/widgets/sp-color-icc-selector.cpp @@ -303,7 +303,7 @@ void ColorICCSelector::init() _profileSel = gtk_combo_box_new_text(); - gtk_combo_box_append_text( GTK_COMBO_BOX(_profileSel), "" ); + gtk_combo_box_append_text( GTK_COMBO_BOX(_profileSel), _("") ); gtk_widget_show( _profileSel ); gtk_combo_box_set_active( GTK_COMBO_BOX(_profileSel), 0 ); gtk_table_attach( GTK_TABLE(t), _profileSel, 1, 2, row, row + 1, GTK_FILL, GTK_FILL, XPAD, YPAD ); @@ -576,7 +576,7 @@ void ColorICCSelector::_profilesChanged( std::string const & name ) gtk_combo_box_remove_text( combo, 0 ); } - gtk_combo_box_append_text( combo, ""); + gtk_combo_box_append_text( combo, _("")); gtk_combo_box_set_active( combo, 0 ); -- cgit v1.2.3 From 88379765c01b8dd67531e6a9225292fbd6a1c50a Mon Sep 17 00:00:00 2001 From: bulia byak Date: Thu, 10 Sep 2009 14:06:39 +0000 Subject: change colour to color in display strings (bzr r8575) --- src/ui/dialog/filter-effects-dialog.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp index 9301d20b7..171c23ae4 100644 --- a/src/ui/dialog/filter-effects-dialog.cpp +++ b/src/ui/dialog/filter-effects-dialog.cpp @@ -462,7 +462,7 @@ public: ColorMatrixValues() : AttrWidget(SP_ATTR_VALUES), // TRANSLATORS: this dialog is accessible via menu Filters - Filter editor - _matrix(SP_ATTR_VALUES, _("This matrix determines a linear transform on colour space. Each line affects one of the color components. Each column determines how much of each color component from the input is passed to the output. The last column does not depend on input colors, so can be used to adjust a constant component value.")), + _matrix(SP_ATTR_VALUES, _("This matrix determines a linear transform on color space. Each line affects one of the color components. Each column determines how much of each color component from the input is passed to the output. The last column does not depend on input colors, so can be used to adjust a constant component value.")), _saturation(0, 0, 1, 0.1, 0.01, 2, SP_ATTR_VALUES), _angle(0, 0, 360, 0.1, 0.01, 1, SP_ATTR_VALUES), _label(_("None"), Gtk::ALIGN_LEFT), @@ -2279,7 +2279,7 @@ void FilterEffectsDialog::update_primitive_infobox() break; case(NR_FILTER_COLORMATRIX): _infobox_icon.set_from_icon_name("feColorMatrix-icon", Gtk::ICON_SIZE_DIALOG); - _infobox_desc.set_markup(_("The feColorMatrix filter primitive applies a matrix transformation to colour of each rendered pixel. This allows for effects like turning object to grayscale, modifying colour saturation and changing colour hue.")); + _infobox_desc.set_markup(_("The feColorMatrix filter primitive applies a matrix transformation to color of each rendered pixel. This allows for effects like turning object to grayscale, modifying color saturation and changing color hue.")); break; case(NR_FILTER_COMPONENTTRANSFER): _infobox_icon.set_from_icon_name("feComponentTransfer-icon", Gtk::ICON_SIZE_DIALOG); @@ -2319,7 +2319,7 @@ void FilterEffectsDialog::update_primitive_infobox() break; case(NR_FILTER_MORPHOLOGY): _infobox_icon.set_from_icon_name("feMorphology-icon", Gtk::ICON_SIZE_DIALOG); - _infobox_desc.set_markup(_("The feMorphology filter primitive provides erode and dilate effects. For single-colour objects erode makes the object thinner and dilate makes it thicker.")); + _infobox_desc.set_markup(_("The feMorphology filter primitive provides erode and dilate effects. For single-color objects erode makes the object thinner and dilate makes it thicker.")); break; case(NR_FILTER_OFFSET): _infobox_icon.set_from_icon_name("feOffset-icon", Gtk::ICON_SIZE_DIALOG); -- cgit v1.2.3 From 7c9b99bdd58db1d66cf1a3d09c251cd72810df77 Mon Sep 17 00:00:00 2001 From: bulia byak Date: Thu, 10 Sep 2009 14:38:48 +0000 Subject: patch by Adib for 307195 (bzr r8576) --- src/ui/dialog/layers.cpp | 43 ++++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp index fa47ad88d..f0c4cd0dd 100644 --- a/src/ui/dialog/layers.cpp +++ b/src/ui/dialog/layers.cpp @@ -73,12 +73,12 @@ public: SPObject* _target; }; -static gboolean layers_panel_activated( GtkObject */*object*/, GdkEvent * /*event*/, gpointer data ) +static gboolean layers_panel_activated(Inkscape::Application * /*inkscape*/, SPDesktop *desktop, gpointer data ) { if ( data ) { LayersPanel* panel = reinterpret_cast(data); - panel->setDesktop(panel->getDesktop()); + panel->setDesktop(desktop); } return FALSE; @@ -95,7 +95,6 @@ static gboolean layers_panel_deactivated( GtkObject */*object*/, GdkEvent * /*ev return FALSE; } - void LayersPanel::_styleButton( Gtk::Button& btn, SPDesktop *desktop, unsigned int code, char const* iconName, char const* fallback ) { bool set = false; @@ -349,20 +348,22 @@ bool LayersPanel::_checkForSelected(const Gtk::TreePath &path, const Gtk::TreeIt void LayersPanel::_layersChanged() { // g_message("_layersChanged()"); - SPDocument* document = _desktop->doc(); - SPObject* root = document->root; - if ( root ) { - _selectedConnection.block(); - if ( _mgr && _mgr->includes( root ) ) { - SPObject* target = _desktop->currentLayer(); - _store->clear(); - -#if DUMP_LAYERS - g_message("root:%p {%s} [%s]", root, root->id, root->label() ); -#endif // DUMP_LAYERS - _addLayer( document, root, 0, target, 0 ); + if(_desktop) { + SPDocument* document = _desktop->doc(); + SPObject* root = document->root; + if ( root ) { + _selectedConnection.block(); + if ( _mgr && _mgr->includes( root ) ) { + SPObject* target = _desktop->currentLayer(); + _store->clear(); + + #if DUMP_LAYERS + g_message("root:%p {%s} [%s]", root, root->id, root->label() ); + #endif // DUMP_LAYERS + _addLayer( document, root, 0, target, 0 ); + } + _selectedConnection.unblock(); } - _selectedConnection.unblock(); } } @@ -414,9 +415,9 @@ SPObject* LayersPanel::_selectedLayer() void LayersPanel::_pushTreeSelectionToCurrent() { - SPObject* inTree = _selectedLayer(); // TODO hunt down the possible API abuse in getting NULL - if ( _desktop->currentRoot() ) { + if ( _desktop && _desktop->currentRoot() ) { + SPObject* inTree = _selectedLayer(); if ( inTree ) { SPObject* curr = _desktop->currentLayer(); if ( curr != inTree ) { @@ -459,6 +460,7 @@ void LayersPanel::_checkTreeSelection() void LayersPanel::_preToggle( GdkEvent const *event ) { + if ( _toggleEvent ) { gdk_event_free(_toggleEvent); _toggleEvent = 0; @@ -472,6 +474,8 @@ void LayersPanel::_preToggle( GdkEvent const *event ) void LayersPanel::_toggled( Glib::ustring const& str, int targetCol ) { + g_return_if_fail(_desktop != NULL); + Gtk::TreeModel::Children::iterator iter = _tree.get_model()->get_iter(str); Gtk::TreeModel::Row row = *iter; @@ -720,6 +724,7 @@ LayersPanel::LayersPanel() : g_signal_connect( G_OBJECT(INKSCAPE), "activate_desktop", G_CALLBACK( layers_panel_activated ), this ); g_signal_connect( G_OBJECT(INKSCAPE), "deactivate_desktop", G_CALLBACK( layers_panel_deactivated ), this ); + setDesktop( targetDesktop ); show_all_children(); @@ -761,7 +766,7 @@ void LayersPanel::setDesktop( SPDesktop* desktop ) _desktop = 0; } - _desktop = getDesktop(); + _desktop = Panel::getDesktop(); if ( _desktop ) { //setLabel( _desktop->doc()->name ); -- cgit v1.2.3 From 802aa9203e72f6dd84e3508efd2f3cb231c1d615 Mon Sep 17 00:00:00 2001 From: bulia byak Date: Mon, 14 Sep 2009 00:53:47 +0000 Subject: two safe changes: 1) increase the arbitrary limit on the number of update iterations - it is very possible in a complex document to have more than 32 chained gradients or patterns, and each step requires an iteration; 2) fix crash when this limit is reached for a clipboard document that has no URI (bzr r8584) --- src/document.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/document.cpp b/src/document.cpp index 288e52c6d..8503c7841 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -900,16 +900,16 @@ SPDocument::_updateDocument() * Repeatedly works on getting the document updated, since sometimes * it takes more than one pass to get the document updated. But it * usually should not take more than a few loops, and certainly never - * more than 32 iterations. So we bail out if we hit 32 iterations, + * more than 64 iterations. So we bail out if we hit 64 iterations, * since this typically indicates we're stuck in an update loop. */ gint sp_document_ensure_up_to_date(SPDocument *doc) { - int counter = 32; + int counter = 64; while (!doc->_updateDocument()) { if (counter == 0) { - g_warning("More than 32 iteration while updating document '%s'", doc->uri); + g_warning("More than 64 iteration while updating document '%s'", doc->uri? doc->uri:""); break; } counter--; -- cgit v1.2.3 From 3e4d7124a9ff4b05723d938831f149fc313e1fc0 Mon Sep 17 00:00:00 2001 From: bulia byak Date: Mon, 14 Sep 2009 00:58:45 +0000 Subject: add comment (copied from sp-gradient) explaining why this must set a flag, to be cleared in the next update, instead of calling modified method directly (bzr r8585) --- src/sp-pattern.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/sp-pattern.cpp b/src/sp-pattern.cpp index 90af65b97..ec0d0d576 100644 --- a/src/sp-pattern.cpp +++ b/src/sp-pattern.cpp @@ -432,6 +432,7 @@ pattern_ref_modified (SPObject */*ref*/, guint /*flags*/, SPPattern *pattern) { if (SP_IS_OBJECT (pattern)) SP_OBJECT (pattern)->requestModified(SP_OBJECT_MODIFIED_FLAG); + /* Conditional to avoid causing infinite loop if there's a cycle in the href chain. */ } guint -- cgit v1.2.3 From 66c73881067c22116920ad8130d99c9aa02e03dc Mon Sep 17 00:00:00 2001 From: bulia byak Date: Mon, 14 Sep 2009 03:28:30 +0000 Subject: fix crash when exiting with 3dbox tool active (bzr r8587) --- src/box3d-context.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/box3d-context.cpp b/src/box3d-context.cpp index 128b5f2ff..e3476deb3 100644 --- a/src/box3d-context.cpp +++ b/src/box3d-context.cpp @@ -625,10 +625,14 @@ static void sp_box3d_drag(Box3DContext &bc, guint /*state*/) static void sp_box3d_finish(Box3DContext *bc) { bc->_message_context->clear(); - g_assert (SP_ACTIVE_DOCUMENT->current_persp3d); + bc->ctrl_dragged = false; + bc->extruded = false; if ( bc->item != NULL ) { SPDesktop * desktop = SP_EVENT_CONTEXT_DESKTOP(bc); + SPDocument *doc = sp_desktop_document(desktop); + if (!doc || !doc->current_persp3d) + return; SPBox3D *box = SP_BOX3D(bc->item); @@ -647,9 +651,6 @@ static void sp_box3d_finish(Box3DContext *bc) bc->item = NULL; } - - bc->ctrl_dragged = false; - bc->extruded = false; } void sp_box3d_context_update_lines(SPEventContext *ec) { -- cgit v1.2.3 From 84499792735ed174dfe3dfc60b97915235dea14c Mon Sep 17 00:00:00 2001 From: bulia byak Date: Mon, 14 Sep 2009 03:29:43 +0000 Subject: fix crash when moving a box after copying it to clipboard; this code is still badly broken, we must not use any UI classes such as selection in set_transform, but at least it does not crash now (bzr r8588) --- src/box3d.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/box3d.cpp b/src/box3d.cpp index 5cffa66d9..93efa5c35 100644 --- a/src/box3d.cpp +++ b/src/box3d.cpp @@ -335,7 +335,8 @@ box3d_set_transform(SPItem *item, Geom::Matrix const &xform) Persp3D *persp = box3d_get_perspective(box); Persp3D *transf_persp; - if (!persp3d_has_all_boxes_in_selection (persp)) { + if (sp_desktop_document(inkscape_active_desktop()) == SP_OBJECT_DOCUMENT(item) && + !persp3d_has_all_boxes_in_selection (persp)) { std::list selboxes = sp_desktop_selection(inkscape_active_desktop())->box3DList(); /* create a new perspective as a copy of the current one and link the selected boxes to it */ -- cgit v1.2.3 From 073909364c49c13c5dc632003a06045ce4b12e59 Mon Sep 17 00:00:00 2001 From: bulia byak Date: Mon, 14 Sep 2009 03:49:02 +0000 Subject: patch by Diederik for jumping images, bug 168384 (bzr r8589) --- src/libnr/nr-compose-transform.cpp | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/libnr/nr-compose-transform.cpp b/src/libnr/nr-compose-transform.cpp index afc8fd987..bb392bd24 100644 --- a/src/libnr/nr-compose-transform.cpp +++ b/src/libnr/nr-compose-transform.cpp @@ -25,10 +25,10 @@ extern "C" { int nr_have_mmx (void); void nr_mmx_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM_0 (unsigned char *px, int w, int h, int rs, const unsigned char *spx, int sw, int sh, int srs, - const long *FFd2s, unsigned int alpha); + const long long *FFd2s, unsigned int alpha); void nr_mmx_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM_n (unsigned char *px, int w, int h, int rs, const unsigned char *spx, int sw, int sh, int srs, - const long *FFd2s, const long *FF_S, unsigned int alpha, int dbits); + const long long *FFd2s, const long *FF_S, unsigned int alpha, int dbits); #define NR_PIXOPS_MMX (1 && nr_have_mmx ()) #ifdef __cplusplus } @@ -40,6 +40,7 @@ void nr_mmx_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM_n (unsigned char *px, int /* Fixed point precision */ #define FBITS 12 +#define FBITS_HP 18 // In some places we need a higher precision void nr_R8G8B8A8_N_EMPTY_R8G8B8A8_N_TRANSFORM (unsigned char *px, int w, int h, int rs, const unsigned char *spx, int sw, int sh, int srs, @@ -168,10 +169,10 @@ void nr_R8G8B8A8_N_R8G8B8A8_N_R8G8B8A8_P_TRANSFORM (unsigned char *px, int w, in static void nr_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM_0 (unsigned char *px, int w, int h, int rs, const unsigned char *spx, int sw, int sh, int srs, - const long *FFd2s, unsigned int alpha) + const long long *FFd2s, unsigned int alpha) { - unsigned char *d0; - int FFsx0, FFsy0; + unsigned char *d0; + long long FFsx0, FFsy0; int x, y; d0 = px; @@ -180,15 +181,15 @@ nr_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM_0 (unsigned char *px, int w, int h for (y = 0; y < h; y++) { unsigned char *d; - long FFsx, FFsy; + long long FFsx, FFsy; d = d0; FFsx = FFsx0; FFsy = FFsy0; for (x = 0; x < w; x++) { long sx, sy; - sx = FFsx >> FBITS; + sx = long(FFsx >> FBITS_HP); if ((sx >= 0) && (sx < sw)) { - sy = FFsy >> FBITS; + sy = long(FFsy >> FBITS_HP); if ((sy >= 0) && (sy < sh)) { const unsigned char *s; unsigned int a; @@ -224,11 +225,11 @@ nr_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM_0 (unsigned char *px, int w, int h static void nr_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM_n (unsigned char *px, int w, int h, int rs, const unsigned char *spx, int sw, int sh, int srs, - const long *FFd2s, const long *FF_S, unsigned int alpha, int dbits) + const long long *FFd2s, const long *FF_S, unsigned int alpha, int dbits) { int size; unsigned char *d0; - int FFsx0, FFsy0; + long long FFsx0, FFsy0; int x, y; size = (1 << dbits); @@ -242,7 +243,7 @@ nr_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM_n (unsigned char *px, int w, int h for (y = 0; y < h; y++) { unsigned char *d; - long FFsx, FFsy; + long long FFsx, FFsy; d = d0; FFsx = FFsx0; FFsy = FFsy0; @@ -252,9 +253,9 @@ nr_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM_n (unsigned char *px, int w, int h r = g = b = a = 0; for (i = 0; i < size; i++) { long sx, sy; - sx = (FFsx + FF_S[2 * i]) >> FBITS; + sx = (FFsx >> FBITS_HP) + (FF_S[2 * i] >> FBITS); if ((sx >= 0) && (sx < sw)) { - sy = (FFsy + FF_S[2 * i + 1]) >> FBITS; + sy = (FFsy >> FBITS_HP) + (FF_S[2 * i + 1] >> FBITS); if ((sy >= 0) && (sy < sh)) { const unsigned char *s; unsigned int ca; @@ -302,6 +303,7 @@ void nr_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM (unsigned char *px, int w, in { int dbits; long FFd2s[6]; + long long FFd2s_HP[6]; // with higher precision int i; if (alpha == 0) return; @@ -310,17 +312,18 @@ void nr_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM (unsigned char *px, int w, in for (i = 0; i < 6; i++) { FFd2s[i] = (long) (d2s[i] * (1 << FBITS) + 0.5); + FFd2s_HP[i] = (long) (d2s[i] * (1 << FBITS_HP) + 0.5);; } if (dbits == 0) { #ifdef WITH_MMX if (NR_PIXOPS_MMX) { /* WARNING: MMX composer REQUIRES w > 0 and h > 0 */ - nr_mmx_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM_0 (px, w, h, rs, spx, sw, sh, srs, FFd2s, alpha); + nr_mmx_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM_0 (px, w, h, rs, spx, sw, sh, srs, FFd2s_HP, alpha); return; } #endif - nr_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM_0 (px, w, h, rs, spx, sw, sh, srs, FFd2s, alpha); + nr_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM_0 (px, w, h, rs, spx, sw, sh, srs, FFd2s_HP, alpha); } else { int xsize, ysize; long FFs_x_x_S, FFs_x_y_S, FFs_y_x_S, FFs_y_y_S; @@ -347,11 +350,11 @@ void nr_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM (unsigned char *px, int w, in #ifdef WITH_MMX if (NR_PIXOPS_MMX) { /* WARNING: MMX composer REQUIRES w > 0 and h > 0 */ - nr_mmx_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM_n (px, w, h, rs, spx, sw, sh, srs, FFd2s, FF_S, alpha, dbits); + nr_mmx_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM_n (px, w, h, rs, spx, sw, sh, srs, FFd2s_HP, FF_S, alpha, dbits); return; } #endif - nr_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM_n (px, w, h, rs, spx, sw, sh, srs, FFd2s, FF_S, alpha, dbits); + nr_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM_n (px, w, h, rs, spx, sw, sh, srs, FFd2s_HP, FF_S, alpha, dbits); } } -- cgit v1.2.3 From 7b3237cbf5257dd132588e41fc86585d9cb26de3 Mon Sep 17 00:00:00 2001 From: Josh Andler Date: Mon, 14 Sep 2009 05:02:10 +0000 Subject: Patch from Diedrik for 296778 (bzr r8590) --- src/ui/clipboard.cpp | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index 7e41006be..af0ec0129 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -148,6 +148,8 @@ private: void _setClipboardColor(guint32); void _userWarn(SPDesktop *, char const *); + void _inkscape_wait_for_targets(std::list &); + // private properites SPDocument *_clipboardSPDoc; ///< Document that stores the clipboard until someone requests it Inkscape::XML::Node *_defs; ///< Reference to the clipboard document's defs node @@ -1226,7 +1228,9 @@ Geom::Scale ClipboardManagerImpl::_getScale(Geom::Point const &min, Geom::Point */ Glib::ustring ClipboardManagerImpl::_getBestTarget() { - std::list targets = _clipboard->wait_for_targets(); + // GTKmm's wait_for_targets() is broken, see the comment in _inkscape_wait_for_targets() + std::list targets; // = _clipboard->wait_for_targets(); + _inkscape_wait_for_targets(targets); // clipboard target debugging snippet /* @@ -1365,6 +1369,35 @@ void ClipboardManagerImpl::_userWarn(SPDesktop *desktop, char const *msg) } +// GTKMM's clipboard::wait_for_targets is buggy and might return bogus, see +// +// https://bugs.launchpad.net/inkscape/+bug/296778 +// http://mail.gnome.org/archives/gtk-devel-list/2009-June/msg00062.html +// +// for details. Until this has been fixed upstream we will use our own implementation +// of this method, as copied from /gtkmm-2.16.0/gtk/gtkmm/clipboard.cc. +void ClipboardManagerImpl::_inkscape_wait_for_targets(std::list &listTargets) +{ + //Get a newly-allocated array of atoms: + GdkAtom* targets = 0; + gint n_targets = 0; + gboolean test = gtk_clipboard_wait_for_targets( gtk_clipboard_get(GDK_SELECTION_CLIPBOARD), &targets, &n_targets ); + if(!test) + n_targets = 0; //otherwise it will be -1. + + //Add the targets to the C++ container: + for(int i = 0; i < n_targets; i++) + { + //Convert the atom to a string: + gchar* const atom_name = gdk_atom_name(targets[i]); + + Glib::ustring target; + if(atom_name) + target = Glib::ScopedPtr(atom_name).get(); //This frees the gchar*. + + listTargets.push_back(target); + } +} /* ####################################### ClipboardManager class -- cgit v1.2.3 From 64e14cd4477f16c1b1d795aedbd0f87c439d561d Mon Sep 17 00:00:00 2001 From: bulia byak Date: Mon, 14 Sep 2009 14:30:26 +0000 Subject: until the freeze with precision<3 is fixed, raise the lower limit in the UI (bzr r8593) --- src/ui/dialog/inkscape-preferences.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 438371b8c..3e202d619 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -1037,7 +1037,7 @@ void InkscapePreferences::initPageSVGOutput() _page_svgoutput.add_group_header( _("Numbers")); - _svgoutput_numericprecision.init("/options/svgoutput/numericprecision", 1.0, 16.0, 1.0, 2.0, 8.0, true, false); + _svgoutput_numericprecision.init("/options/svgoutput/numericprecision", 3.0, 16.0, 1.0, 2.0, 8.0, true, false); _page_svgoutput.add_line( false, _("Numeric precision:"), _svgoutput_numericprecision, "", _("How many digits to write after the decimal dot"), false); _svgoutput_minimumexponent.init("/options/svgoutput/minimumexponent", -32.0, -1, 1.0, 2.0, -8.0, true, false); -- cgit v1.2.3 From c19a7bb5f35e9a722e1cdc4672145464287d96ad Mon Sep 17 00:00:00 2001 From: Josh Andler Date: Tue, 15 Sep 2009 00:38:40 +0000 Subject: Patch by theAdib which fixes 397075 (bzr r8596) --- src/filters/image.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/filters/image.cpp b/src/filters/image.cpp index 0002ef94c..d8e5a417f 100644 --- a/src/filters/image.cpp +++ b/src/filters/image.cpp @@ -184,11 +184,12 @@ sp_feImage_set(SPObject *object, unsigned int key, gchar const *value) g_warning("SVG element URI was not found in the document while loading feImage"); } } - catch(const Inkscape::UnsupportedURIException & e) + // catches either MalformedURIException or UnsupportedURIException + catch(const Inkscape::BadURIException & e) { feImage->from_element = false; /* This occurs when using external image as the source */ - //g_warning("caught Inkscape::UnsupportedURIException in sp_feImage_set"); + //g_warning("caught Inkscape::BadURIException in sp_feImage_set"); break; } break; -- cgit v1.2.3 From 1807c74cbec5204385b71b3a120ebcd40f80c18e Mon Sep 17 00:00:00 2001 From: Josh Andler Date: Wed, 16 Sep 2009 02:04:50 +0000 Subject: Fix by Adib for 353847 (bzr r8601) --- src/extension/output.h | 1 + src/extension/system.cpp | 8 ++++++++ src/file.cpp | 15 +++++++++++++-- src/io/sys.cpp | 34 ++++++++++++++++++++++++++++++++++ src/io/sys.h | 2 ++ 5 files changed, 58 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/extension/output.h b/src/extension/output.h index b52a96211..584fafda8 100644 --- a/src/extension/output.h +++ b/src/extension/output.h @@ -31,6 +31,7 @@ public: class save_failed {}; /**< Generic failure for an undescribed reason */ class save_cancelled {}; /**< Saving was cancelled */ class no_extension_found {}; /**< Failed because we couldn't find an extension to match the filename */ + class file_read_only {}; /**< The existing file can not be opened for writing */ Output (Inkscape::XML::Node * in_repr, Implementation::Implementation * in_imp); diff --git a/src/extension/system.cpp b/src/extension/system.cpp index 365ea925b..43e7af494 100644 --- a/src/extension/system.cpp +++ b/src/extension/system.cpp @@ -32,6 +32,7 @@ #include "implementation/script.h" #include "implementation/xslt.h" #include "xml/rebase-hrefs.h" +#include "io/sys.h" /* #include "implementation/plugin.h" */ namespace Inkscape { @@ -248,6 +249,13 @@ save(Extension *key, SPDocument *doc, gchar const *filename, bool setextension, throw Output::no_overwrite(); } + // test if the file exists and is writable + // the test only checks the file attributes and might pass where ACL does not allow to write + if (Inkscape::IO::file_test(filename, G_FILE_TEST_EXISTS) && !Inkscape::IO::file_is_writable(filename)) { + g_free(fileName); + throw Output::file_read_only(); + } + Inkscape::XML::Node *repr = sp_document_repr_root(doc); diff --git a/src/file.cpp b/src/file.cpp index fd1438eb6..924ddc53d 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -591,6 +591,14 @@ file_save(Gtk::Window &parentWindow, SPDocument *doc, const Glib::ustring &uri, g_free(text); g_free(safeUri); return FALSE; + } catch (Inkscape::Extension::Output::file_read_only &e) { + gchar *safeUri = Inkscape::IO::sanitizeString(uri.c_str()); + gchar *text = g_strdup_printf(_("File %s is write protected. Please remove write protection and try again."), safeUri); + SP_ACTIVE_DESKTOP->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("Document not saved.")); + sp_ui_error_dialog(text); + g_free(text); + g_free(safeUri); + return FALSE; } catch (Inkscape::Extension::Output::save_failed &e) { gchar *safeUri = Inkscape::IO::sanitizeString(uri.c_str()); gchar *text = g_strdup_printf(_("File %s could not be saved."), safeUri); @@ -604,6 +612,9 @@ file_save(Gtk::Window &parentWindow, SPDocument *doc, const Glib::ustring &uri, return FALSE; } catch (Inkscape::Extension::Output::no_overwrite &e) { return sp_file_save_dialog(parentWindow, doc, Inkscape::Extension::FILE_SAVE_METHOD_SAVE_AS); + } catch (...) { + SP_ACTIVE_DESKTOP->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("Document not saved.")); + return FALSE; } SP_ACTIVE_DESKTOP->event_log->rememberFileSave(); @@ -837,8 +848,8 @@ sp_file_save_document(Gtk::Window &parentWindow, SPDocument *doc) if (doc->isModifiedSinceSave()) { if ( doc->uri == NULL ) { - // Hier sollte in Argument mitgegeben werden, das anzeigt, daß das Dokument das erste - // Mal gespeichert wird, so daß als default .svg ausgewählt wird und nicht die zuletzt + // Hier sollte in Argument mitgegeben werden, das anzeigt, da� das Dokument das erste + // Mal gespeichert wird, so da� als default .svg ausgew�hlt wird und nicht die zuletzt // benutzte "Save as ..."-Endung return sp_file_save_dialog(parentWindow, doc, Inkscape::Extension::FILE_SAVE_METHOD_INKSCAPE_SVG); } else { diff --git a/src/io/sys.cpp b/src/io/sys.cpp index a5158c587..2841f0af8 100644 --- a/src/io/sys.cpp +++ b/src/io/sys.cpp @@ -15,6 +15,8 @@ # include "config.h" #endif +#include +#include #include #include #if GLIB_CHECK_VERSION(2,6,0) @@ -269,6 +271,38 @@ bool Inkscape::IO::file_test( char const *utf8name, GFileTest test ) return exists; } +bool Inkscape::IO::file_is_writable( char const *utf8name) +{ + bool success = true; + + if ( utf8name) { + gchar *filename = NULL; + if (utf8name && !g_utf8_validate(utf8name, -1, NULL)) { + /* FIXME: Trying to guess whether or not a filename is already in utf8 is unreliable. + If any callers pass non-utf8 data (e.g. using g_get_home_dir), then change caller to + use simple g_file_test. Then add g_return_val_if_fail(g_utf_validate(...), false) + to beginning of this function. */ + filename = g_strdup(utf8name); + // Looks like g_get_home_dir isn't safe. + //g_warning("invalid UTF-8 detected internally. HUNT IT DOWN AND KILL IT!!!"); + } else { + filename = g_filename_from_utf8 ( utf8name, -1, NULL, NULL, NULL ); + } + if ( filename ) { + struct stat st; + if(g_lstat (filename, &st) == 0) { + success = ((st.st_mode & S_IWRITE) != 0); + } + g_free(filename); + filename = NULL; + } else { + g_warning( "Unable to convert filename in IO:file_test" ); + } + } + + return success; +} + /** Wrapper around g_dir_open, but taking a utf8name as first argument. */ GDir * Inkscape::IO::dir_open(gchar const *const utf8name, guint const flags, GError **const error) diff --git a/src/io/sys.h b/src/io/sys.h index 29c33c1c7..8623f6be9 100644 --- a/src/io/sys.h +++ b/src/io/sys.h @@ -38,6 +38,8 @@ int file_open_tmp( std::string& name_used, const std::string& prefix ); bool file_test( char const *utf8name, GFileTest test ); +bool file_is_writable( char const *utf8name); + GDir *dir_open(gchar const *utf8name, guint flags, GError **error); gchar *dir_read_utf8name(GDir *dir); -- cgit v1.2.3 From e19781175af3e23bb1afe30c3152db7d4fbef777 Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Fri, 18 Sep 2009 06:33:52 +0000 Subject: i18n fixes for Bug #408093. (bzr r8608) --- src/ui/dialog/filter-effects-dialog.cpp | 2 +- src/ui/dialog/layers.cpp | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp index 171c23ae4..c7f505046 100644 --- a/src/ui/dialog/filter-effects-dialog.cpp +++ b/src/ui/dialog/filter-effects-dialog.cpp @@ -1315,7 +1315,7 @@ void FilterEffectsDialog::FilterModifier::add_filter() const int count = _model->children().size(); std::ostringstream os; - os << "filter" << count; + os << _("filter") << count; filter->setLabel(os.str().c_str()); update_filters(); diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp index f0c4cd0dd..a06b6c9b6 100644 --- a/src/ui/dialog/layers.cpp +++ b/src/ui/dialog/layers.cpp @@ -658,7 +658,9 @@ LayersPanel::LayersPanel() : _buttonsRow.add( *btn ); btn = manage( new Gtk::Button() ); - _styleButton( *btn, targetDesktop, SP_VERB_LAYER_TO_TOP, GTK_STOCK_GOTO_TOP, _("Top") ); + //TRANSLATORS: only translate "string" in "context|string". + // For more details, see http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html#Q-:CAPS + _styleButton( *btn, targetDesktop, SP_VERB_LAYER_TO_TOP, GTK_STOCK_GOTO_TOP, Q_("layers|Top") ); btn->signal_clicked().connect( sigc::bind( sigc::mem_fun(*this, &LayersPanel::_takeAction), (int)BUTTON_TOP) ); _watchingNonTop.push_back( btn ); _buttonsRow.add( *btn ); -- cgit v1.2.3 From 71b35ce89832fb12c2a7391c030208da8af03c4f Mon Sep 17 00:00:00 2001 From: bulia byak Date: Fri, 18 Sep 2009 18:46:15 +0000 Subject: back out Diederik's patch, problems with 32-bit systems (bzr r8612) --- src/libnr/nr-compose-transform.cpp | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/libnr/nr-compose-transform.cpp b/src/libnr/nr-compose-transform.cpp index bb392bd24..afc8fd987 100644 --- a/src/libnr/nr-compose-transform.cpp +++ b/src/libnr/nr-compose-transform.cpp @@ -25,10 +25,10 @@ extern "C" { int nr_have_mmx (void); void nr_mmx_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM_0 (unsigned char *px, int w, int h, int rs, const unsigned char *spx, int sw, int sh, int srs, - const long long *FFd2s, unsigned int alpha); + const long *FFd2s, unsigned int alpha); void nr_mmx_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM_n (unsigned char *px, int w, int h, int rs, const unsigned char *spx, int sw, int sh, int srs, - const long long *FFd2s, const long *FF_S, unsigned int alpha, int dbits); + const long *FFd2s, const long *FF_S, unsigned int alpha, int dbits); #define NR_PIXOPS_MMX (1 && nr_have_mmx ()) #ifdef __cplusplus } @@ -40,7 +40,6 @@ void nr_mmx_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM_n (unsigned char *px, int /* Fixed point precision */ #define FBITS 12 -#define FBITS_HP 18 // In some places we need a higher precision void nr_R8G8B8A8_N_EMPTY_R8G8B8A8_N_TRANSFORM (unsigned char *px, int w, int h, int rs, const unsigned char *spx, int sw, int sh, int srs, @@ -169,10 +168,10 @@ void nr_R8G8B8A8_N_R8G8B8A8_N_R8G8B8A8_P_TRANSFORM (unsigned char *px, int w, in static void nr_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM_0 (unsigned char *px, int w, int h, int rs, const unsigned char *spx, int sw, int sh, int srs, - const long long *FFd2s, unsigned int alpha) + const long *FFd2s, unsigned int alpha) { - unsigned char *d0; - long long FFsx0, FFsy0; + unsigned char *d0; + int FFsx0, FFsy0; int x, y; d0 = px; @@ -181,15 +180,15 @@ nr_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM_0 (unsigned char *px, int w, int h for (y = 0; y < h; y++) { unsigned char *d; - long long FFsx, FFsy; + long FFsx, FFsy; d = d0; FFsx = FFsx0; FFsy = FFsy0; for (x = 0; x < w; x++) { long sx, sy; - sx = long(FFsx >> FBITS_HP); + sx = FFsx >> FBITS; if ((sx >= 0) && (sx < sw)) { - sy = long(FFsy >> FBITS_HP); + sy = FFsy >> FBITS; if ((sy >= 0) && (sy < sh)) { const unsigned char *s; unsigned int a; @@ -225,11 +224,11 @@ nr_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM_0 (unsigned char *px, int w, int h static void nr_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM_n (unsigned char *px, int w, int h, int rs, const unsigned char *spx, int sw, int sh, int srs, - const long long *FFd2s, const long *FF_S, unsigned int alpha, int dbits) + const long *FFd2s, const long *FF_S, unsigned int alpha, int dbits) { int size; unsigned char *d0; - long long FFsx0, FFsy0; + int FFsx0, FFsy0; int x, y; size = (1 << dbits); @@ -243,7 +242,7 @@ nr_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM_n (unsigned char *px, int w, int h for (y = 0; y < h; y++) { unsigned char *d; - long long FFsx, FFsy; + long FFsx, FFsy; d = d0; FFsx = FFsx0; FFsy = FFsy0; @@ -253,9 +252,9 @@ nr_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM_n (unsigned char *px, int w, int h r = g = b = a = 0; for (i = 0; i < size; i++) { long sx, sy; - sx = (FFsx >> FBITS_HP) + (FF_S[2 * i] >> FBITS); + sx = (FFsx + FF_S[2 * i]) >> FBITS; if ((sx >= 0) && (sx < sw)) { - sy = (FFsy >> FBITS_HP) + (FF_S[2 * i + 1] >> FBITS); + sy = (FFsy + FF_S[2 * i + 1]) >> FBITS; if ((sy >= 0) && (sy < sh)) { const unsigned char *s; unsigned int ca; @@ -303,7 +302,6 @@ void nr_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM (unsigned char *px, int w, in { int dbits; long FFd2s[6]; - long long FFd2s_HP[6]; // with higher precision int i; if (alpha == 0) return; @@ -312,18 +310,17 @@ void nr_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM (unsigned char *px, int w, in for (i = 0; i < 6; i++) { FFd2s[i] = (long) (d2s[i] * (1 << FBITS) + 0.5); - FFd2s_HP[i] = (long) (d2s[i] * (1 << FBITS_HP) + 0.5);; } if (dbits == 0) { #ifdef WITH_MMX if (NR_PIXOPS_MMX) { /* WARNING: MMX composer REQUIRES w > 0 and h > 0 */ - nr_mmx_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM_0 (px, w, h, rs, spx, sw, sh, srs, FFd2s_HP, alpha); + nr_mmx_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM_0 (px, w, h, rs, spx, sw, sh, srs, FFd2s, alpha); return; } #endif - nr_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM_0 (px, w, h, rs, spx, sw, sh, srs, FFd2s_HP, alpha); + nr_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM_0 (px, w, h, rs, spx, sw, sh, srs, FFd2s, alpha); } else { int xsize, ysize; long FFs_x_x_S, FFs_x_y_S, FFs_y_x_S, FFs_y_y_S; @@ -350,11 +347,11 @@ void nr_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM (unsigned char *px, int w, in #ifdef WITH_MMX if (NR_PIXOPS_MMX) { /* WARNING: MMX composer REQUIRES w > 0 and h > 0 */ - nr_mmx_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM_n (px, w, h, rs, spx, sw, sh, srs, FFd2s_HP, FF_S, alpha, dbits); + nr_mmx_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM_n (px, w, h, rs, spx, sw, sh, srs, FFd2s, FF_S, alpha, dbits); return; } #endif - nr_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM_n (px, w, h, rs, spx, sw, sh, srs, FFd2s_HP, FF_S, alpha, dbits); + nr_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM_n (px, w, h, rs, spx, sw, sh, srs, FFd2s, FF_S, alpha, dbits); } } -- cgit v1.2.3 From 7fb43b788ea98a46f3dbf9f431948abb167929fe Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Sun, 20 Sep 2009 00:12:39 +0000 Subject: Sanitize profile names for valid XML ids. Modified patch that addresses bug #405143. (bzr r8619) --- src/ui/dialog/document-properties.cpp | 41 ++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 423778276..105d220a9 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -381,8 +381,40 @@ DocumentProperties::populate_available_profiles(){ _menu.show_all(); } -void -DocumentProperties::linkSelectedProfile() +/** + * Cleans up name to remove disallowed characters. + * Some discussion at http://markmail.org/message/bhfvdfptt25kgtmj + * Allowed ASCII first characters: ':', 'A'-'Z', '_', 'a'-'z' + * Allowed ASCII remaining chars add: '-', '.', '0'-'9', + * + * @param str the string to clean up. + */ +static void sanitizeName( Glib::ustring& str ) +{ + if (str.size() > 1) { + char val = str.at(0); + if (((val < 'A') || (val > 'Z')) + && ((val < 'a') || (val > 'z')) + && (val != '_') + && (val != ':')) { + str.replace(0, 1, "_"); + } + for (Glib::ustring::size_type i = 1; i < str.size(); i++) { + char val = str.at(i); + if (((val < 'A') || (val > 'Z')) + && ((val < 'a') || (val > 'z')) + && ((val < '0') || (val > '9')) + && (val != '_') + && (val != ':') + && (val != '-') + && (val != '.')) { + str.replace(i, 1, "_"); + } + } + } +} + +void DocumentProperties::linkSelectedProfile() { //store this profile in the SVG document (create element in the XML) // TODO remove use of 'active' desktop @@ -396,7 +428,10 @@ DocumentProperties::linkSelectedProfile() } Inkscape::XML::Document *xml_doc = sp_document_repr_doc(desktop->doc()); Inkscape::XML::Node *cprofRepr = xml_doc->createElement("svg:color-profile"); - cprofRepr->setAttribute("name", (gchar*) _menu.get_active()->get_data("name")); + gchar* tmp = static_cast(_menu.get_active()->get_data("name")); + Glib::ustring nameStr = tmp ? tmp : "profile"; // TODO add some auto-numbering to avoid collisions + sanitizeName(nameStr); + cprofRepr->setAttribute("name", nameStr.c_str()); cprofRepr->setAttribute("xlink:href", (gchar*) _menu.get_active()->get_data("filepath")); // Checks whether there is a defs element. Creates it when needed -- cgit v1.2.3 From 4157de25941065e92289248ce5138124a70a4b73 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Sun, 20 Sep 2009 05:09:12 +0000 Subject: Conditionally disable per-document "auto" palette (bzr r8620) --- src/ui/dialog/swatches.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src') diff --git a/src/ui/dialog/swatches.cpp b/src/ui/dialog/swatches.cpp index e273a827c..1f708e3de 100644 --- a/src/ui/dialog/swatches.cpp +++ b/src/ui/dialog/swatches.cpp @@ -47,6 +47,8 @@ #include "display/nr-plain-stuff.h" #include "sp-gradient-reference.h" +//#define USE_DOCUMENT_PALETTE 1 + namespace Inkscape { namespace UI { namespace Dialogs { @@ -364,6 +366,7 @@ static void redirSecondaryClick( GtkMenuItem *menuitem, gpointer /*user_data*/ ) } } +#if USE_DOCUMENT_PALETTE static void editGradientImpl( SPGradient* gr ) { if ( gr ) { @@ -424,6 +427,7 @@ static void addNewGradient( GtkMenuItem */*menuitem*/, gpointer /*user_data*/ ) } } } +#endif // USE_DOCUMENT_PALETTE static gboolean handleButtonPress( GtkWidget* /*widget*/, GdkEventButton* event, gpointer user_data) { @@ -451,6 +455,7 @@ static gboolean handleButtonPress( GtkWidget* /*widget*/, GdkEventButton* event, user_data); gtk_menu_shell_append(GTK_MENU_SHELL(popupMenu), child); +#if USE_DOCUMENT_PALETTE child = gtk_separator_menu_item_new(); gtk_menu_shell_append(GTK_MENU_SHELL(popupMenu), child); popupExtras.push_back(child); @@ -484,6 +489,7 @@ static gboolean handleButtonPress( GtkWidget* /*widget*/, GdkEventButton* event, gtk_menu_shell_append(GTK_MENU_SHELL(popupMenu), child); //popupExtras.push_back(child); gtk_widget_set_sensitive( child, FALSE ); +#endif // USE_DOCUMENT_PALETTE gtk_widget_show_all(popupMenu); } @@ -1248,6 +1254,7 @@ SwatchesPanel::SwatchesPanel(gchar const* prefsPath) : _clear->ptr = this; _remove = new ColorItem( ege::PaintDef::NONE ); _remove->ptr = this; +#if USE_DOCUMENT_PALETTE { JustForNow *docPalette = new JustForNow(); @@ -1256,6 +1263,7 @@ SwatchesPanel::SwatchesPanel(gchar const* prefsPath) : _ptr = docPalette; } +#endif // USE_DOCUMENT_PALETTE loadEmUp(); if ( !possible.empty() ) { JustForNow* first = 0; @@ -1403,6 +1411,7 @@ void SwatchesPanel::handleGradientsChange() } } +#if USE_DOCUMENT_PALETTE if ( _ptr ) { JustForNow *docPalette = reinterpret_cast(_ptr); // TODO delete pointed to objects @@ -1462,10 +1471,12 @@ void SwatchesPanel::handleGradientsChange() _rebuild(); } } +#endif // USE_DOCUMENT_PALETTE } void SwatchesPanel::_updateFromSelection() { +#if USE_DOCUMENT_PALETTE if ( _ptr ) { JustForNow *docPalette = reinterpret_cast(_ptr); @@ -1543,6 +1554,7 @@ void SwatchesPanel::_updateFromSelection() item->setState( isFill, isStroke ); } } +#endif // USE_DOCUMENT_PALETTE } void SwatchesPanel::_handleAction( int setId, int itemId ) -- cgit v1.2.3 From f5fbb47d99b74312c44ad16734ca0dbdf9bcf968 Mon Sep 17 00:00:00 2001 From: Josh Andler Date: Mon, 21 Sep 2009 20:58:04 +0000 Subject: Patch by Adib for 238796 (bzr r8626) --- src/desktop.cpp | 16 +++++++++------- src/desktop.h | 1 - 2 files changed, 9 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/desktop.cpp b/src/desktop.cpp index 8c070786e..f7ef1a8cd 100644 --- a/src/desktop.cpp +++ b/src/desktop.cpp @@ -148,7 +148,6 @@ SPDesktop::SPDesktop() : _layer_hierarchy( 0 ), _reconstruction_old_layer_id( 0 ), _display_mode(Inkscape::RENDERMODE_NORMAL), - _saved_display_mode(Inkscape::RENDERMODE_NORMAL), _widget( 0 ), _inkscape( 0 ), _guides_message_context( 0 ), @@ -444,18 +443,21 @@ void SPDesktop::_setDisplayMode(Inkscape::RenderMode mode) { SP_CANVAS_ARENA (drawing)->arena->rendermode = mode; canvas->rendermode = mode; _display_mode = mode; - if (mode != Inkscape::RENDERMODE_OUTLINE) { - _saved_display_mode = _display_mode; - } sp_canvas_item_affine_absolute (SP_CANVAS_ITEM (main), _d2w); // redraw _widget->setTitle(SP_DOCUMENT_NAME(sp_desktop_document(this))); } void SPDesktop::displayModeToggle() { - if (_display_mode == Inkscape::RENDERMODE_OUTLINE) { - _setDisplayMode(_saved_display_mode); - } else { + switch (_display_mode) { + case Inkscape::RENDERMODE_NORMAL: + _setDisplayMode(Inkscape::RENDERMODE_NO_FILTERS); + break; + case Inkscape::RENDERMODE_NO_FILTERS: _setDisplayMode(Inkscape::RENDERMODE_OUTLINE); + break; + case Inkscape::RENDERMODE_OUTLINE: + default: + _setDisplayMode(Inkscape::RENDERMODE_NORMAL); } } diff --git a/src/desktop.h b/src/desktop.h index 73b9262dd..4438c90e5 100644 --- a/src/desktop.h +++ b/src/desktop.h @@ -203,7 +203,6 @@ struct SPDesktop : public Inkscape::UI::View::View } void displayModeToggle(); Inkscape::RenderMode _display_mode; - Inkscape::RenderMode _saved_display_mode; Inkscape::RenderMode getMode() const { return _display_mode; } Inkscape::UI::Widget::Dock* getDock() { return _widget->getDock(); } -- cgit v1.2.3 From 1062e1a7ca8527b934d3de184d1abdf42aa1e401 Mon Sep 17 00:00:00 2001 From: bulia byak Date: Mon, 21 Sep 2009 21:20:17 +0000 Subject: fix by Diederik for 422972 (bzr r8627) --- src/event-context.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/event-context.cpp b/src/event-context.cpp index 753d0679a..958e8cb2b 100644 --- a/src/event-context.cpp +++ b/src/event-context.cpp @@ -1181,8 +1181,12 @@ void sp_event_context_snap_delay_handler(SPEventContext *ec, SPItem* const item, bool const c1 = event->state & GDK_BUTTON2_MASK; // We shouldn't hold back any events when other mouse buttons have been bool const c2 = event->state & GDK_BUTTON3_MASK; // pressed, e.g. when scrolling with the middle mouse button; if we do then // Inkscape will get stuck in an unresponsive state - - if (c1 || c2) { + bool const c3 = tools_isactive(ec->desktop, TOOLS_CALLIGRAPHIC); + // The snap delay will repeat the last motion event, which will lead to + // erroneous points in the calligraphy context. And because we don't snap + // in this context, we might just as well disable the snap delay all together + + if (c1 || c2 || c3) { // Make sure that we don't send any pending snap events to a context if we know in advance // that we're not going to snap any way (e.g. while scrolling with middle mouse button) // Any motion event might affect the state of the context, leading to unexpected behavior -- cgit v1.2.3 From 6413ea1f0bc64210933ddc237aaea4c8ed10f859 Mon Sep 17 00:00:00 2001 From: Josh Andler Date: Tue, 22 Sep 2009 05:16:43 +0000 Subject: Fix by Adib for 430804. (bzr r8628) --- src/display/nr-filter.cpp | 20 ++++++++++++-------- src/extension/internal/filter/filter.cpp | 30 +++++++++++++++++++----------- 2 files changed, 31 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/display/nr-filter.cpp b/src/display/nr-filter.cpp index af432bdf3..3ca2b0dba 100644 --- a/src/display/nr-filter.cpp +++ b/src/display/nr-filter.cpp @@ -52,7 +52,7 @@ #if defined (SOLARIS) && (SOLARIS == 8) #include "round.h" using Inkscape::round; -#endif +#endif namespace Inkscape { namespace Filters { @@ -92,9 +92,9 @@ Filter::Filter() Filter::Filter(int n) { _primitive_count = 0; - _primitive_table_size = n; - _primitive = new FilterPrimitive*[n]; - for ( int i = 0 ; i < n ; i++ ) { + _primitive_table_size = (n > 0) ? n : 1; // we guarantee there is at least 1(one) filter slot + _primitive = new FilterPrimitive*[_primitive_table_size]; + for ( int i = 0 ; i < _primitive_table_size ; i++ ) { _primitive[i] = NULL; } _common_init(); @@ -159,7 +159,7 @@ int Filter::render(NRArenaItem const *item, NRPixBlock *pb) // It's no use to try and filter an empty object. return 1; } - + FilterUnits units(_filter_units, _primitive_units); units.set_ctm(trans); units.set_item_bbox(item_bbox); @@ -370,7 +370,11 @@ void Filter::_enlarge_primitive_table() { for (int i = _primitive_count ; i < _primitive_table_size ; i++) { new_tbl[i] = NULL; } - delete[] _primitive; + if(_primitive != NULL) { + delete[] _primitive; + } else { + g_warning("oh oh"); + } _primitive = new_tbl; } @@ -434,7 +438,7 @@ void Filter::clear_primitives() } void Filter::set_x(SVGLength const &length) -{ +{ if (length._set) _region_x = length; } @@ -449,7 +453,7 @@ void Filter::set_width(SVGLength const &length) _region_width = length; } void Filter::set_height(SVGLength const &length) -{ +{ if (length._set) _region_height = length; } diff --git a/src/extension/internal/filter/filter.cpp b/src/extension/internal/filter/filter.cpp index 048207332..d98f8e9a2 100644 --- a/src/extension/internal/filter/filter.cpp +++ b/src/extension/internal/filter/filter.cpp @@ -70,7 +70,7 @@ Filter::get_filter (Inkscape::Extension::Extension * ext) { return sp_repr_read_mem(filter, strlen(filter), NULL); } -void +void Filter::merge_filters (Inkscape::XML::Node * to, Inkscape::XML::Node * from, Inkscape::XML::Document * doc, gchar * srcGraphic, gchar * srcGraphicAlpha) { if (from == NULL) return; @@ -99,7 +99,7 @@ Filter::merge_filters (Inkscape::XML::Node * to, Inkscape::XML::Node * from, Ink from_child != NULL ; from_child = from_child->next()) { Glib::ustring name = "svg:"; name += from_child->name(); - + Inkscape::XML::Node * to_child = doc->createElement(name.c_str()); to->appendChild(to_child); merge_filters(to_child, from_child, doc, srcGraphic, srcGraphicAlpha); @@ -149,7 +149,7 @@ Filter::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View *d Glib::ustring url = "url(#"; url += newfilterroot->attribute("id"); url += ")"; merge_filters(newfilterroot, filterdoc->root(), xmldoc); - + Inkscape::GC::release(newfilterroot); sp_repr_css_set_property(css, "filter", url.c_str()); @@ -170,21 +170,29 @@ Filter::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View *d } g_free(lfilter); + // no filter if (filternode == NULL) { + g_warning("no assoziating filter found!"); continue; } - filternode->lastChild()->setAttribute("result", FILTER_SRC_GRAPHIC); + if (filternode->lastChild() == NULL) { + // empty filter, we insert + merge_filters(filternode, filterdoc->root(), xmldoc); + } else { + // existing filter, we merge + filternode->lastChild()->setAttribute("result", FILTER_SRC_GRAPHIC); + Inkscape::XML::Node * alpha = xmldoc->createElement("svg:feColorMatrix"); + alpha->setAttribute("result", FILTER_SRC_GRAPHIC_ALPHA); + alpha->setAttribute("in", FILTER_SRC_GRAPHIC); // not required, but we're being explicit + alpha->setAttribute("values", "0 0 0 -1 0 0 0 0 -1 0 0 0 0 -1 0 0 0 0 1 0"); - Inkscape::XML::Node * alpha = xmldoc->createElement("svg:feColorMatrix"); - alpha->setAttribute("result", FILTER_SRC_GRAPHIC_ALPHA); - alpha->setAttribute("in", FILTER_SRC_GRAPHIC); // not required, but we're being explicit - alpha->setAttribute("values", "0 0 0 -1 0 0 0 0 -1 0 0 0 0 -1 0 0 0 0 1 0"); - filternode->appendChild(alpha); + filternode->appendChild(alpha); - merge_filters(filternode, filterdoc->root(), xmldoc, FILTER_SRC_GRAPHIC, FILTER_SRC_GRAPHIC_ALPHA); + merge_filters(filternode, filterdoc->root(), xmldoc, FILTER_SRC_GRAPHIC, FILTER_SRC_GRAPHIC_ALPHA); - Inkscape::GC::release(alpha); + Inkscape::GC::release(alpha); + } } } -- cgit v1.2.3 From 338d3664cbe9c56464338c45c420c9618229e731 Mon Sep 17 00:00:00 2001 From: Josh Andler Date: Tue, 22 Sep 2009 20:21:38 +0000 Subject: Patch by Adib for 431022. Appears safe, however, I am unable to test as it is/was a win32 issue only. (bzr r8631) --- src/dialogs/export.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/dialogs/export.cpp b/src/dialogs/export.cpp index ce0786a01..adadcd2f6 100644 --- a/src/dialogs/export.cpp +++ b/src/dialogs/export.cpp @@ -1358,7 +1358,7 @@ sp_export_browse_clicked (GtkButton */*button*/, gpointer /*userdata*/) #ifdef WIN32 // code in this section is borrowed from ui/dialogs/filedialogimpl-win32.cpp OPENFILENAMEW opf; - WCHAR* filter_string = (WCHAR*)g_utf8_to_utf16("PNG\0*.png\0\0", 12, NULL, NULL, NULL); + WCHAR* filter_string = (WCHAR*)g_utf8_to_utf16("PNG\0*.png\0", 10, NULL, NULL, NULL); WCHAR* title_string = (WCHAR*)g_utf8_to_utf16(_("Select a filename for exporting"), -1, NULL, NULL, NULL); WCHAR* extension_string = (WCHAR*)g_utf8_to_utf16("*.png", -1, NULL, NULL, NULL); // Copy the selected file name, converting from UTF-8 to UTF-16 -- cgit v1.2.3 From e313aed76c3bc76bbdd3b99c1a2afbed58db7da7 Mon Sep 17 00:00:00 2001 From: Josh Andler Date: Wed, 23 Sep 2009 13:23:33 +0000 Subject: Better patch by Adib for 431022. Appears safe, however, I am unable to test as it is/was a win32 issue only. (bzr r8635) --- src/dialogs/export.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/dialogs/export.cpp b/src/dialogs/export.cpp index adadcd2f6..2c04135bc 100644 --- a/src/dialogs/export.cpp +++ b/src/dialogs/export.cpp @@ -1358,7 +1358,11 @@ sp_export_browse_clicked (GtkButton */*button*/, gpointer /*userdata*/) #ifdef WIN32 // code in this section is borrowed from ui/dialogs/filedialogimpl-win32.cpp OPENFILENAMEW opf; - WCHAR* filter_string = (WCHAR*)g_utf8_to_utf16("PNG\0*.png\0", 10, NULL, NULL, NULL); + WCHAR filter_string[20]; + wcsncpy(filter_string, L"PNG#*.png##", 11); + filter_string[3] = L'\0'; + filter_string[9] = L'\0'; + filter_string[10] = L'\0'; WCHAR* title_string = (WCHAR*)g_utf8_to_utf16(_("Select a filename for exporting"), -1, NULL, NULL, NULL); WCHAR* extension_string = (WCHAR*)g_utf8_to_utf16("*.png", -1, NULL, NULL, NULL); // Copy the selected file name, converting from UTF-8 to UTF-16 @@ -1397,7 +1401,7 @@ sp_export_browse_clicked (GtkButton */*button*/, gpointer /*userdata*/) } g_free(extension_string); g_free(title_string); - g_free(filter_string); + #else if (gtk_dialog_run (GTK_DIALOG (fs)) == GTK_RESPONSE_ACCEPT) { -- cgit v1.2.3 From 8ead1fdd38578da4c61ab5295883073f4548c998 Mon Sep 17 00:00:00 2001 From: Josh Andler Date: Wed, 23 Sep 2009 20:27:22 +0000 Subject: Fix for 181663 by The Adib. Yay for working Italics button on the toolbar! (bzr r8641) --- src/libnrtype/FontFactory.cpp | 256 +++++++++++++++++++++++------------------- src/text-context.cpp | 6 +- src/widgets/toolbox.cpp | 39 +++++-- 3 files changed, 176 insertions(+), 125 deletions(-) (limited to 'src') diff --git a/src/libnrtype/FontFactory.cpp b/src/libnrtype/FontFactory.cpp index 71387ac55..fec9316b9 100644 --- a/src/libnrtype/FontFactory.cpp +++ b/src/libnrtype/FontFactory.cpp @@ -81,7 +81,7 @@ ink_strstr(char const *haystack, char const *pneedle) char *needle, *q, *foundto; if (!*pneedle) return true; if (!haystack) return false; - + needle = buf; p = pneedle; q = needle; while ((*q++ = tolower(*p++))) @@ -202,7 +202,7 @@ is_swash(char const *s) * Determines if two style names match. This allows us to match * based on the type of style rather than simply doing string matching, * because for instance 'Plain' and 'Normal' mean the same thing. - * + * * Q: Shouldn't this include the other tests such as is_outline, etc.? * Q: Is there a problem with strcasecmp on Win32? Should it use stricmp? */ @@ -211,22 +211,22 @@ style_name_compare(char const *aa, char const *bb) { char const *a = (char const *) aa; char const *b = (char const *) bb; - + if (is_regular(a) && !is_regular(b)) return -1; if (is_regular(b) && !is_regular(a)) return 1; - + if (is_bold(a) && !is_bold(b)) return 1; if (is_bold(b) && !is_bold(a)) return -1; - + if (is_italic(a) && !is_italic(b)) return 1; if (is_italic(b) && !is_italic(a)) return -1; - + if (is_nonbold(a) && !is_nonbold(b)) return 1; if (is_nonbold(b) && !is_nonbold(a)) return -1; - + if (is_caps(a) && !is_caps(b)) return 1; if (is_caps(b) && !is_caps(a)) return -1; - + return strcasecmp(a, b); } @@ -238,18 +238,18 @@ style_record_compare(void const *aa, void const *bb) { NRStyleRecord const *a = (NRStyleRecord const *) aa; NRStyleRecord const *b = (NRStyleRecord const *) bb; - + return (style_name_compare(a->name, b->name)); } -static void font_factory_name_list_destructor(NRNameList *list) +static void font_factory_name_list_destructor(NRNameList *list) { - for (unsigned int i = 0; i < list->length; i++) + for (unsigned int i = 0; i < list->length; i++) g_free(list->names[i]); if ( list->names ) g_free(list->names); } -static void font_factory_style_list_destructor(NRStyleList *list) +static void font_factory_style_list_destructor(NRStyleList *list) { for (unsigned int i = 0; i < list->length; i++) { g_free((void *) (list->records)[i].name); @@ -331,7 +331,7 @@ font_factory::~font_factory(void) //pango_ft2_shutdown_display(); #endif //g_object_unref(fontContext); - + // Delete the pango font pointers in the string to instance map PangoStringToDescrMap::iterator it = fontInstanceMap.begin(); while (it != fontInstanceMap.end()) { @@ -344,116 +344,116 @@ font_factory::~font_factory(void) Glib::ustring font_factory::ConstructFontSpecification(PangoFontDescription *font) { Glib::ustring pangoString; - + g_assert(font); - + if (font) { // Once the format for the font specification is decided, it must be // kept.. if it is absolutely necessary to change it, the attribute // it is written to needs to have a new version so the legacy files // can be read. - + PangoFontDescription *copy = pango_font_description_copy(font); - + pango_font_description_unset_fields (copy, PANGO_FONT_MASK_SIZE); pangoString = Glib::ustring(pango_font_description_to_string(copy)); - + pango_font_description_free(copy); - + } - + return pangoString; } Glib::ustring font_factory::ConstructFontSpecification(font_instance *font) { Glib::ustring pangoString; - + g_assert(font); - + if (font) { pangoString = ConstructFontSpecification(font->descr); } - + return pangoString; } Glib::ustring font_factory::GetUIFamilyString(PangoFontDescription const *fontDescr) { Glib::ustring family; - + g_assert(fontDescr); - + if (fontDescr) { // For now, keep it as family name taken from pango family = pango_font_description_get_family(fontDescr); } - + return family; } Glib::ustring font_factory::GetUIStyleString(PangoFontDescription const *fontDescr) { Glib::ustring style; - + g_assert(fontDescr); - + if (fontDescr) { PangoFontDescription *fontDescrCopy = pango_font_description_copy(fontDescr); - + pango_font_description_unset_fields(fontDescrCopy, PANGO_FONT_MASK_FAMILY); pango_font_description_unset_fields(fontDescrCopy, PANGO_FONT_MASK_SIZE); - + // For now, keep it as style name taken from pango style = pango_font_description_to_string(fontDescrCopy); - + pango_font_description_free(fontDescrCopy); } - - return style; + + return style; } Glib::ustring font_factory::ReplaceFontSpecificationFamily(const Glib::ustring & fontSpec, const Glib::ustring & newFamily) { Glib::ustring newFontSpec; - + // Although we are using the string from pango_font_description_to_string for the // font specification, we definitely cannot just set the new family in the // PangoFontDescription structure and ask for a new string. This is because // what constitutes a "family" in our own UI may be different from how Pango // sees it. - + // Find the PangoFontDescription associated to this fontSpec PangoStringToDescrMap::iterator it = fontInstanceMap.find(fontSpec); - + if (it != fontInstanceMap.end()) { PangoFontDescription *descr = pango_font_description_copy((*it).second); - + // Grab the UI Family string from the descr Glib::ustring uiFamily = GetUIFamilyString(descr); - + // Replace the UI Family name with the new family name std::size_t found = fontSpec.find(uiFamily); if (found != Glib::ustring::npos) { newFontSpec = fontSpec; newFontSpec.erase(found, uiFamily.size()); newFontSpec.insert(found, newFamily); - + // If the new font specification does not exist in the reference maps, - // search for the next best match for the faces in that style + // search for the next best match for the faces in that style it = fontInstanceMap.find(newFontSpec); if (it == fontInstanceMap.end()) { - + PangoFontDescription *newFontDescr = pango_font_description_from_string(newFontSpec.c_str()); - + PangoFontDescription *bestMatchForNewDescr = NULL; Glib::ustring bestMatchFontDescription; - + bool setFirstFamilyMatch = false; for (it = fontInstanceMap.begin(); it != fontInstanceMap.end(); it++) { - + Glib::ustring currentFontSpec = (*it).first; - + // Save some time by only looking at the right family if (currentFontSpec.find(newFamily) != Glib::ustring::npos) { if (!setFirstFamilyMatch) { @@ -466,10 +466,10 @@ Glib::ustring font_factory::ReplaceFontSpecificationFamily(const Glib::ustring & // Get the font description that corresponds, and // then see if we've found a better match PangoFontDescription *possibleMatch = pango_font_description_copy((*it).second); - + if (pango_font_description_better_match( newFontDescr, bestMatchForNewDescr, possibleMatch)) { - + pango_font_description_free(bestMatchForNewDescr); bestMatchForNewDescr = possibleMatch; bestMatchFontDescription = currentFontSpec; @@ -479,31 +479,37 @@ Glib::ustring font_factory::ReplaceFontSpecificationFamily(const Glib::ustring & } } } - + newFontSpec = bestMatchFontDescription; - + pango_font_description_free(newFontDescr); pango_font_description_free(bestMatchForNewDescr); } } - + pango_font_description_free(descr); } - + return newFontSpec; } +/** + apply style property to the given font + @param fontSpec the given font + @param turnOn true to set italic style + @return the changed fontspec, if the property can not be set return an empty string +*/ Glib::ustring font_factory::FontSpecificationSetItalic(const Glib::ustring & fontSpec, bool turnOn) { Glib::ustring newFontSpec; - + // Find the PangoFontDesecription that goes with this font specification string PangoStringToDescrMap::iterator it = fontInstanceMap.find(fontSpec); - + if (it != fontInstanceMap.end()) { // If we did find one, make a copy and set/unset the italic as needed PangoFontDescription *descr = pango_font_description_copy((*it).second); - + PangoStyle style; if (turnOn) { style = PANGO_STYLE_ITALIC; @@ -511,31 +517,51 @@ Glib::ustring font_factory::FontSpecificationSetItalic(const Glib::ustring & fon style = PANGO_STYLE_NORMAL; } pango_font_description_set_style(descr, style); - + newFontSpec = ConstructFontSpecification(descr); if (fontInstanceMap.find(newFontSpec) == fontInstanceMap.end()) { - // If the new font does not have an italic face, don't - // allow italics to be set! - newFontSpec = fontSpec; + if(turnOn) { + // there is no PANGO_STYLE_ITALIC let's test for PANGO_STYLE_OBLIQUE + style = PANGO_STYLE_OBLIQUE; + pango_font_description_set_style(descr, style); + + newFontSpec = ConstructFontSpecification(descr); + if (fontInstanceMap.find(newFontSpec) == fontInstanceMap.end()) { + // If the new font does not have even an oblique face, don't + // allow italics to be set! + newFontSpec = Glib::ustring(""); + } + + } else { + // If the new font does not have an italic face, don't + // allow italics to be set! + newFontSpec = Glib::ustring(""); + } } - + pango_font_description_free(descr); } - - return newFontSpec; + + return newFontSpec; } +/** + apply width property to the given font + @param fontSpec the given font + @param turnOn true to set bold + @return the changed fontspec, if the property can not be set return an empty string +*/ Glib::ustring font_factory::FontSpecificationSetBold(const Glib::ustring & fontSpec, bool turnOn) { Glib::ustring newFontSpec; - + // Find the PangoFontDesecription that goes with this font specification string PangoStringToDescrMap::iterator it = fontInstanceMap.find(fontSpec); - + if (it != fontInstanceMap.end()) { // If we did find one, make a copy and set/unset the bold as needed PangoFontDescription *descr = pango_font_description_copy((*it).second); - + PangoWeight weight; if (turnOn) { weight = PANGO_WEIGHT_BOLD; @@ -543,18 +569,18 @@ Glib::ustring font_factory::FontSpecificationSetBold(const Glib::ustring & fontS weight = PANGO_WEIGHT_NORMAL; } pango_font_description_set_weight(descr, weight); - + newFontSpec = ConstructFontSpecification(descr); if (fontInstanceMap.find(newFontSpec) == fontInstanceMap.end()) { // If the new font does not have a bold face, don't // allow bold to be set! - newFontSpec = fontSpec; + newFontSpec = Glib::ustring(""); } - + pango_font_description_free(descr); } - - return newFontSpec; + + return newFontSpec; } ///// @@ -567,51 +593,51 @@ static bool StyleNameCompareInternal(Glib::ustring style1, Glib::ustring style2) void font_factory::GetUIFamiliesAndStyles(FamilyToStylesMap *map) { g_assert(map); - + if (map) { - + // Gather the family names as listed by Pango PangoFontFamily** families = NULL; int numFamilies = 0; pango_font_map_list_families(fontServer, &families, &numFamilies); - + for (int currentFamily=0; currentFamily < numFamilies; currentFamily++) { - + // Gather the styles for this family PangoFontFace** faces = NULL; int numFaces = 0; pango_font_family_list_faces(families[currentFamily], &faces, &numFaces); - + for (int currentFace=0; currentFace < numFaces; currentFace++) { - - // If the face has a name, describe it, and then use the + + // If the face has a name, describe it, and then use the // description to get the UI family and face strings - + if (pango_font_face_get_face_name(faces[currentFace]) == NULL) { continue; } - + PangoFontDescription *faceDescr = pango_font_face_describe(faces[currentFace]); if (faceDescr) { Glib::ustring familyUIName = GetUIFamilyString(faceDescr); Glib::ustring styleUIName = GetUIStyleString(faceDescr); - + if (!familyUIName.empty() && !styleUIName.empty()) { // Find the right place to put the style information, adding // a map entry for the family name if it doesn't yet exist - + FamilyToStylesMap::iterator iter = map->find(familyUIName); - + if (iter == map->end()) { map->insert(std::make_pair(familyUIName, std::list())); } - + // Insert into the style list and save the info in the reference maps // only if the style does not yet exist - + bool exists = false; std::list &styleList = (*map)[familyUIName]; - + for (std::list::iterator it=styleList.begin(); it != styleList.end(); it++) { @@ -620,10 +646,10 @@ void font_factory::GetUIFamiliesAndStyles(FamilyToStylesMap *map) break; } } - + if (!exists) { styleList.push_back(styleUIName); - + // Add the string info needed in the reference maps fontStringMap.insert( std::make_pair( @@ -640,7 +666,7 @@ void font_factory::GetUIFamiliesAndStyles(FamilyToStylesMap *map) } } } - + // Sort the style lists for (FamilyToStylesMap::iterator iter = map->begin() ; iter != map->end(); iter++) { (*iter).second.sort(StyleNameCompareInternal); @@ -651,24 +677,24 @@ void font_factory::GetUIFamiliesAndStyles(FamilyToStylesMap *map) font_instance* font_factory::FaceFromStyle(SPStyle const *style) { font_instance *font = NULL; - + g_assert(style); - + if (style) { // First try to use the font specification if it is set if (style->text->font_specification.set && style->text->font_specification.value && *style->text->font_specification.value) { - + font = FaceFromFontSpecification(style->text->font_specification.value); } - + // If that failed, try using the CSS information in the style if (!font) { font = Face(style->text->font_family.value, font_style_to_pos(*style)); } } - + return font; } @@ -684,13 +710,13 @@ font_instance *font_factory::FaceFromDescr(char const *family, char const *style font_instance* font_factory::FaceFromUIStrings(char const *uiFamily, char const *uiStyle) { font_instance *fontInstance = NULL; - + g_assert(uiFamily && uiStyle); if (uiFamily && uiStyle) { Glib::ustring uiString = Glib::ustring(uiFamily) + Glib::ustring(uiStyle); - + UIStringToPangoStringMap::iterator uiToPangoIter = fontStringMap.find(uiString); - + if (uiToPangoIter != fontStringMap.end ()) { PangoStringToDescrMap::iterator pangoToDescrIter = fontInstanceMap.find((*uiToPangoIter).second); if (pangoToDescrIter != fontInstanceMap.end()) { @@ -701,56 +727,56 @@ font_instance* font_factory::FaceFromUIStrings(char const *uiFamily, char const } } } - + return fontInstance; } font_instance* font_factory::FaceFromPangoString(char const *pangoString) { font_instance *fontInstance = NULL; - + g_assert(pangoString); - + if (pangoString) { PangoFontDescription *descr = NULL; - + // First attempt to find the font specification in the reference map PangoStringToDescrMap::iterator it = fontInstanceMap.find(Glib::ustring(pangoString)); if (it != fontInstanceMap.end()) { descr = pango_font_description_copy((*it).second); } - + // Or create a font description from the string - this may fail or // produce unexpected results if the string does not have a good format if (!descr) { descr = pango_font_description_from_string(pangoString); } - + if (descr && (pango_font_description_get_family(descr) != NULL)) { fontInstance = Face(descr); } - + if (descr) { pango_font_description_free(descr); } } - + return fontInstance; } font_instance* font_factory::FaceFromFontSpecification(char const *fontSpecification) { font_instance *font = NULL; - + g_assert(fontSpecification); - + if (fontSpecification) { // How the string is used to reconstruct a font depends on how it // was constructed in ConstructFontSpecification. As it stands, // the font specification is a pango-created string font = FaceFromPangoString(fontSpecification); } - + return font; } @@ -764,9 +790,9 @@ font_instance *font_factory::Face(PangoFontDescription *descr, bool canFail) #else pango_font_description_set_size(descr, (int) (fontSize*PANGO_SCALE)); // mandatory huge size (hinting workaround) #endif - + font_instance *res = NULL; - + if ( loadedFaces.find(descr) == loadedFaces.end() ) { // not yet loaded PangoFont *nFace = NULL; @@ -784,7 +810,7 @@ font_instance *font_factory::Face(PangoFontDescription *descr, bool canFail) // duplicate FcPattern, the hard way res = new font_instance(); // store the descr of the font we asked for, since this is the key where we intend to put the font_instance at - // in the hash_map. the descr of the returned pangofont may differ from what was asked, so we don't know (at this + // in the hash_map. the descr of the returned pangofont may differ from what was asked, so we don't know (at this // point) whether loadedFaces[that_descr] is free or not (and overwriting an entry will bring deallocation problems) res->descr = pango_font_description_copy(descr); res->daddy = this; @@ -844,15 +870,15 @@ font_instance *font_factory::Face(char const *family, int variant, int style, in font_instance *font_factory::Face(char const *family, NRTypePosDef apos) { PangoFontDescription *temp_descr = pango_font_description_new(); - + pango_font_description_set_family(temp_descr, family); - + if ( apos.variant == NR_POS_VARIANT_SMALLCAPS ) { pango_font_description_set_variant(temp_descr, PANGO_VARIANT_SMALL_CAPS); } else { pango_font_description_set_variant(temp_descr, PANGO_VARIANT_NORMAL); } - + if ( apos.italic ) { pango_font_description_set_style(temp_descr, PANGO_STYLE_ITALIC); } else if ( apos.oblique ) { @@ -860,7 +886,7 @@ font_instance *font_factory::Face(char const *family, NRTypePosDef apos) } else { pango_font_description_set_style(temp_descr, PANGO_STYLE_NORMAL); } - + if ( apos.weight <= NR_POS_WEIGHT_ULTRA_LIGHT ) { pango_font_description_set_weight(temp_descr, PANGO_WEIGHT_ULTRALIGHT); } else if ( apos.weight <= NR_POS_WEIGHT_LIGHT ) { @@ -874,7 +900,7 @@ font_instance *font_factory::Face(char const *family, NRTypePosDef apos) } else { pango_font_description_set_weight(temp_descr, PANGO_WEIGHT_HEAVY); } - + if ( apos.stretch <= NR_POS_STRETCH_ULTRA_CONDENSED ) { pango_font_description_set_stretch(temp_descr, PANGO_STRETCH_EXTRA_CONDENSED); } else if ( apos.stretch <= NR_POS_STRETCH_CONDENSED ) { @@ -890,7 +916,7 @@ font_instance *font_factory::Face(char const *family, NRTypePosDef apos) } else { pango_font_description_set_stretch(temp_descr, PANGO_STRETCH_EXTRA_EXPANDED); } - + font_instance *res = Face(temp_descr); pango_font_description_free(temp_descr); return res; diff --git a/src/text-context.cpp b/src/text-context.cpp index c1986972a..e6f4f083b 100644 --- a/src/text-context.cpp +++ b/src/text-context.cpp @@ -881,10 +881,10 @@ sp_text_context_root_handler(SPEventContext *const event_context, GdkEvent *cons if (MOD__CTRL_ONLY && tc->text) { SPStyle const *style = sp_te_style_at_position(tc->text, std::min(tc->text_sel_start, tc->text_sel_end)); SPCSSAttr *css = sp_repr_css_attr_new(); - if (style->font_style.computed == SP_CSS_FONT_STYLE_NORMAL) - sp_repr_css_set_property(css, "font-style", "italic"); - else + if (style->font_style.computed != SP_CSS_FONT_STYLE_NORMAL) sp_repr_css_set_property(css, "font-style", "normal"); + else + sp_repr_css_set_property(css, "font-style", "italic"); sp_te_apply_style(tc->text, tc->text_sel_start, tc->text_sel_end, css); sp_repr_css_attr_unref(css); sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index 25b6e5b94..46ad08262 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -5941,7 +5941,7 @@ sp_text_toolbox_selection_changed (Inkscape::Selection */*selection*/, GObject * GtkToggleButton *button = GTK_TOGGLE_BUTTON (g_object_get_data (G_OBJECT (tbl), "style-bold")); gboolean active = gtk_toggle_button_get_active (button); - gboolean check = (query->font_weight.computed >= SP_CSS_FONT_WEIGHT_700); + gboolean check = ((query->font_weight.computed >= SP_CSS_FONT_WEIGHT_700) && (query->font_weight.computed != SP_CSS_FONT_WEIGHT_NORMAL) && (query->font_weight.computed != SP_CSS_FONT_WEIGHT_LIGHTER)); if (active != check) { @@ -6208,17 +6208,31 @@ sp_text_toolbox_style_toggled (GtkToggleButton *button, fontFromStyle->Unref(); } + bool nochange = true; switch (prop) { case 0: { if (!fontSpec.empty()) { newFontSpec = font_factory::Default()->FontSpecificationSetBold(fontSpec, active); + if (!newFontSpec.empty()) { + // Don't even set the bold if the font didn't exist on the system + sp_repr_css_set_property (css, "font-weight", active ? "bold" : "normal" ); + nochange = false; + } } - if (fontSpec != newFontSpec) { - // Don't even set the bold if the font didn't exist on the system - sp_repr_css_set_property (css, "font-weight", active ? "bold" : "normal" ); + // set or reset the button according + if(nochange) { + gboolean check = gtk_toggle_button_get_active (button); + + if (active != check) + { + g_object_set_data (G_OBJECT (button), "block", gpointer(1)); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), active); + g_object_set_data (G_OBJECT (button), "block", gpointer(0)); + } } + break; } @@ -6226,10 +6240,21 @@ sp_text_toolbox_style_toggled (GtkToggleButton *button, { if (!fontSpec.empty()) { newFontSpec = font_factory::Default()->FontSpecificationSetItalic(fontSpec, active); + if (!newFontSpec.empty()) { + // Don't even set the italic if the font didn't exist on the system + sp_repr_css_set_property (css, "font-style", active ? "italic" : "normal"); + nochange = false; + } } - if (fontSpec != newFontSpec) { - // Don't even set the italic if the font didn't exist on the system - sp_repr_css_set_property (css, "font-style", active ? "italic" : "normal"); + if(nochange) { + gboolean check = gtk_toggle_button_get_active (button); + + if (active != check) + { + g_object_set_data (G_OBJECT (button), "block", gpointer(1)); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), active); + g_object_set_data (G_OBJECT (button), "block", gpointer(0)); + } } break; } -- cgit v1.2.3 From 0ba3dac8fc917d58ab5618e22132930f4be0a1c7 Mon Sep 17 00:00:00 2001 From: Josh Andler Date: Thu, 24 Sep 2009 06:15:40 +0000 Subject: Patch by Diederik for 168384. Tested by myself and others and works well, additionally reads safe... Thanks Diederik! (bzr r8645) --- src/libnr/nr-compose-transform.cpp | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/libnr/nr-compose-transform.cpp b/src/libnr/nr-compose-transform.cpp index afc8fd987..ee12edba9 100644 --- a/src/libnr/nr-compose-transform.cpp +++ b/src/libnr/nr-compose-transform.cpp @@ -40,6 +40,7 @@ void nr_mmx_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM_n (unsigned char *px, int /* Fixed point precision */ #define FBITS 12 +#define FBITS_HP 18 // In some places we need a higher precision void nr_R8G8B8A8_N_EMPTY_R8G8B8A8_N_TRANSFORM (unsigned char *px, int w, int h, int rs, const unsigned char *spx, int sw, int sh, int srs, @@ -168,10 +169,10 @@ void nr_R8G8B8A8_N_R8G8B8A8_N_R8G8B8A8_P_TRANSFORM (unsigned char *px, int w, in static void nr_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM_0 (unsigned char *px, int w, int h, int rs, const unsigned char *spx, int sw, int sh, int srs, - const long *FFd2s, unsigned int alpha) + const long long *FFd2s, unsigned int alpha) { - unsigned char *d0; - int FFsx0, FFsy0; + unsigned char *d0; + long long FFsx0, FFsy0; int x, y; d0 = px; @@ -180,15 +181,15 @@ nr_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM_0 (unsigned char *px, int w, int h for (y = 0; y < h; y++) { unsigned char *d; - long FFsx, FFsy; + long long FFsx, FFsy; d = d0; FFsx = FFsx0; FFsy = FFsy0; for (x = 0; x < w; x++) { long sx, sy; - sx = FFsx >> FBITS; + sx = long(FFsx >> FBITS_HP); if ((sx >= 0) && (sx < sw)) { - sy = FFsy >> FBITS; + sy = long(FFsy >> FBITS_HP); if ((sy >= 0) && (sy < sh)) { const unsigned char *s; unsigned int a; @@ -224,11 +225,11 @@ nr_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM_0 (unsigned char *px, int w, int h static void nr_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM_n (unsigned char *px, int w, int h, int rs, const unsigned char *spx, int sw, int sh, int srs, - const long *FFd2s, const long *FF_S, unsigned int alpha, int dbits) + const long long *FFd2s, const long *FF_S, unsigned int alpha, int dbits) { int size; unsigned char *d0; - int FFsx0, FFsy0; + long long FFsx0, FFsy0; int x, y; size = (1 << dbits); @@ -242,7 +243,7 @@ nr_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM_n (unsigned char *px, int w, int h for (y = 0; y < h; y++) { unsigned char *d; - long FFsx, FFsy; + long long FFsx, FFsy; d = d0; FFsx = FFsx0; FFsy = FFsy0; @@ -252,9 +253,9 @@ nr_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM_n (unsigned char *px, int w, int h r = g = b = a = 0; for (i = 0; i < size; i++) { long sx, sy; - sx = (FFsx + FF_S[2 * i]) >> FBITS; + sx = (FFsx >> FBITS_HP) + (FF_S[2 * i] >> FBITS); if ((sx >= 0) && (sx < sw)) { - sy = (FFsy + FF_S[2 * i + 1]) >> FBITS; + sy = (FFsy >> FBITS_HP) + (FF_S[2 * i + 1] >> FBITS); if ((sy >= 0) && (sy < sh)) { const unsigned char *s; unsigned int ca; @@ -302,6 +303,7 @@ void nr_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM (unsigned char *px, int w, in { int dbits; long FFd2s[6]; + long long FFd2s_HP[6]; // with higher precision int i; if (alpha == 0) return; @@ -310,6 +312,7 @@ void nr_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM (unsigned char *px, int w, in for (i = 0; i < 6; i++) { FFd2s[i] = (long) (d2s[i] * (1 << FBITS) + 0.5); + FFd2s_HP[i] = (long long) (d2s[i] * (1 << FBITS_HP) + 0.5);; } if (dbits == 0) { @@ -320,7 +323,7 @@ void nr_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM (unsigned char *px, int w, in return; } #endif - nr_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM_0 (px, w, h, rs, spx, sw, sh, srs, FFd2s, alpha); + nr_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM_0 (px, w, h, rs, spx, sw, sh, srs, FFd2s_HP, alpha); } else { int xsize, ysize; long FFs_x_x_S, FFs_x_y_S, FFs_y_x_S, FFs_y_y_S; @@ -351,7 +354,7 @@ void nr_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM (unsigned char *px, int w, in return; } #endif - nr_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM_n (px, w, h, rs, spx, sw, sh, srs, FFd2s, FF_S, alpha, dbits); + nr_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM_n (px, w, h, rs, spx, sw, sh, srs, FFd2s_HP, FF_S, alpha, dbits); } } -- cgit v1.2.3 From 985bfc17d854636e6b55167cd0de5b351af54342 Mon Sep 17 00:00:00 2001 From: Josh Andler Date: Fri, 25 Sep 2009 21:48:48 +0000 Subject: Patch by Adib for 248721. Thanks Adib! (bzr r8650) --- src/libnrtype/Layout-TNG-Output.cpp | 42 ++++++++++++++----------------------- 1 file changed, 16 insertions(+), 26 deletions(-) (limited to 'src') diff --git a/src/libnrtype/Layout-TNG-Output.cpp b/src/libnrtype/Layout-TNG-Output.cpp index 2003ca26b..2b4b80e7c 100644 --- a/src/libnrtype/Layout-TNG-Output.cpp +++ b/src/libnrtype/Layout-TNG-Output.cpp @@ -215,7 +215,7 @@ void Layout::print(SPPrintContext *ctx, void Layout::showGlyphs(CairoRenderContext *ctx) const { if (_input_stream.empty()) return; - + bool clip_mode = false;//(ctx->getRenderMode() == CairoRenderContext::RENDER_MODE_CLIP); std::vector glyphtext; @@ -243,14 +243,9 @@ void Layout::showGlyphs(CairoRenderContext *ctx) const continue; } - Geom::Matrix font_matrix; - if (_path_fitted == NULL) { - font_matrix = glyph_matrix; - font_matrix[4] = 0; - font_matrix[5] = 0; - } else { - font_matrix.setIdentity(); - } + Geom::Matrix font_matrix = glyph_matrix; + font_matrix[4] = 0; + font_matrix[5] = 0; Glib::ustring::const_iterator span_iter = span.input_stream_first_character; unsigned char_index = _glyphs[glyph_index].in_character; @@ -276,13 +271,10 @@ void Layout::showGlyphs(CairoRenderContext *ctx) const CairoGlyphInfo info; info.index = _glyphs[glyph_index].glyph; - if (_path_fitted == NULL) { - info.x = glyph_matrix[4]; - info.y = glyph_matrix[5]; - } else { - info.x = 0; - info.y = 0; - } + // this is the translation for x,y-offset + info.x = glyph_matrix[4]; + info.y = glyph_matrix[5]; + glyphtext.push_back(info); glyph_index++; @@ -291,26 +283,24 @@ void Layout::showGlyphs(CairoRenderContext *ctx) const && _path_fitted == NULL && NR::transform_equalp(font_matrix, glyph_matrix, NR_EPSILON) && _characters[_glyphs[glyph_index].in_character].in_span == this_span_index); - + // remove vertical flip - font_matrix[3] *= -1.0; + Geom::Matrix flip_matrix; + flip_matrix.setIdentity(); + flip_matrix[3] = -1.0; + font_matrix = flip_matrix * font_matrix; SPStyle const *style = text_source->style; float opacity = SP_SCALE24_TO_FLOAT(style->opacity.value); - - if (_path_fitted) { - ctx->pushState(); - ctx->transform(&glyph_matrix); - } else if (opacity != 1.0) { + + if (opacity != 1.0) { ctx->pushState(); ctx->setStateForStyle(style); ctx->pushLayer(); } if (glyph_index - first_index > 0) ctx->renderGlyphtext(span.font->pFont, &font_matrix, glyphtext, style); - if (_path_fitted) - ctx->popState(); - else if (opacity != 1.0) { + if (opacity != 1.0) { ctx->popLayer(); ctx->popState(); } -- cgit v1.2.3 From 257bd68e4d262a5432f6cb1f6fed88d46512a4ca Mon Sep 17 00:00:00 2001 From: Josh Andler Date: Sat, 26 Sep 2009 20:11:28 +0000 Subject: Fix by Johan for 436304. (bzr r8651) --- src/live_effects/lpe-bendpath.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/live_effects/lpe-bendpath.cpp b/src/live_effects/lpe-bendpath.cpp index a820fe478..bc8477829 100644 --- a/src/live_effects/lpe-bendpath.cpp +++ b/src/live_effects/lpe-bendpath.cpp @@ -35,7 +35,7 @@ B is a map t --> B(t) = ( a(t), b(t) ). The first step is to re-parametrize B by its arc length: this is the parametrization in which a point p on B is located by its distance s from start. One obtains a new map s --> U(s) = (a'(s),b'(s)), that still describes the same path B, but where the distance along B from start to U(s) is s itself. -We also need a unit normal to the path. This can be obtained by computing a unit tangent vector, and rotate it by 90°. Call this normal vector N(s). +We also need a unit normal to the path. This can be obtained by computing a unit tangent vector, and rotate it by 90�. Call this normal vector N(s). The basic deformation associated to B is then given by: @@ -100,11 +100,14 @@ LPEBendPath::doEffect_pwd2 (Geom::Piecewise > const & pwd Piecewise x = vertical_pattern.get_value() ? Piecewise(patternd2[1]) : Piecewise(patternd2[0]); Piecewise y = vertical_pattern.get_value() ? Piecewise(patternd2[0]) : Piecewise(patternd2[1]); -//We use the group bounding box size or the path bbox size to translate well x and y - x-= vertical_pattern.get_value() ? boundingbox_Y.min() : boundingbox_X.min(); - y-= vertical_pattern.get_value() ? boundingbox_X.middle() : boundingbox_Y.middle(); + Interval bboxHorizontal = vertical_pattern.get_value() ? boundingbox_Y : boundingbox_X; + Interval bboxVertical = vertical_pattern.get_value() ? boundingbox_X : boundingbox_Y; - double scaling = uskeleton.cuts.back()/boundingbox_X.extent(); + //We use the group bounding box size or the path bbox size to translate well x and y + x-= bboxHorizontal.min(); + y-= bboxVertical.middle(); + + double scaling = uskeleton.cuts.back()/bboxHorizontal.extent(); if (scaling != 1.0) { x*=scaling; -- cgit v1.2.3 From a296952996a95299ccb4963479237b5bb86acda6 Mon Sep 17 00:00:00 2001 From: Josh Andler Date: Sat, 26 Sep 2009 20:40:26 +0000 Subject: Other patch by Johan to comment out a warning. Thanks Johan! (bzr r8652) --- src/live_effects/effect.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index de0535448..1d001b31a 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -505,7 +505,7 @@ Effect::getHelperPaths(SPLPEItem *lpeitem) std::vector hp_vec; if (!SP_IS_SHAPE(lpeitem)) { - g_print ("How to handle helperpaths for non-shapes?\n"); // non-shapes are for example SPGroups. +// g_print ("How to handle helperpaths for non-shapes?\n"); // non-shapes are for example SPGroups. return hp_vec; } -- cgit v1.2.3 From 4ddb323035fb844c768cf32a4dbbd54be540034a Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Sat, 26 Sep 2009 22:13:42 +0000 Subject: Fixed warning (bzr r8653) --- src/object-snapper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/object-snapper.cpp b/src/object-snapper.cpp index af0d9f1a2..22d438c1e 100644 --- a/src/object-snapper.cpp +++ b/src/object-snapper.cpp @@ -697,7 +697,7 @@ void Inkscape::ObjectSnapper::guideFreeSnap(SnappedConstraints &sc, void Inkscape::ObjectSnapper::guideConstrainedSnap(SnappedConstraints &sc, Geom::Point const &p, Geom::Point const &guide_normal, - ConstraintLine const &c) const + ConstraintLine const &/*c*/) const { /* Get a list of all the SPItems that we will try to snap to */ std::vector cand; -- cgit v1.2.3 From 8ce51ce022794df3396d8495a50148e37f84b3fa Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Sat, 26 Sep 2009 22:30:32 +0000 Subject: Fixed Win32 code for MS Windows-specific color profile location. Fixes bug #214198. (bzr r8654) --- src/color-profile.cpp | 52 +++++++++++++++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/color-profile.cpp b/src/color-profile.cpp index 5868a9582..6e180ab4f 100644 --- a/src/color-profile.cpp +++ b/src/color-profile.cpp @@ -1,4 +1,6 @@ - +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif //#define DEBUG_LCMS @@ -12,10 +14,17 @@ #include #include -// #ifdef WIN32 -// #include -// #include -// #endif + +#ifdef WIN32 +#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later. +#define _WIN32_WINDOWS 0x0410 +#endif +#if ENABLE_LCMS +#else +#include +#endif // ENABLE_LCMS +#endif + #include "xml/repr.h" #include "color-profile.h" #include "color-profile-fns.h" @@ -27,6 +36,9 @@ #include "dom/uri.h" #include "dom/util/digest.h" +#ifdef WIN32 +#include +#endif // WIN32 using Inkscape::ColorProfile; using Inkscape::ColorProfileClass; @@ -604,21 +616,21 @@ std::list ColorProfile::getProfileDirs() { } -// #ifdef WIN32 -// wchar_t pathBuf[MAX_PATH + 1]; -// pathBuf[0] = 0; -// DWORD pathSize = sizeof(pathBuf); -// g_assert(sizeof(wchar_t) == sizeof(gunichar2)); -// if ( GetColorDirectoryW( NULL, &pathBuf, &pathSize ) ) { -// gchar * utf8Path = g_utf16_to_utf8( (gunichar2*)(&pathBuf[0]), -1, NULL, NULL, NULL ); -// if ( !g_utf8_validate(utf8Path, -1, NULL) ) { -// g_warning( "GetColorDirectoryW() resulted in invalid UTF-8" ); -// } else { -// sources.pushback(utf8Path); -// } -// g_free( utf8Path ); -// } -// #endif // WIN32 +#ifdef WIN32 + wchar_t pathBuf[MAX_PATH + 1]; + pathBuf[0] = 0; + DWORD pathSize = sizeof(pathBuf); + g_assert(sizeof(wchar_t) == sizeof(gunichar2)); + if ( GetColorDirectoryW( NULL, pathBuf, &pathSize ) ) { + gchar * utf8Path = g_utf16_to_utf8( (gunichar2*)(&pathBuf[0]), -1, NULL, NULL, NULL ); + if ( !g_utf8_validate(utf8Path, -1, NULL) ) { + g_warning( "GetColorDirectoryW() resulted in invalid UTF-8" ); + } else { + sources.push_back(utf8Path); + } + g_free( utf8Path ); + } +#endif // WIN32 return sources; } -- cgit v1.2.3 From de19afb91dc6dc9094cccfa84c790b7942de46ad Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Sun, 27 Sep 2009 01:11:50 +0000 Subject: fix build on win32 with LCMS_ENABLED (bzr r8655) --- src/color-profile.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src') diff --git a/src/color-profile.cpp b/src/color-profile.cpp index 6e180ab4f..37ebc4f30 100644 --- a/src/color-profile.cpp +++ b/src/color-profile.cpp @@ -16,13 +16,10 @@ #include #ifdef WIN32 -#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later. +#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later. Required for correctly including icm.h #define _WIN32_WINDOWS 0x0410 #endif -#if ENABLE_LCMS -#else #include -#endif // ENABLE_LCMS #endif #include "xml/repr.h" -- cgit v1.2.3 From c81c39a0cb321c8d3ac45aa460d77451f5340aea Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Sun, 27 Sep 2009 04:19:01 +0000 Subject: Updated allowed icc-profile names to match recent grammars. Follow-up for bug #405143 (bzr r8656) --- src/svg/svg-color-test.h | 2 ++ src/svg/svg-color.cpp | 13 ++++++++++--- src/ui/dialog/document-properties.cpp | 4 ++-- 3 files changed, 14 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/svg/svg-color-test.h b/src/svg/svg-color-test.h index 49af63a5d..a540d4b1b 100644 --- a/src/svg/svg-color-test.h +++ b/src/svg/svg-color-test.h @@ -87,6 +87,8 @@ public: {1, true, "positive", "icc-color(positive, +0.1)"}, {1, true, "negative", "icc-color(negative, -0.1)"}, {0, false, "", "icc-color(named, value)"}, + {1, true, "hyphen-name", "icc-color(hyphen-name, 1)"}, + {1, true, "under_name", "icc-color(under_name, 1)"}, }; for ( size_t i = 0; i < G_N_ELEMENTS(cases); i++ ) { diff --git a/src/svg/svg-color.cpp b/src/svg/svg-color.cpp index 9040d6e43..a8e24c311 100644 --- a/src/svg/svg-color.cpp +++ b/src/svg/svg-color.cpp @@ -454,7 +454,11 @@ sp_svg_create_color_hash() return colors; } - +/* + * Some discussion at http://markmail.org/message/bhfvdfptt25kgtmj + * Allowed ASCII first characters: ':', 'A'-'Z', '_', 'a'-'z' + * Allowed ASCII remaining chars add: '-', '.', '0'-'9', + */ bool sp_svg_read_icc_color( gchar const *str, gchar const **end_ptr, SVGICCColor* dest ) { bool good = true; @@ -484,11 +488,14 @@ bool sp_svg_read_icc_color( gchar const *str, gchar const **end_ptr, SVGICCColor } if ( !g_ascii_isalpha(*str) - && ( !(0x080 & *str) ) ) { + && ( !(0x080 & *str) ) + && (*str != '_') + && (*str != ':') ) { // Name must start with a certain type of character good = false; } else { - while ( g_ascii_isdigit(*str) || g_ascii_isalpha(*str) || (*str == '-') ) { + while ( g_ascii_isdigit(*str) || g_ascii_isalpha(*str) + || (*str == '-') || (*str == ':') || (*str == '_') || (*str == '.') ) { if ( dest ) { dest->colorProfile += *str; } diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 105d220a9..7e31b874a 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -397,7 +397,7 @@ static void sanitizeName( Glib::ustring& str ) && ((val < 'a') || (val > 'z')) && (val != '_') && (val != ':')) { - str.replace(0, 1, "_"); + str.replace(0, 1, "-"); } for (Glib::ustring::size_type i = 1; i < str.size(); i++) { char val = str.at(i); @@ -408,7 +408,7 @@ static void sanitizeName( Glib::ustring& str ) && (val != ':') && (val != '-') && (val != '.')) { - str.replace(i, 1, "_"); + str.replace(i, 1, "-"); } } } -- cgit v1.2.3 From 334108f41b21d0eb154b31501de18f5350d4bf8b Mon Sep 17 00:00:00 2001 From: Josh Andler Date: Sun, 27 Sep 2009 17:20:54 +0000 Subject: Revert patch from 168384 until after 0.47 (bzr r8657) --- src/libnr/nr-compose-transform.cpp | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/libnr/nr-compose-transform.cpp b/src/libnr/nr-compose-transform.cpp index ee12edba9..afc8fd987 100644 --- a/src/libnr/nr-compose-transform.cpp +++ b/src/libnr/nr-compose-transform.cpp @@ -40,7 +40,6 @@ void nr_mmx_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM_n (unsigned char *px, int /* Fixed point precision */ #define FBITS 12 -#define FBITS_HP 18 // In some places we need a higher precision void nr_R8G8B8A8_N_EMPTY_R8G8B8A8_N_TRANSFORM (unsigned char *px, int w, int h, int rs, const unsigned char *spx, int sw, int sh, int srs, @@ -169,10 +168,10 @@ void nr_R8G8B8A8_N_R8G8B8A8_N_R8G8B8A8_P_TRANSFORM (unsigned char *px, int w, in static void nr_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM_0 (unsigned char *px, int w, int h, int rs, const unsigned char *spx, int sw, int sh, int srs, - const long long *FFd2s, unsigned int alpha) + const long *FFd2s, unsigned int alpha) { - unsigned char *d0; - long long FFsx0, FFsy0; + unsigned char *d0; + int FFsx0, FFsy0; int x, y; d0 = px; @@ -181,15 +180,15 @@ nr_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM_0 (unsigned char *px, int w, int h for (y = 0; y < h; y++) { unsigned char *d; - long long FFsx, FFsy; + long FFsx, FFsy; d = d0; FFsx = FFsx0; FFsy = FFsy0; for (x = 0; x < w; x++) { long sx, sy; - sx = long(FFsx >> FBITS_HP); + sx = FFsx >> FBITS; if ((sx >= 0) && (sx < sw)) { - sy = long(FFsy >> FBITS_HP); + sy = FFsy >> FBITS; if ((sy >= 0) && (sy < sh)) { const unsigned char *s; unsigned int a; @@ -225,11 +224,11 @@ nr_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM_0 (unsigned char *px, int w, int h static void nr_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM_n (unsigned char *px, int w, int h, int rs, const unsigned char *spx, int sw, int sh, int srs, - const long long *FFd2s, const long *FF_S, unsigned int alpha, int dbits) + const long *FFd2s, const long *FF_S, unsigned int alpha, int dbits) { int size; unsigned char *d0; - long long FFsx0, FFsy0; + int FFsx0, FFsy0; int x, y; size = (1 << dbits); @@ -243,7 +242,7 @@ nr_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM_n (unsigned char *px, int w, int h for (y = 0; y < h; y++) { unsigned char *d; - long long FFsx, FFsy; + long FFsx, FFsy; d = d0; FFsx = FFsx0; FFsy = FFsy0; @@ -253,9 +252,9 @@ nr_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM_n (unsigned char *px, int w, int h r = g = b = a = 0; for (i = 0; i < size; i++) { long sx, sy; - sx = (FFsx >> FBITS_HP) + (FF_S[2 * i] >> FBITS); + sx = (FFsx + FF_S[2 * i]) >> FBITS; if ((sx >= 0) && (sx < sw)) { - sy = (FFsy >> FBITS_HP) + (FF_S[2 * i + 1] >> FBITS); + sy = (FFsy + FF_S[2 * i + 1]) >> FBITS; if ((sy >= 0) && (sy < sh)) { const unsigned char *s; unsigned int ca; @@ -303,7 +302,6 @@ void nr_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM (unsigned char *px, int w, in { int dbits; long FFd2s[6]; - long long FFd2s_HP[6]; // with higher precision int i; if (alpha == 0) return; @@ -312,7 +310,6 @@ void nr_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM (unsigned char *px, int w, in for (i = 0; i < 6; i++) { FFd2s[i] = (long) (d2s[i] * (1 << FBITS) + 0.5); - FFd2s_HP[i] = (long long) (d2s[i] * (1 << FBITS_HP) + 0.5);; } if (dbits == 0) { @@ -323,7 +320,7 @@ void nr_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM (unsigned char *px, int w, in return; } #endif - nr_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM_0 (px, w, h, rs, spx, sw, sh, srs, FFd2s_HP, alpha); + nr_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM_0 (px, w, h, rs, spx, sw, sh, srs, FFd2s, alpha); } else { int xsize, ysize; long FFs_x_x_S, FFs_x_y_S, FFs_y_x_S, FFs_y_y_S; @@ -354,7 +351,7 @@ void nr_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM (unsigned char *px, int w, in return; } #endif - nr_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM_n (px, w, h, rs, spx, sw, sh, srs, FFd2s_HP, FF_S, alpha, dbits); + nr_R8G8B8A8_P_R8G8B8A8_P_R8G8B8A8_N_TRANSFORM_n (px, w, h, rs, spx, sw, sh, srs, FFd2s, FF_S, alpha, dbits); } } -- cgit v1.2.3 From b8bb0a85a88308222a457c3d017a62eaa57c0524 Mon Sep 17 00:00:00 2001 From: Josh Andler Date: Sun, 27 Sep 2009 17:31:38 +0000 Subject: Patch from Adrian for 437550. (bzr r8658) --- src/extension/internal/cairo-render-context.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/extension/internal/cairo-render-context.cpp b/src/extension/internal/cairo-render-context.cpp index 364dfcfa8..cae496543 100644 --- a/src/extension/internal/cairo-render-context.cpp +++ b/src/extension/internal/cairo-render-context.cpp @@ -755,6 +755,8 @@ CairoRenderContext::setupSurface(double width, double height) _height = height; cairo_surface_t *surface = NULL; + cairo_matrix_t ctm; + cairo_matrix_init_identity (&ctm); switch (_target) { case CAIRO_SURFACE_TYPE_IMAGE: surface = cairo_image_surface_create(_target_format, (int)ceil(width), (int)ceil(height)); @@ -766,11 +768,19 @@ CairoRenderContext::setupSurface(double width, double height) #endif #ifdef CAIRO_HAS_PS_SURFACE case CAIRO_SURFACE_TYPE_PS: - surface = cairo_ps_surface_create_for_stream(Inkscape::Extension::Internal::_write_callback, _stream, width, height); -#if (CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 5, 2)) + if (!_eps && width > height) { + surface = cairo_ps_surface_create_for_stream(Inkscape::Extension::Internal::_write_callback, _stream, height, width); + cairo_matrix_init (&ctm, 0, -1, 1, 0, 0, 0); + cairo_matrix_translate (&ctm, -width, 0); + cairo_ps_surface_dsc_begin_page_setup (surface); + cairo_ps_surface_dsc_comment (surface, "%%PageOrientation: Landscape"); + } else { + surface = cairo_ps_surface_create_for_stream(Inkscape::Extension::Internal::_write_callback, _stream, width, height); + } if(CAIRO_STATUS_SUCCESS != cairo_surface_status(surface)) { return FALSE; } +#if (CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 5, 2)) cairo_ps_surface_restrict_to_level (surface, (cairo_ps_level_t)_ps_level); cairo_ps_surface_set_eps (surface, (cairo_bool_t) _eps); #endif @@ -781,7 +791,7 @@ CairoRenderContext::setupSurface(double width, double height) break; } - return _finishSurfaceSetup (surface); + return _finishSurfaceSetup (surface, &ctm); } bool -- cgit v1.2.3 From 012f594fb4e04db9b0b58d94ce30884694a55d43 Mon Sep 17 00:00:00 2001 From: Josh Andler Date: Sun, 27 Sep 2009 18:07:53 +0000 Subject: Patch by Adib for 382313. (bzr r8659) --- src/2geom/matrix.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/2geom/matrix.cpp b/src/2geom/matrix.cpp index 04a21d624..cc91743b1 100644 --- a/src/2geom/matrix.cpp +++ b/src/2geom/matrix.cpp @@ -179,7 +179,8 @@ Matrix Matrix::inverse() const { Matrix d; Geom::Coord const determ = det(); - if (!are_near(determ, 0.0)) { + // the numerical precision of the determinant must be significant + if (fabs(determ) > 1e-18) { Geom::Coord const ideterm = 1.0 / determ; d._c[0] = _c[3] * ideterm; -- cgit v1.2.3 From e4943dbbb7588a780b1cce6fc412a92e00b92d6c Mon Sep 17 00:00:00 2001 From: Josh Andler Date: Sun, 27 Sep 2009 21:36:48 +0000 Subject: Updated buildtool's files to undefine whiteboard. Comment out OCAL Export dialog. Also commented out verbs & file related functions for both as a precaution for command-line usage. (bzr r8661) --- src/file.cpp | 12 ++++++----- src/file.h | 4 ++-- src/menus-skeleton.h | 2 +- src/ui/dialog/ocaldialogs.cpp | 40 ++++++++++++++++++++++++++---------- src/ui/dialog/ocaldialogs.h | 48 +++++++++++++++++++++++++++++-------------- src/verbs.cpp | 18 ++++++++-------- src/verbs.h | 6 +++--- 7 files changed, 84 insertions(+), 46 deletions(-) (limited to 'src') diff --git a/src/file.cpp b/src/file.cpp index 924ddc53d..ef9706c33 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -68,9 +68,9 @@ # include #endif -#ifdef WITH_INKBOARD -#include "jabber_whiteboard/session-manager.h" -#endif +//#ifdef WITH_INKBOARD +//#include "jabber_whiteboard/session-manager.h" +//#endif #ifdef WIN32 #include @@ -1270,6 +1270,7 @@ sp_file_export_dialog(Gtk::Window &/*parentWindow*/) /** * Display an Export dialog, export as the selected type if OK pressed */ +/* bool sp_file_export_to_ocal_dialog(Gtk::Window &parentWindow) { @@ -1406,10 +1407,11 @@ sp_file_export_to_ocal_dialog(Gtk::Window &parentWindow) return success; } - +*/ /** * Export the current document to OCAL */ +/* void sp_file_export_to_ocal(Gtk::Window &parentWindow) { @@ -1421,7 +1423,7 @@ sp_file_export_to_ocal(Gtk::Window &parentWindow) if (success) SP_ACTIVE_DESKTOP->messageStack()->flash(Inkscape::IMMEDIATE_MESSAGE, _("Document exported...")); } - +*/ /*###################### ## I M P O R T F R O M O C A L diff --git a/src/file.h b/src/file.h index 770e519ab..97d1bd5f8 100644 --- a/src/file.h +++ b/src/file.h @@ -151,13 +151,13 @@ bool sp_file_export_dialog (Gtk::Window &parentWindow); /** * Export the current document to OCAL */ -void sp_file_export_to_ocal (Gtk::Window &parentWindow ); +//void sp_file_export_to_ocal (Gtk::Window &parentWindow ); /** * Export the current document to OCAL */ -bool sp_file_export_to_ocal_dialog (void *widget); +//bool sp_file_export_to_ocal_dialog (void *widget); /*###################### diff --git a/src/menus-skeleton.h b/src/menus-skeleton.h index a4bdcfd9a..c4a789e48 100644 --- a/src/menus-skeleton.h +++ b/src/menus-skeleton.h @@ -29,7 +29,7 @@ static char const menus_skeleton[] = " \n" #ifdef WITH_GNOME_VFS " \n" -" \n" +//" \n" #endif " \n" " \n" diff --git a/src/ui/dialog/ocaldialogs.cpp b/src/ui/dialog/ocaldialogs.cpp index ba572336c..d3887b1ca 100644 --- a/src/ui/dialog/ocaldialogs.cpp +++ b/src/ui/dialog/ocaldialogs.cpp @@ -41,6 +41,7 @@ namespace Dialog /** * Callback for fileNameEntry widget */ +/* void FileExportToOCALDialog::fileNameEntryChangedCallback() { if (!fileNameEntry) @@ -53,25 +54,32 @@ void FileExportToOCALDialog::fileNameEntryChangedCallback() myFilename = fileName; response(Gtk::RESPONSE_OK); } - +*/ /** * Constructor */ +/* FileExportToOCALDialog::FileExportToOCALDialog(Gtk::Window &parentWindow, FileDialogType fileTypes, const Glib::ustring &title) : FileDialogOCALBase(title, parentWindow) { - /* +*/ + /* * Start Taking the vertical Box and putting a Label * and a Entry to take the filename * Later put the extension selection and checkbox (?) */ /* Initalize to Autodetect */ +/* extension = NULL; +*/ /* No filename to start out with */ +/* myFilename = ""; +*/ /* Set our dialog type (save, export, etc...)*/ +/* dialogType = fileTypes; Gtk::VBox *vbox = get_vbox(); @@ -102,17 +110,19 @@ FileExportToOCALDialog::FileExportToOCALDialog(Gtk::Window &parentWindow, show_all_children(); } - +*/ /** * Destructor */ +/* FileExportToOCALDialog::~FileExportToOCALDialog() { } - +*/ /** * Show this dialog modally. Return true if user hits [OK] */ +/* bool FileExportToOCALDialog::show() { @@ -130,10 +140,11 @@ FileExportToOCALDialog::show() return FALSE; } } - +*/ /** * Get the file name chosen by the user. Valid after an [OK] */ +/* Glib::ustring FileExportToOCALDialog::getFilename() { @@ -150,7 +161,7 @@ FileExportToOCALDialog::change_title(const Glib::ustring& title) { this->set_title(title); } - +*/ //######################################################################## //# F I L E E X P O R T T O O C A L P A S S W O R D @@ -160,14 +171,17 @@ FileExportToOCALDialog::change_title(const Glib::ustring& title) /** * Constructor */ +/* FileExportToOCALPasswordDialog::FileExportToOCALPasswordDialog(Gtk::Window &parentWindow, const Glib::ustring &title) : FileDialogOCALBase(title, parentWindow) { +*/ /* * Start Taking the vertical Box and putting 2 Labels * and 2 Entries to take the username and password */ /* No username and password to start out with */ +/* myUsername = ""; myPassword = ""; @@ -200,18 +214,20 @@ FileExportToOCALPasswordDialog::FileExportToOCALPasswordDialog(Gtk::Window &pare show_all_children(); } - +*/ /** * Destructor */ +/* FileExportToOCALPasswordDialog::~FileExportToOCALPasswordDialog() { } - +*/ /** * Show this dialog modally. Return true if user hits [OK] */ +/* bool FileExportToOCALPasswordDialog::show() { @@ -229,20 +245,22 @@ FileExportToOCALPasswordDialog::show() return FALSE; } } - +*/ /** * Get the username. Valid after an [OK] */ +/* Glib::ustring FileExportToOCALPasswordDialog::getUsername() { myUsername = usernameEntry->get_text(); return myUsername; } - +*/ /** * Get the password. Valid after an [OK] */ +/* Glib::ustring FileExportToOCALPasswordDialog::getPassword() { @@ -255,7 +273,7 @@ FileExportToOCALPasswordDialog::change_title(const Glib::ustring& title) { this->set_title(title); } - +*/ //######################################################################### //### F I L E I M P O R T F R O M O C A L diff --git a/src/ui/dialog/ocaldialogs.h b/src/ui/dialog/ocaldialogs.h index 75d57fc59..ce26f2148 100644 --- a/src/ui/dialog/ocaldialogs.h +++ b/src/ui/dialog/ocaldialogs.h @@ -105,75 +105,86 @@ protected: /** * Our implementation of the FileExportToOCALDialog interface. */ +/* class FileExportToOCALDialog : public FileDialogOCALBase { public: +*/ /** * Constructor * @param fileTypes one of FileDialogTypes * @param title the title of the dialog * @param key a list of file types from which the user can select */ +/* FileExportToOCALDialog(Gtk::Window& parentWindow, FileDialogType fileTypes, - const Glib::ustring &title); - + const Glib::ustring &title); +*/ /** * Destructor. * Perform any necessary cleanups. */ +/* ~FileExportToOCALDialog(); - +*/ /** * Show an SaveAs file selector. * @return the selected path if user selected one, else NULL */ +/* bool show(); Glib::ustring getFilename(); Glib::ustring myFilename; - +*/ /** * Change the window title. */ +/* void change_title(const Glib::ustring& title); private: - +*/ /** * Fix to allow the user to type the file name */ +/* Gtk::Entry *fileNameEntry; - +*/ /** * Data mirror of the combo box */ +/* std::vector fileTypes; // Child widgets Gtk::HBox childBox; Gtk::VBox checksBox; Gtk::HBox fileBox; - +*/ /** * The extension to use to write this file */ +/* Inkscape::Extension::Extension *extension; - +*/ /** * Callback for user input into fileNameEntry */ +/* void fileNameEntryChangedCallback(); - +*/ /** * List of known file extensions. */ +/* std::set knownExtensions; }; //FileExportToOCAL - +*/ //######################################################################## //# F I L E E X P O R T T O O C A L P A S S W O R D @@ -183,45 +194,52 @@ private: /** * Our implementation of the FileExportToOCALPasswordDialog interface. */ +/* class FileExportToOCALPasswordDialog : public FileDialogOCALBase { public: +*/ /** * Constructor * @param title the title of the dialog */ +/* FileExportToOCALPasswordDialog(Gtk::Window& parentWindow, const Glib::ustring &title); - +*/ /** * Destructor. * Perform any necessary cleanups. */ +/* ~FileExportToOCALPasswordDialog(); - +*/ /** * Show 2 entry to input username and password. */ +/* bool show(); Glib::ustring getUsername(); Glib::ustring getPassword(); - +*/ /** * Change the window title. */ +/* void change_title(const Glib::ustring& title); Glib::ustring myUsername; Glib::ustring myPassword; private: - +*/ /** * Fix to allow the user to type the file name */ +/* Gtk::Entry *usernameEntry; Gtk::Entry *passwordEntry; @@ -231,7 +249,7 @@ private: Gtk::HBox passBox; }; //FileExportToOCALPassword - +*/ //######################################################################### diff --git a/src/verbs.cpp b/src/verbs.cpp index b634e2a44..fd549e381 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -81,9 +81,9 @@ #include "ui/dialog/swatches.h" #include "ui/icon-names.h" -#ifdef WITH_INKBOARD -#include "jabber_whiteboard/session-manager.h" -#endif +//#ifdef WITH_INKBOARD +//#include "jabber_whiteboard/session-manager.h" +//#endif /** * \brief Return the name without underscores and ellipsis, for use in dialog @@ -804,9 +804,9 @@ FileVerb::perform(SPAction *action, void *data, void */*pdata*/) case SP_VERB_FILE_IMPORT_FROM_OCAL: sp_file_import_from_ocal(*parent); break; - case SP_VERB_FILE_EXPORT_TO_OCAL: - sp_file_export_to_ocal(*parent); - break; +// case SP_VERB_FILE_EXPORT_TO_OCAL: +// sp_file_export_to_ocal(*parent); +// break; case SP_VERB_FILE_NEXT_DESKTOP: inkscape_switch_desktops_next(); break; @@ -1833,13 +1833,13 @@ DialogVerb::perform(SPAction *action, void *data, void */*pdata*/) case SP_VERB_DIALOG_ITEM: sp_item_dialog(); break; -#ifdef WITH_INKBOARD +/*#ifdef WITH_INKBOARD case SP_VERB_XMPP_CLIENT: { Inkscape::Whiteboard::SessionManager::showClient(); break; } -#endif +#endif*/ case SP_VERB_DIALOG_INPUT: sp_input_dialog(); break; @@ -2263,7 +2263,7 @@ Verb *Verb::_base_verbs[] = { new FileVerb(SP_VERB_FILE_EXPORT, "FileExport", N_("_Export Bitmap..."), N_("Export this document or a selection as a bitmap image"), INKSCAPE_ICON_DOCUMENT_EXPORT), new FileVerb(SP_VERB_FILE_IMPORT_FROM_OCAL, "FileImportFromOCAL", N_("Import From Open Clip Art Library"), N_("Import a document from Open Clip Art Library"), INKSCAPE_ICON_DOCUMENT_IMPORT_OCAL), - new FileVerb(SP_VERB_FILE_EXPORT_TO_OCAL, "FileExportToOCAL", N_("Export To Open Clip Art Library"), N_("Export this document to Open Clip Art Library"), INKSCAPE_ICON_DOCUMENT_EXPORT_OCAL), +// new FileVerb(SP_VERB_FILE_EXPORT_TO_OCAL, "FileExportToOCAL", N_("Export To Open Clip Art Library"), N_("Export this document to Open Clip Art Library"), INKSCAPE_ICON_DOCUMENT_EXPORT_OCAL), new FileVerb(SP_VERB_FILE_NEXT_DESKTOP, "NextWindow", N_("N_ext Window"), N_("Switch to the next document window"), INKSCAPE_ICON_WINDOW_NEXT), new FileVerb(SP_VERB_FILE_PREV_DESKTOP, "PrevWindow", N_("P_revious Window"), diff --git a/src/verbs.h b/src/verbs.h index c3b88918b..87fe27075 100644 --- a/src/verbs.h +++ b/src/verbs.h @@ -45,7 +45,7 @@ enum { SP_VERB_FILE_IMPORT, SP_VERB_FILE_EXPORT, SP_VERB_FILE_IMPORT_FROM_OCAL, /**< Import the file from Open Clip Art Library */ - SP_VERB_FILE_EXPORT_TO_OCAL, /**< Export the file to Open Clip Art Library */ +// SP_VERB_FILE_EXPORT_TO_OCAL, /**< Export the file to Open Clip Art Library */ SP_VERB_FILE_NEXT_DESKTOP, SP_VERB_FILE_PREV_DESKTOP, SP_VERB_FILE_CLOSE_VIEW, @@ -238,9 +238,9 @@ enum { SP_VERB_DIALOG_TOGGLE, SP_VERB_DIALOG_CLONETILER, SP_VERB_DIALOG_ITEM, -#ifdef WITH_INKBOARD +/*#ifdef WITH_INKBOARD SP_VERB_XMPP_CLIENT, -#endif +#endif*/ SP_VERB_DIALOG_INPUT, SP_VERB_DIALOG_INPUT2, SP_VERB_DIALOG_EXTENSIONEDITOR, -- cgit v1.2.3 From 520dabb2a80e0ad52eb3ee160b9873c5ea5e4d9e Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 28 Sep 2009 02:56:30 +0000 Subject: Merging in build changes from the 0.47pre3 release (bzr r8664) --- src/Makefile.am | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index 4d57de850..63b27398a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -266,10 +266,11 @@ check_PROGRAMS = cxxtests # List of all tests to be run. TESTS = $(check_PROGRAMS) ../share/extensions/test/run-all-extension-tests +# XFAIL_TESTS = $(check_PROGRAMS) ../share/extensions/test/run-all-extension-tests # including the the testsuites here ensures that they get distributed -cxxtests_SOURCES = cxxtests.cpp $(CXXTEST_TESTSUITES) -cxxtests_LDADD = libnr/nr-compose-reference.o $(all_libs) +cxxtests_SOURCES = cxxtests.cpp libnr/nr-compose-reference.cpp $(CXXTEST_TESTSUITES) +cxxtests_LDADD = $(all_libs) cxxtests.cpp: $(CXXTEST_TESTSUITES) $(CXXTEST_TEMPLATE) $(CXXTESTGEN) -o cxxtests.cpp $(CXXTEST_TESTSUITES) -- cgit v1.2.3 From d4783ff64d331ed663f7fa98d50f08280b22b0e8 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Mon, 28 Sep 2009 22:15:36 +0000 Subject: fix node counting for "moveto"-only paths. (bzr r8669) --- src/display/curve.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/display/curve.cpp b/src/display/curve.cpp index 5a1e2abeb..7d7dbc987 100644 --- a/src/display/curve.cpp +++ b/src/display/curve.cpp @@ -629,10 +629,14 @@ SPCurve::nodes_in_path() const nr++; // count last node (this works also for closed paths because although they don't have a 'last node', they do have an extra segment - if (it->closed()) { + // do not count closing knot double for zero-length closing line segments + // however, if the path is only a moveto, and is closed, do not subtract 1 (otherwise the result will be zero nodes) + if ( it->closed() + && ((*it).size() != 0) ) + { Geom::Curve const &c = it->back_closed(); if (are_near(c.initialPoint(), c.finalPoint())) { - nr--; // do not count closing knot double for zero-length closing line segments + nr--; } } } -- cgit v1.2.3 From cbd32e8b748028f2738c78bc00196dea6ffa5386 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Mon, 28 Sep 2009 22:16:57 +0000 Subject: fix error in curve cxxtests (bzr r8670) --- src/display/curve-test.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/display/curve-test.h b/src/display/curve-test.h index d779fe09b..784ccee89 100644 --- a/src/display/curve-test.h +++ b/src/display/curve-test.h @@ -90,7 +90,7 @@ public: pv[0] = path1; TS_ASSERT_EQUALS(SPCurve(pv).nodes_in_path() , 3u); pv[0] = path2; - TS_ASSERT_EQUALS(SPCurve(pv).nodes_in_path() , 3u); + TS_ASSERT_EQUALS(SPCurve(pv).nodes_in_path() , 2u); // zero length closing segments do not increase the nodecount. pv[0] = path3; TS_ASSERT_EQUALS(SPCurve(pv).nodes_in_path() , 5u); pv[0] = path4; -- cgit v1.2.3 From b55e62e487c04140ad196c375176d71391689e5f Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Mon, 28 Sep 2009 22:48:44 +0000 Subject: Remove unused files: ftos.cpp and ftos.h (bzr r8671) --- src/svg/ftos.cpp | 485 ------------------------------------------------------- src/svg/ftos.h | 54 ------- 2 files changed, 539 deletions(-) delete mode 100644 src/svg/ftos.cpp delete mode 100644 src/svg/ftos.h (limited to 'src') diff --git a/src/svg/ftos.cpp b/src/svg/ftos.cpp deleted file mode 100644 index c468b4c63..000000000 --- a/src/svg/ftos.cpp +++ /dev/null @@ -1,485 +0,0 @@ -/* ////////////////////////////////////////////////////////////////////// -// ftos.cc -// -// Copyright (c) 1996-2003 Bryce W. Harrington [bryce at osdl dot org] -// -//----------------------------------------------------------------------- -// License: This code may be used by anyone for any purpose -// so long as the copyright notices and this license -// statement remains attached. -//----------------------------------------------------------------------- -// -// string ftos(double val[, char mode[, int sigfig[, int precision[, int options]]]]) -// -// DESCRIPTION -// This routine is intended to replace the typical use of sprintf for -// converting floating point numbers into strings. -// -// To one-up sprintf, an additional mode was created - 'h' mode - -// which produces numbers in 'engineering notation' - exponents are -// always shown in multiples of 3. To non-engineers this mode is -// probably irrelevant, but for engineers (and scientists) it is SOP. -// -// One other new feature is an option to use 'x10^' instead of the -// conventional 'E' for exponental notation. This is entirely for -// aesthetics since numbers in the 'x10^' form cannot be used as -// inputs for most programs. -// -// For most cases, the routine can simply be used with the defaults -// and acceptable results will be produced. No fill zeros or trailing -// zeros are shown, and exponential notation is only used for numbers -// greater than 1e6 or less than 1e-3. -// -// The one area where sprintf may surpass this routine is in width control. -// No provisions are made in this routine to restrict a number to a -// certain number of digits (thus allowing the number to be constrained -// to an 8 space column, for instance.) Along with this, it does not -// support pre-padding a number with zeros (e.g., '5' -> '0005') and will -// not post-pad a number with spaces (i.e., allow left-justification.) -// -// If width control is this important, then the user will probably want to -// use the stdio routines, which really is well suited for outputting -// columns of data with a brief amount of code. -// -// PARAMETERS -// val - number to be converted -// mode - can be one of four possible values. Default is 'g' -// -// e: Produces numbers in scientific notation. One digit -// is shown on the left side of the decimal, the rest -// on the right, and the exponential is always shown. -// EXAMPLE: 1.04e-4 -// -// f: Produces numbers with fixed format. Number is shown -// exact, with no exponent. -// EXAMPLE: 0.000104 -// -// g: If val is greater than 1e6 or less than 1e-3 it will -// be shown in 'e' format, otherwise 'f' format will be -// used. -// -// h: Produces numbers in engineering format. Result is -// identical to 'f' format for numbers between 1 and -// 1e3, otherwise, the number is shown such that it -// always begins with a nonzero digit on the left side -// (unless number equals zero), and the exponential is -// a multiple of 3. -// EXAMPLE: 104e-6 -// -// If the mode is expressed as a capital letter (e.g., 'F') -// then the exponential part of the number will also be -// capitalized (e.g., '1E6' or '1X10^6'.) -// -// sigfig - the number of significant figures. These are the digits -// that are "retained". For example, the following numbers -// all have four sigfigs: -// 1234 12.34 0.0001234 1.234e-10 -// the last digit shown will be rounded in the standard -// manner (down if the next digit is less than 5, up otherwise.) -// -// precision - the number of digits to show to the right of the decimal. -// For example, all of the following numbers have precisions -// of 2: -// 1234.00 12.34 0.00 1.23e-10 123.40e-12 -// -// options - several options are allowed to control the look of the -// output. -// -// FORCE_DECIMAL - require the decimal point to be shown for -// numbers that do not have any fractional digits (or that -// have a precision set to zero) -// EXAMPLE: 1.e6 -// FORCE_EXP_ZERO - pad the 10's zero in exponent if necessary -// EXAMPLE: 1e06 -// FORCE_HUNDRED_EXP_ZERO - pad the 100's zero in exponent if -// necessary. Also pads 10's zero in exponent if necessary. -// EXAMPLE: 1e006 -// FORCE_EXP_PLUS - show the '+' in the exponent if exponent -// is used. -// EXAMPLE: 1e+6 -// FORCE_EXP - force the output to display the exponent -// EXAMPLE: 0e0 -// FORCE_X10 - use x10^ instead of E -// EXAMPLE: 1x10^6 -// FORCE_PLUS - force output of the '+' for positive numbers -// EXAMPLE: +1e6 -// -// Options can be combined using the usual OR method. For -// example, -// -// ftos(123.456, 'f', -1, -1, FORCE_PLUS | FORCE_X10 | FORCE_EXP) -// -// gives "+123.456x10^0" -// -// RETURN VALUE -// The string representation of the number is returned from the routine. -// The ANSI C++ Standard "string" class was used for several important -// reasons. First, because the string class manages it's own space, the -// ftos routine does not need to concern itself with writing to unallocated -// areas of memory or with handling memory reallocation internally. Second, -// it allows return of an object, not a pointer to an object; this may not -// be as efficient, but it is cleaner and safer than the alternative. Third, -// the routine's return value can be directly assigned to a variable, i.e. -// string var = ftos(3.1415); -// which makes code much easier to comprehend and modify. -// -// Internally, the ftos routine uses fairly typical string operators (=, +=, -// +, etc.) which pretty much any other flavor of string class will define as -// well. Thus if one does not have access to the ANSI C++ Standard string -// class, the user can substitute another with little difficulty. (If the -// alternate class is not named "string" then redefine "string" to whatever -// you wish to use. For example, -// #define string CString -// -// November 1996 - Bryce Harrington -// Created ftoa and ftos -// -// December 1996 - Bryce Harrington -// Added engineering notation mode, added sigfig capability, added -// significant debug code, added options, thoroughly debugged and -// tested the code. -// -// -// June 1999 - Bryce Harrington -// Modified to run on Linux for WorldForge -// -// March 2003 - Bryce Harrington -// Removed DTAG() macros - use of fprintf(stderr,...) instead -// Broke out round/itos/ftos into separate files -// Removed curses bits -// -/////////////////////////////////////////////////////////////////////// */ - -#include - -// This is the routine used for converting a floating point into a string -// This may be included in stdlib.h on some systems and may conflict. -// Let me know your system & etc. so I can properly #ifdef this, but -// try commenting the following four lines out if you run into conflicts. -// extern "C" { -// char* -// ecvt (double val, size_t ndigit, int *decpt, int *sign); -// } - -using namespace std; - -#ifndef HAS_ECVT -#include -#include -#endif - - -#include "ftos.h" - -#include - -// This routine counts from the end of a string like '10229000' to find the index -// of the first non-'0' character (5 would be returned for the above number.) -int countDigs(char *p) -{ - int length =0; - while (*(p+length)!='\0') length++; // Count total length - while (length>0 && *(p+length-1)=='0') length--; // Scan backwards for a non-'0' - return length; -} - -// This routine determines how many digits make up the left hand -// side of the number if the abs value of the number is greater than 1, or the -// digits that make up the right hand side if the abs value of the number -// is between 0 and 1. Returns 1 if v==0. Return value is positive for numbers -// greater than or equal to 1, negative for numbers less than 0.1, and zero for -// numbers between 0.1 and 1. -int countLhsDigits(double v) -{ - if (v<0) v = -v; // Take abs value - else if (v==0) return 1; // Special case if v==0 - - int n=0; - for (; v<0.1; v*=10) // Count digits on right hand side (l.t. 0.1) - { n--; } - for (; v>=1; v/=10) // Count digits on left hand side (g.e. 1.0) - { n++; } - return n; -} - -// This is the routine that does the work of converting the number into a string. -string ftos(double val, char mode, int sigfig, int precision, int options) -{ - // Parse the options to a more usable form - // These options allow the user to control some of the ornaments on the - // number that is output. By default they are all false. Turning them - // on helps to "fix" the format of the number so it lines up in columns - // better. - // - require the decimal point to be shown for numbers that do not have - // any fractional digits (or that have a precision set to zero - bool forceDecimal = (options & FORCE_DECIMAL); - // - show the 10's and 100's zero in exponent - bool forceExpZero = (options & FORCE_EXP_ZERO); - bool forceHundredExpZero = (options & FORCE_HUNDRED_EXP_ZERO); - // - show the '+' in the exponent if exponent is used - bool forceExpPlus = (options & FORCE_EXP_PLUS); - // - force the output to display the exponent - bool forceExponent = (options & FORCE_EXP); - // - use x10^ instead of E - bool forcex10 = (options & FORCE_X10); - // - force output of the '+' for positive numbers - bool forcePlus = (options & FORCE_PLUS); - -#ifdef DEBUG - fprintf(stderr, "Options: "); - fprintf(stderr, " %4s = %s ", "x10", (forcex10 ? "on" : "off" )); - fprintf(stderr, " %4s = %s ", ".", (forceDecimal ? "on" : "off" )); - fprintf(stderr, " %4s = %s ", "e0", (forceExpZero ? "on" : "off" )); - fprintf(stderr, " %4s = %s ", "e00", (forceHundredExpZero ? "on" : "off" )); - fprintf(stderr, " %4s = %s ", "e+", (forceExpPlus ? "on" : "off" )); - fprintf(stderr, " %4s = %s ", "e", (forceExponent ? "on" : "off" )); - fprintf(stderr, " %4s = %s \n", "+#", (forcePlus ? "on" : "off" )); -#endif - - // - exponent usage - bool useExponent = false; - - // Determine the case for the 'e' (if used) - char E = (forcex10)? 'x' : 'e'; - if (g_ascii_isupper(mode)) { - E = g_ascii_toupper(E); - mode = g_ascii_tolower(mode); - } - - // Determine how many decimals we're interested in - int L = countLhsDigits(val); - -#ifdef DEBUG - fprintf(stderr, "*** L is %s\n", itos(L).c_str()); -#endif - - int count = 0; - if (sigfig==0) // bad input - don't want any sigfigs??!! - return ""; - else if (precision>=0) { // Use fixed number of decimal places - count = precision; - if (mode == 'e') count += 1; - else if (mode == 'f') count += L; - else if (mode == 'g') count += (L>6 || L<-3)? 1 : L; - else if (mode == 'h') count += (L>0)? ((L-1)%3+1) : (L%3+3); - if (sigfig>0) count = (sigfig > count)? count : sigfig; // Use sigfig # if it means more decimal places - } - else if (sigfig>0) // Just use sigfigs - count = sigfig; - else // prec < 0 and sigfig < 0 - count = 10; -#ifdef DEBUG - fprintf(stderr, "*** count is %s\n", itos(count).c_str()); -#endif - - // Get number's string rep, sign, and exponent - int sign = 0; - int decimal=0; - -#ifdef HAS_ECVT - char *p = ecvt(val, count, &decimal, &sign); -#else - char *p = (char *) g_strdup_printf("%.0f", val); - // asprintf(&p, "%.0f", val); -#endif - -#ifdef DEBUG - fprintf(stderr, "*** string rep is %s\n", p); - fprintf(stderr, "*** decimal is %s\n", itos(decimal).c_str()); - fprintf(stderr, "*** sign is %s\n", itos(sign).c_str()); -#endif - - // Count the number of relevant digits in the resultant number - int dig = countDigs(p); - if (dig < sigfig) dig = sigfig; - -#ifdef DEBUG - fprintf(stderr, "*** digs is %s\n", itos(dig).c_str()); -#endif - - // Determine number of digits to put on left side of the decimal point - int lhs=0; - // For 'g' mode, decide whether to use 'e' or 'f' format. - if (mode=='g') mode = (decimal>6 || decimal<-3)? 'e' : 'f'; - switch (mode) { - case 'e': - lhs = 1; // only need one char on left side - useExponent = true; // force exponent use - break; - - case 'f': - lhs = (decimal<1)? 1 : decimal; - // use one char on left for num < 1, - // otherwise, use the number of decimal places. - useExponent = false; // don't want exponent for 'f' format - break; - - case 'h': - if (val==0.0) // special case for if value is zero exactly. - lhs = 0; // this prevents code from returning '000.0' - else - lhs = (decimal<=0)? (decimal)%3 + 3 : (decimal-1)%3+1; - useExponent = !(lhs==decimal); // only use exponent if we really need it - break; - - default: - return "**bad mode**"; - } - -#ifdef DEBUG - fprintf(stderr, "*** lhs is %s\n", itos(lhs).c_str()); -#endif - - // Figure out the number of digits to show in the right hand side - int rhs=0; - if (precision>=0) - rhs = precision; - else if (val == 0.0) - rhs = 0; - else if (useExponent || decimal>0) - rhs = dig-lhs; - else - rhs = dig-decimal; - - // can't use a negative rhs value, so turn it to zero if that is the case - if (rhs<0) rhs = 0; - -#ifdef DEBUG - fprintf(stderr, "*** rhs is", itos(rhs).c_str()); -#endif - - // Determine the exponent - int exponent = decimal - lhs; - if (val==0.0) exponent=0; // prevent zero from getting an exponent -#ifdef DEBUG - fprintf(stderr, "*** exponent is %s\n", itos(exponent).c_str()); -#endif - - string ascii; - - // output the sign - if (sign) ascii += "-"; - else if (forcePlus) ascii += "+"; - - // output the left hand side - if (!useExponent && decimal<=0) // if fraction, put the 0 out front - ascii += '0'; - else // is either exponential or >= 1, so write the lhs - for (; lhs>0; lhs--) - ascii += (*p)? *p++ : int('0'); // now fill in the numbers before decimal - -#ifdef DEBUG - fprintf(stderr, "*** ascii + sign + lhs is %s\n", ascii.c_str()); -#endif - - // output the decimal point - if (forceDecimal || rhs>0) - ascii += '.'; - - // output the right hand side - if (!useExponent && rhs>0) // first fill in zeros after dp and before numbers - while (decimal++ <0 && rhs-->0) - ascii += '0'; - for (; rhs>0 ; rhs--) // now fill in the numbers after decimal - ascii += (*p)? *p++ : int('0'); - -#ifdef DEBUG - fprintf(stderr, "*** ascii + . + rhs is %s\n", ascii.c_str()); -#endif - - if (forceExponent || useExponent) // output the entire exponent if required - { - ascii += E; // output the E or X - if (forcex10) ascii += "10^"; // if using 'x10^' format, output the '10^' part - - // output the exponent's sign - if (exponent < 0) { // Negative exponent - exponent = -exponent; // make exponent positive if needed - ascii += '-'; // output negative sign - } - else if (forceExpPlus) // We only want the '+' if it is asked for explicitly - ascii += '+'; - - // output the exponent - if (forceHundredExpZero || exponent >= 100) - ascii += ( (exponent/100) % 10 + '0' ); - if (forceHundredExpZero || forceExpZero || exponent >= 10) - ascii += ( (exponent/10) % 10 + '0' ); - ascii += ( exponent % 10 + '0' ); - -#ifdef DEBUG - fprintf(stderr, "*** ascii + exp is %s\n", ascii.c_str()); -#endif - } - -#ifdef DEBUG - fprintf(stderr, "*** End of ftos with ascii = ", ascii.c_str()); -#endif - /* finally, we can return */ - return ascii; -} - -#ifdef TESTFTOS - -int main() -{ - cout << "Normal (g): " << endl; - cout << "1.0 = " << ftos(1.0) << endl; - cout << "42 = " << ftos(42) << endl; - cout << "3.141 = " << ftos(3.141) << endl; - cout << "0.01 = " << ftos(0.01) << endl; - cout << "1.0e7 = " << ftos(1.0e7) << endl; - cout << endl; - - cout << "Scientific (e): " << endl; - cout << "1.0 = " << ftos(1.0, 'e') << endl; - cout << "42 = " << ftos(42, 'e') << endl; - cout << "3.141 = " << ftos(3.141, 'e') << endl; - cout << "0.01 = " << ftos(0.01, 'e') << endl; - cout << "1.0e7 = " << ftos(1.0e7, 'e') << endl; - cout << endl; - - cout << "Fixed (f): " << endl; - cout << "1.0 = " << ftos(1.0, 'f') << endl; - cout << "42 = " << ftos(42, 'f') << endl; - cout << "3.141 = " << ftos(3.141, 'f') << endl; - cout << "0.01 = " << ftos(0.01, 'f') << endl; - cout << "1.0e7 = " << ftos(1.0e7, 'f') << endl; - cout << endl; - - cout << "Engineering (h): " << endl; - cout << "1.0 = " << ftos(1.0, 'h') << endl; - cout << "42 = " << ftos(42, 'h') << endl; - cout << "3.141 = " << ftos(3.141, 'h') << endl; - cout << "0.01 = " << ftos(0.01, 'h') << endl; - cout << "1.0e7 = " << ftos(1.0e7, 'h') << endl; - cout << endl; - - cout << "Sigfigs: " << endl; - cout << "2 sf = " << ftos(1234, 'g', 2) << " " - << ftos(12.34, 'g', 2) << " " - << ftos(0, 'g', 2) << " " - << ftos(123.4e-11, 'g', 2) << endl; - cout << "4 sf = " << ftos(1234, 'g', 4) << " " - << ftos(12.34, 'g', 4) << " " - << ftos(0, 'g', 4) << " " - << ftos(123.4e-11, 'g', 4) << endl; - cout << "8 sf = " << ftos(1234, 'g', 8) << " " - << ftos(12.34, 'g', 8) << " " - << ftos(0, 'g', 8) << " " - << ftos(123.4e-11, 'g', 8) << endl; - cout << endl; - - cout << "x10 mode: " << endl; - cout << "1234 = " << ftos(1234, 'e', 4, -1, FORCE_X10 | FORCE_EXP) << endl; - cout << "1.01e10 = " << ftos(1.01e10, 'h', -1, -1, FORCE_X10 | FORCE_EXP) << endl; - cout << endl; - - cout << "itos tests..." << endl; - cout << "42 = " << itos(42) << endl; - cout << endl; - - return 0; -} - -#endif // TESTFTOS diff --git a/src/svg/ftos.h b/src/svg/ftos.h deleted file mode 100644 index 888def639..000000000 --- a/src/svg/ftos.h +++ /dev/null @@ -1,54 +0,0 @@ -///////////////////////////////////////////////////////////////////////// -// ftos.h -// -// Copyright (c) 1996 Bryce W. Harrington - bryce@neptune.net -// -//----------------------------------------------------------------------- -// License: This code may be used by anyone for any purpose -// so long as the copyright notices and this license -// statement remains attached. -//----------------------------------------------------------------------- -// Description of file contents -// 1993 - Bryce Harrington -// Created initial ftoa routine -// -// October 1996 - Bryce Harrington -// Created itos from code taken from Kernighan & Ritchie -// _The C Programming Language_ 2nd edition -// -// November 1996 - Bryce Harrington -// Created new ftoa and ftos -// -// July 1999 - Bryce Harrington -// Ported to Linux for use in WorldForge -// -// January 2000 - Karsten Laux klaux@rhrk.uni-kl.de -// added ultos - convering ulong to string -// -///////////////////////////////////////////////////////////////////////// -#ifndef ftos_h -#define ftos_h - -#include - -// ftos routine -const int FORCE_X10 = (1 << 0); -const int FORCE_DECIMAL = (1 << 1); -const int FORCE_EXP_ZERO = (1 << 2); -const int FORCE_HUNDRED_EXP_ZERO = (1 << 3); -const int FORCE_EXP_PLUS = (1 << 4); -const int FORCE_EXP = (1 << 5); -const int FORCE_PLUS = (1 << 6); - -/// -std::string ftos(double val, char mode='g', int sigfig=-1, int precision=-1, int options=0); -/// -std::string itos(int n); -/// -std::string ultos(unsigned long n); -/// -double rround(double x); // use rounding rule -> x to nearest int. -/// -double rround(double x, int k); // round to the kth place - -#endif // ftos_h -- cgit v1.2.3 From 6793d0aeee098a4141883649c044df7bdc8614ae Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Tue, 29 Sep 2009 03:07:09 +0000 Subject: Fixed leaking memory and added proper name fallback. Applies modified patch and addresses bug #436151. (bzr r8672) --- src/file.cpp | 51 ++++++++++++++++++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/file.cpp b/src/file.cpp index ef9706c33..4964d30d5 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -138,31 +138,48 @@ sp_file_new(const Glib::ustring &templ) return dt; } -SPDesktop* -sp_file_new_default() +SPDesktop* sp_file_new_default() { std::list sources; sources.push_back( profile_path("templates") ); // first try user's local dir sources.push_back( g_strdup(INKSCAPE_TEMPLATESDIR) ); // then the system templates dir - - while (!sources.empty()) { - gchar *dirname = sources.front(); - if ( Inkscape::IO::file_test( dirname, (GFileTest)(G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR) ) ) { - - // TRANSLATORS: default.svg is localizable - this is the name of the default document - // template. This way you can localize the default pagesize, translate the name of - // the default layer, etc. If you wish to localize this file, please create a - // localized share/templates/default.xx.svg file, where xx is your language code. - char *default_template = g_build_filename(dirname, _("default.svg"), NULL); - if (Inkscape::IO::file_test(default_template, G_FILE_TEST_IS_REGULAR)) { - return sp_file_new(default_template); + std::list baseNames; + gchar const* localized = _("default.svg"); + if (strcmp("default.svg", localized) != 0) { + baseNames.push_back(localized); + } + baseNames.push_back("default.svg"); + gchar *foundTemplate = 0; + + for (std::list::iterator nameIt = baseNames.begin(); (nameIt != baseNames.end()) && !foundTemplate; ++nameIt) { + for (std::list::iterator it = sources.begin(); (it != sources.end()) && !foundTemplate; ++it) { + gchar *dirname = *it; + if ( Inkscape::IO::file_test( dirname, (GFileTest)(G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR) ) ) { + + // TRANSLATORS: default.svg is localizable - this is the name of the default document + // template. This way you can localize the default pagesize, translate the name of + // the default layer, etc. If you wish to localize this file, please create a + // localized share/templates/default.xx.svg file, where xx is your language code. + char *tmp = g_build_filename(dirname, *nameIt, NULL); + if (Inkscape::IO::file_test(tmp, G_FILE_TEST_IS_REGULAR)) { + foundTemplate = tmp; + } else { + g_free(tmp); + } } } - g_free(dirname); - sources.pop_front(); } - return sp_file_new(""); + for (std::list::iterator it = sources.begin(); it != sources.end(); ++it) { + g_free(*it); + } + + SPDesktop* desk = sp_file_new(foundTemplate ? foundTemplate : ""); + if (foundTemplate) { + g_free(foundTemplate); + foundTemplate = 0; + } + return desk; } -- cgit v1.2.3 From 6bdb8b5059c6d0ebbfb03b19d99a8540b578cee8 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Tue, 29 Sep 2009 05:31:51 +0000 Subject: Avoid crashing when profile is missing. Addresses main symptom of bug #437927. (bzr r8674) --- src/color-profile.cpp | 4 ++-- src/widgets/sp-color-icc-selector.cpp | 27 ++++++++++++++++++--------- 2 files changed, 20 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/color-profile.cpp b/src/color-profile.cpp index 37ebc4f30..9b05aaa7e 100644 --- a/src/color-profile.cpp +++ b/src/color-profile.cpp @@ -487,7 +487,7 @@ cmsHPROFILE Inkscape::colorprofile_get_handle( SPDocument* document, guint* inte cmsHTRANSFORM ColorProfile::getTransfToSRGB8() { - if ( !_transf ) { + if ( !_transf && profHandle ) { int intent = getLcmsIntent(rendering_intent); _transf = cmsCreateTransform( profHandle, _getInputFormat(_profileSpace), getSRGBProfile(), TYPE_RGBA_8, intent, 0 ); } @@ -496,7 +496,7 @@ cmsHTRANSFORM ColorProfile::getTransfToSRGB8() cmsHTRANSFORM ColorProfile::getTransfFromSRGB8() { - if ( !_revTransf ) { + if ( !_revTransf && profHandle ) { int intent = getLcmsIntent(rendering_intent); _revTransf = cmsCreateTransform( getSRGBProfile(), TYPE_RGBA_8, profHandle, _getInputFormat(_profileSpace), intent, 0 ); } diff --git a/src/widgets/sp-color-icc-selector.cpp b/src/widgets/sp-color-icc-selector.cpp index 916e4363c..a10d2380c 100644 --- a/src/widgets/sp-color-icc-selector.cpp +++ b/src/widgets/sp-color-icc-selector.cpp @@ -637,14 +637,17 @@ void ColorICCSelector::_colorChanged() tmp[i] = val * 0x0ffff; } guchar post[4] = {0,0,0,0}; - cmsDoTransform( _prof->getTransfToSRGB8(), tmp, post, 1 ); - guint32 other = SP_RGBA32_U_COMPOSE(post[0], post[1], post[2], 255 ); - if ( other != _color.toRGBA32(255) ) { - _fixupNeeded = other; - gtk_widget_set_sensitive( _fixupBtn, TRUE ); + cmsHTRANSFORM trans = _prof->getTransfToSRGB8(); + if ( trans ) { + cmsDoTransform( trans, tmp, post, 1 ); + guint32 other = SP_RGBA32_U_COMPOSE(post[0], post[1], post[2], 255 ); + if ( other != _color.toRGBA32(255) ) { + _fixupNeeded = other; + gtk_widget_set_sensitive( _fixupBtn, TRUE ); #ifdef DEBUG_LCMS - g_message("Color needs to change 0x%06x to 0x%06x", _color.toRGBA32(255) >> 8, other >> 8 ); + g_message("Color needs to change 0x%06x to 0x%06x", _color.toRGBA32(255) >> 8, other >> 8 ); #endif // DEBUG_LCMS + } } } #else @@ -773,8 +776,11 @@ void ColorICCSelector::_updateSliders( gint ignore ) } } - cmsDoTransform( _prof->getTransfToSRGB8(), scratch, _fooMap[i], 1024 ); - sp_color_slider_set_map( SP_COLOR_SLIDER(_fooSlider[i]), _fooMap[i] ); + cmsHTRANSFORM trans = _prof->getTransfToSRGB8(); + if ( trans ) { + cmsDoTransform( trans, scratch, _fooMap[i], 1024 ); + sp_color_slider_set_map( SP_COLOR_SLIDER(_fooSlider[i]), _fooMap[i] ); + } } } } @@ -840,7 +846,10 @@ void ColorICCSelector::_adjustmentChanged( GtkAdjustment *adjustment, SPColorICC } guchar post[4] = {0,0,0,0}; - cmsDoTransform( iccSelector->_prof->getTransfToSRGB8(), tmp, post, 1 ); + cmsHTRANSFORM trans = iccSelector->_prof->getTransfToSRGB8(); + if ( trans ) { + cmsDoTransform( trans, tmp, post, 1 ); + } SPColor other( SP_RGBA32_U_COMPOSE(post[0], post[1], post[2], 255) ); other.icc = new SVGICCColor(); -- cgit v1.2.3 From 795748846bf4dec200ae4bf05f0b4db113df6146 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Tue, 29 Sep 2009 21:10:10 +0000 Subject: Kludge for URI resolution of combining paths. Fixes bug #437927. (bzr r8678) --- src/color-profile.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/color-profile.cpp b/src/color-profile.cpp index 9b05aaa7e..4b1307316 100644 --- a/src/color-profile.cpp +++ b/src/color-profile.cpp @@ -272,14 +272,17 @@ void ColorProfile::set( SPObject *object, unsigned key, gchar const *value ) // Normal for files that have not yet been saved. docbase = ""; } + + gchar* escaped = g_uri_escape_string(cprof->href, "!*'();:@=+$,/?#[]", TRUE); + //g_message("docbase:%s\n", docbase); org::w3c::dom::URI docUri(docbase); //# 2. Get href of icc file. we don't care if it's rel or abs - org::w3c::dom::URI hrefUri(cprof->href); + org::w3c::dom::URI hrefUri(escaped); //# 3. Resolve the href according the docBase. This follows // the w3c specs. All absolute and relative issues are considered org::w3c::dom::URI cprofUri = docUri.resolve(hrefUri); - gchar* fullname = g_strdup((gchar *)cprofUri.getNativePath().c_str()); + gchar* fullname = g_uri_unescape_string(cprofUri.getNativePath().c_str(), ""); cprof->_clearProfile(); cprof->profHandle = cmsOpenProfileFromFile( fullname, "r" ); if ( cprof->profHandle ) { @@ -289,6 +292,8 @@ void ColorProfile::set( SPObject *object, unsigned key, gchar const *value ) #ifdef DEBUG_LCMS DEBUG_MESSAGE( lcmsOne, "cmsOpenProfileFromFile( '%s'...) = %p", fullname, (void*)cprof->profHandle ); #endif // DEBUG_LCMS + g_free(escaped); + escaped = 0; g_free(fullname); #endif // ENABLE_LCMS } -- cgit v1.2.3 From 01d8a34a845e1639e833c45dabfe1e14c9f74c0b Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Wed, 30 Sep 2009 07:40:21 +0000 Subject: Create additional user subdir's. Fixes bug #437938. (bzr r8682) --- src/inkscape.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/inkscape.cpp b/src/inkscape.cpp index fc9aff78e..586abd22b 100644 --- a/src/inkscape.cpp +++ b/src/inkscape.cpp @@ -1482,6 +1482,13 @@ profile_path(const char *filename) if ( g_mkdir_with_parents(prefdir, mode) == -1 ) { int problem = errno; g_warning("Unable to create profile directory (%s) (%d)", g_strerror(problem), problem); + } else { + gchar const *userDirs[] = {"keys", "templates", "icons", "extensions", "palettes", NULL}; + for (gchar const** name = userDirs; *name; ++name) { + gchar *dir = g_build_filename(prefdir, *name, NULL); + g_mkdir_with_parents(dir, mode); + g_free(dir); + } } } } -- cgit v1.2.3 From 7b16b02bfc734675e368431eed1e7dbf2a323ef3 Mon Sep 17 00:00:00 2001 From: bulia byak Date: Fri, 2 Oct 2009 05:24:00 +0000 Subject: label edit (bzr r8690) --- src/knotholder.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/knotholder.cpp b/src/knotholder.cpp index 55a171414..5f749cfee 100644 --- a/src/knotholder.cpp +++ b/src/knotholder.cpp @@ -234,7 +234,7 @@ KnotHolder::add_pattern_knotholder() _("Move the pattern fill inside the object"), SP_KNOT_SHAPE_CROSS); entity_scale->create(desktop, item, this, - _("Scale the pattern fill uniformly"), + _("Scale the pattern fill; uniformly if with Ctrl"), SP_KNOT_SHAPE_SQUARE, SP_KNOT_MODE_XOR); entity_angle->create(desktop, item, this, _("Rotate the pattern fill; with Ctrl to snap angle"), -- cgit v1.2.3 From dc1d762c9e37b7932411fe513d5222c2928a2251 Mon Sep 17 00:00:00 2001 From: Josh Andler Date: Fri, 2 Oct 2009 21:17:41 +0000 Subject: Patch by Max to add option for better Save As behavior. (bzr r8697) --- src/extension/system.cpp | 9 +++++++++ src/ui/dialog/inkscape-preferences.cpp | 27 ++++++++++++++++----------- src/ui/dialog/inkscape-preferences.h | 15 ++++++++------- 3 files changed, 33 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/extension/system.cpp b/src/extension/system.cpp index 43e7af494..f41217959 100644 --- a/src/extension/system.cpp +++ b/src/extension/system.cpp @@ -588,6 +588,15 @@ get_file_save_path (SPDocument *doc, FileSaveMethod method) { Glib::ustring path; switch (method) { case FILE_SAVE_METHOD_SAVE_AS: + { + bool use_current_dir = prefs->getBool("/dialogs/save_as/use_current_dir"); + if (doc->uri && use_current_dir) { + path = Glib::path_get_dirname(doc->uri); + } else { + path = prefs->getString("/dialogs/save_as/path"); + } + break; + } case FILE_SAVE_METHOD_TEMPORARY: path = prefs->getString("/dialogs/save_as/path"); break; diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 3e202d619..df0209b81 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -120,7 +120,7 @@ InkscapePreferences::InkscapePreferences() initPageCMS(); initPageGrids(); initPageSVGOutput(); - initPageAutosave(); + initPageSave(); initPageImportExport(); initPageMouse(); initPageScrolling(); @@ -1109,19 +1109,24 @@ void InkscapePreferences::initPageUI() } -void InkscapePreferences::initPageAutosave() +void InkscapePreferences::initPageSave() { + _save_use_current_dir.init( _("Use current directory for \"Save As ...\""), "/dialogs/save_as/use_current_dir", true); + _page_save.add_line( false, "", _save_use_current_dir, "", + _("The \"Save As ...\" dialog uses the current working directory for saving (if the file was previously saved). If not previously saved, the most recent \"Save As ...\" directory is used."), true); + + // Autosave options - _autosave_autosave_enable.init( _("Enable autosave (requires restart)"), "/options/autosave/enable", false); - _page_autosave.add_line(false, "", _autosave_autosave_enable, "", _("Automatically save the current document(s) at a given interval, thus minimizing loss in case of a crash"), false); - _autosave_autosave_interval.init("/options/autosave/interval", 1.0, 10800.0, 1.0, 10.0, 10.0, true, false); - _page_autosave.add_line(true, _("Interval (in minutes):"), _autosave_autosave_interval, "", _("Interval (in minutes) at which document will be autosaved"), false); - _autosave_autosave_path.init("/options/autosave/path", true); + _save_autosave_enable.init( _("Enable autosave (requires restart)"), "/options/autosave/enable", false); + _page_save.add_line(false, "", _save_autosave_enable, "", _("Automatically save the current document(s) at a given interval, thus minimizing loss in case of a crash"), false); + _save_autosave_interval.init("/options/autosave/interval", 1.0, 10800.0, 1.0, 10.0, 10.0, true, false); + _page_save.add_line(true, _("Interval (in minutes):"), _save_autosave_interval, "", _("Interval (in minutes) at which document will be autosaved"), false); + _save_autosave_path.init("/options/autosave/path", true); //TRANSLATORS: only translate "string" in "context|string". // For more details, see http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html#Q-:CAPS - _page_autosave.add_line(true, Q_("filesystem|Path:"), _autosave_autosave_path, "", _("The directory where autosaves will be written"), false); - _autosave_autosave_max.init("/options/autosave/max", 1.0, 100.0, 1.0, 10.0, 10.0, true, false); - _page_autosave.add_line(true, _("Maximum number of autosaves:"), _autosave_autosave_max, "", _("Maximum number of autosaved files; use this to limit the storage space used"), false); + _page_save.add_line(true, Q_("filesystem|Path:"), _save_autosave_path, "", _("The directory where autosaves will be written"), false); + _save_autosave_max.init("/options/autosave/max", 1.0, 100.0, 1.0, 10.0, 10.0, true, false); + _page_save.add_line(true, _("Maximum number of autosaves:"), _save_autosave_max, "", _("Maximum number of autosaved files; use this to limit the storage space used"), false); /* When changing the interval or enabling/disabling the autosave function, * update our running configuration @@ -1137,7 +1142,7 @@ void InkscapePreferences::initPageAutosave() // ----------- - this->AddPage(_page_autosave, _("Autosave"), PREFS_PAGE_AUTOSAVE); + this->AddPage(_page_save, _("Save"), PREFS_PAGE_SAVE); } void InkscapePreferences::initPageBitmaps() diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h index aa0da3a37..364b0eb1d 100644 --- a/src/ui/dialog/inkscape-preferences.h +++ b/src/ui/dialog/inkscape-preferences.h @@ -69,7 +69,7 @@ enum { PREFS_PAGE_CMS, PREFS_PAGE_GRIDS, PREFS_PAGE_SVGOUTPUT, - PREFS_PAGE_AUTOSAVE, + PREFS_PAGE_SAVE, PREFS_PAGE_IMPORTEXPORT, PREFS_PAGE_MOUSE, PREFS_PAGE_SCROLLING, @@ -117,7 +117,7 @@ protected: DialogPage _page_mouse, _page_scrolling, _page_snapping, _page_steps, _page_tools, _page_windows, _page_clones, _page_mask, _page_transforms, _page_filters, _page_select, _page_importexport, _page_cms, _page_grids, _page_svgoutput, _page_misc, - _page_ui, _page_autosave, _page_bitmaps, _page_spellcheck; + _page_ui, _page_save, _page_bitmaps, _page_spellcheck; DialogPage _page_selector, _page_node, _page_tweak, _page_zoom, _page_shapes, _page_pencil, _page_pen, _page_calligraphy, _page_text, _page_gradient, _page_connector, _page_dropper, _page_lpetool; DialogPage _page_rectangle, _page_3dbox, _page_ellipse, _page_star, _page_spiral, _page_paintbucket, _page_eraser; @@ -209,10 +209,11 @@ protected: PrefCheckButton _misc_bitmap_autoreload; PrefSpinButton _bitmap_copy_res; - PrefCheckButton _autosave_autosave_enable; - PrefSpinButton _autosave_autosave_interval; - PrefEntry _autosave_autosave_path; - PrefSpinButton _autosave_autosave_max; + PrefCheckButton _save_use_current_dir; + PrefCheckButton _save_autosave_enable; + PrefSpinButton _save_autosave_interval; + PrefEntry _save_autosave_path; + PrefSpinButton _save_autosave_max; Gtk::ComboBoxText _cms_display_profile; PrefCheckButton _cms_from_display; @@ -298,7 +299,7 @@ protected: void initPageSVGOutput(); void initPageUI(); void initPageSpellcheck(); - void initPageAutosave(); + void initPageSave(); void initPageBitmaps(); void initPageMisc(); void initPageI18n(); -- cgit v1.2.3 From ca56d06adc53e8c31c2859b52e3e114fc179e61f Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Sat, 3 Oct 2009 15:21:18 +0000 Subject: fix test for relative implicit lineto (bzr r8703) --- src/svg/svg-path-geom-test.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/svg/svg-path-geom-test.h b/src/svg/svg-path-geom-test.h index 9a091cb86..1a084d5bf 100644 --- a/src/svg/svg-path-geom-test.h +++ b/src/svg/svg-path-geom-test.h @@ -159,7 +159,7 @@ public: } void testReadImplicitMoveto() { - TS_WARN("Currently lib2geom (/libnr) has no way of specifying the difference between '... z M 0,0 L 1,0' and '... z L 1,0', the SVG specification does state that these should be handled differently with respect to markers however, see the description of the 'orient' attribute of the 'marker' element."); + TS_WARN("Currently lib2geom (/libnr) has no way of specifying the difference between 'M 0,0 ... z M 0,0 L 1,0' and 'M 0,0 ... z L 1,0', the SVG specification does state that these should be handled differently with respect to markers however, see the description of the 'orient' attribute of the 'marker' element."); Geom::PathVector pv_good; pv_good.push_back(Geom::Path(Geom::Point(1,1))); pv_good.back().append(Geom::LineSegment(Geom::Point(1,1),Geom::Point(2,2))); @@ -173,7 +173,7 @@ public: TSM_ASSERT(path_str, bpathEqual(pv,pv_good)); } { // Test relative version - char const * path_str = "M 1,1 L 2,2 z L 3,3 z"; + char const * path_str = "M 1,1 l 1,1 z l 2,2 z"; Geom::PathVector pv = sp_svg_read_pathv(path_str); TSM_ASSERT(path_str, bpathEqual(pv,pv_good)); } -- cgit v1.2.3 From 3fd31c30af0986d1682bcd14632c6711dce0dae2 Mon Sep 17 00:00:00 2001 From: Josh Andler Date: Sat, 3 Oct 2009 20:52:44 +0000 Subject: Patch by Max for 264709. (bzr r8706) --- src/widgets/desktop-widget.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index 0bf09410d..5fd32487f 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -1283,11 +1283,19 @@ SPDesktopWidget::setToolboxFocusTo (const gchar* label) void SPDesktopWidget::setToolboxAdjustmentValue (gchar const *id, double value) { + GtkAdjustment *a = NULL; gpointer hb = sp_search_by_data_recursive (aux_toolbox, (gpointer) id); - if (hb && GTK_IS_WIDGET(hb) && GTK_IS_SPIN_BUTTON(hb)) { - GtkAdjustment *a = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON(hb)); - gtk_adjustment_set_value (a, value); + if (hb && GTK_IS_WIDGET(hb)) { + if (GTK_IS_SPIN_BUTTON(hb)) + a = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON(hb)); + else if (GTK_IS_RANGE(hb)) + a = gtk_range_get_adjustment (GTK_RANGE(hb)); } + + if (a) + gtk_adjustment_set_value (a, value); + else + g_warning ("Could not find GtkAdjustment for %s\n", id); } void -- cgit v1.2.3 From d47a997243e24bffea393380160cd8120dbae403 Mon Sep 17 00:00:00 2001 From: Josh Andler Date: Sat, 3 Oct 2009 21:05:18 +0000 Subject: Patch by Johan to fix reading of rare svg strings. (bzr r8707) --- src/2geom/svg-path.h | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/2geom/svg-path.h b/src/2geom/svg-path.h index f2902750c..f1fd67867 100644 --- a/src/2geom/svg-path.h +++ b/src/2geom/svg-path.h @@ -64,33 +64,58 @@ public: void moveTo(Point p) { finish(); _path.start(p); + _start_p = p; _in_path = true; } //TODO: what if _in_path = false? void hlineTo(Coord v) { - _path.template appendNew(Point(v, _path.finalPoint()[Y])); + // check for implicit moveto, like in: "M 1,1 L 2,2 z l 2,2 z" + if (!_in_path) { + moveTo(_start_p); + } + _path.template appendNew(Point(v, _path.finalPoint()[Y])); } void vlineTo(Coord v) { - _path.template appendNew(Point(_path.finalPoint()[X], v)); + // check for implicit moveto, like in: "M 1,1 L 2,2 z l 2,2 z" + if (!_in_path) { + moveTo(_start_p); + } + _path.template appendNew(Point(_path.finalPoint()[X], v)); } void lineTo(Point p) { + // check for implicit moveto, like in: "M 1,1 L 2,2 z l 2,2 z" + if (!_in_path) { + moveTo(_start_p); + } _path.template appendNew(p); } void quadTo(Point c, Point p) { + // check for implicit moveto, like in: "M 1,1 L 2,2 z l 2,2 z" + if (!_in_path) { + moveTo(_start_p); + } _path.template appendNew(c, p); } void curveTo(Point c0, Point c1, Point p) { + // check for implicit moveto, like in: "M 1,1 L 2,2 z l 2,2 z" + if (!_in_path) { + moveTo(_start_p); + } _path.template appendNew(c0, c1, p); } void arcTo(double rx, double ry, double angle, bool large_arc, bool sweep, Point p) { + // check for implicit moveto, like in: "M 1,1 L 2,2 z l 2,2 z" + if (!_in_path) { + moveTo(_start_p); + } _path.template appendNew(rx, ry, angle, large_arc, sweep, p); } @@ -113,6 +138,7 @@ protected: bool _in_path; OutputIterator _out; Path _path; + Point _start_p; }; typedef std::back_insert_iterator > iter; -- cgit v1.2.3 From 6339ecbc3f9c1a8925a9bfe1fef9fef2da9f474d Mon Sep 17 00:00:00 2001 From: bulia byak Date: Sun, 4 Oct 2009 15:20:53 +0000 Subject: Diederik's patch for crash bug 441255 (bzr r8709) --- src/seltrans.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/seltrans.cpp b/src/seltrans.cpp index 1087ec7b5..708ee4b09 100644 --- a/src/seltrans.cpp +++ b/src/seltrans.cpp @@ -408,8 +408,9 @@ void Inkscape::SelTrans::grab(Geom::Point const &p, gdouble x, gdouble y, bool s // Optionally, show the snap source if (!(_state == STATE_ROTATE && x != 0.5 && y != 0.5)) { // but not when we're dragging a rotation handle, because that won't snap // Now either _bbox_points or _snap_points has a single element, the other one has zero..... or both have zero elements - g_assert((_snap_points.size() + _bbox_points.size() + _bbox_points_for_translating.size()) == 1); - if (m.snapprefs.getSnapEnabledGlobally()) { + if ((_snap_points.size() + _bbox_points.size() + _bbox_points_for_translating.size()) > 1) { + g_warning("too many snap sources to display, please fix this"); + } else if (m.snapprefs.getSnapEnabledGlobally()) { if (_bbox_points.size() == 1) { _desktop->snapindicator->set_new_snapsource(_bbox_points.at(0)); } else if (_bbox_points_for_translating.size() == 1) { -- cgit v1.2.3 From d09d31b56cd9691fb1674551db4b7555b2fafc66 Mon Sep 17 00:00:00 2001 From: bulia byak Date: Sun, 4 Oct 2009 15:42:39 +0000 Subject: Richard's patch for crash bug 402274 (bzr r8710) --- src/text-editing.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/text-editing.cpp b/src/text-editing.cpp index 5b9db13d4..2bdee4c10 100644 --- a/src/text-editing.cpp +++ b/src/text-editing.cpp @@ -1547,8 +1547,9 @@ static bool redundant_double_nesting_processor(SPObject **item, SPObject *child, if (!objects_have_equal_style(SP_OBJECT_PARENT(*item), child)) return false; Inkscape::XML::Node *insert_after_repr; - if (prepend) insert_after_repr = SP_OBJECT_REPR(SP_OBJECT_PREV(*item)); - else insert_after_repr = SP_OBJECT_REPR(*item); + if (!prepend) insert_after_repr = SP_OBJECT_REPR(*item); + else if (SP_OBJECT_PREV(*item)) insert_after_repr = SP_OBJECT_REPR(SP_OBJECT_PREV(*item)); + else insert_after_repr = NULL; while (SP_OBJECT_REPR(child)->childCount()) { Inkscape::XML::Node *move_repr = SP_OBJECT_REPR(child)->firstChild(); Inkscape::GC::anchor(move_repr); -- cgit v1.2.3 From 21a19e5080721837da55fc4b50acf09c7ee0e9aa Mon Sep 17 00:00:00 2001 From: bulia byak Date: Sun, 4 Oct 2009 16:13:49 +0000 Subject: typo in comment (bzr r8711) --- src/display/sp-canvas.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/display/sp-canvas.cpp b/src/display/sp-canvas.cpp index e0d885d36..aee53838f 100644 --- a/src/display/sp-canvas.cpp +++ b/src/display/sp-canvas.cpp @@ -1492,7 +1492,7 @@ sp_canvas_button (GtkWidget *widget, GdkEventButton *event) int retval = FALSE; - /* dispatch normally regardless of the event's window if an item has + /* dispatch normally regardless of the event's window if an item has a pointer grab in effect */ if (!canvas->grabbed_item && event->window != SP_CANVAS_WINDOW (canvas)) -- cgit v1.2.3 From 35c98c03dcab20a475276eecaed00b1b1caf9533 Mon Sep 17 00:00:00 2001 From: Josh Andler Date: Sun, 4 Oct 2009 20:05:20 +0000 Subject: Patch to fix 205667 by Petteri Aimonen (bzr r8712) --- src/document.cpp | 18 +++++++++++++----- src/document.h | 1 + 2 files changed, 14 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/document.cpp b/src/document.cpp index 8503c7841..d406f3712 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -224,6 +224,14 @@ void SPDocument::remove_persp3d (Persp3D * const /*persp*/) g_print ("Please implement deletion of perspectives here.\n"); } +void SPDocument::initialize_current_persp3d() +{ + this->current_persp3d = persp3d_document_first_persp(this); + if (!this->current_persp3d) { + this->current_persp3d = persp3d_create_xml_element(this); + } +} + unsigned long SPDocument::serial() const { return priv->serial; } @@ -373,11 +381,7 @@ sp_document_create(Inkscape::XML::Document *rdoc, // Remark: Here, we used to create a "currentpersp3d" element in the document defs. // But this is probably a bad idea since we need to adapt it for every change of selection, which will // completely clutter the undo history. Maybe rather save it to prefs on exit and re-read it on startup? - - document->current_persp3d = persp3d_document_first_persp(document); - if (!document->current_persp3d) { - document->current_persp3d = persp3d_create_xml_element (document); - } + document->initialize_current_persp3d(); sp_document_set_undo_sensitive(document, true); @@ -730,6 +734,10 @@ SPDocument::emitReconstructionFinish(void) { // printf("Finishing Reconstruction\n"); priv->_reconstruction_finish_signal.emit(); + + // Reference to the old persp3d object is invalid after reconstruction. + initialize_current_persp3d(); + return; } diff --git a/src/document.h b/src/document.h index 696e568ad..789e3e2ed 100644 --- a/src/document.h +++ b/src/document.h @@ -114,6 +114,7 @@ struct SPDocument : public Inkscape::GC::Managed<>, void add_persp3d(Persp3D * const persp); void remove_persp3d(Persp3D * const persp); + void initialize_current_persp3d(); sigc::connection connectModified(ModifiedSignal::slot_type slot); sigc::connection connectURISet(URISetSignal::slot_type slot); -- cgit v1.2.3 From cac562481b8ba45f87f46d163c244dbb849f781e Mon Sep 17 00:00:00 2001 From: Josh Andler Date: Sun, 4 Oct 2009 21:03:42 +0000 Subject: Patch by Adib to fix 273767 (bzr r8713) --- src/helper/pixbuf-ops.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/helper/pixbuf-ops.cpp b/src/helper/pixbuf-ops.cpp index f41342e42..1e43df5f3 100644 --- a/src/helper/pixbuf-ops.cpp +++ b/src/helper/pixbuf-ops.cpp @@ -98,7 +98,6 @@ sp_generate_internal_bitmap(SPDocument *doc, gchar const */*filename*/, { - GdkPixbuf* pixbuf = NULL; /* Create new arena for offscreen rendering*/ NRArena *arena = NRArena::create(); @@ -141,7 +140,12 @@ sp_generate_internal_bitmap(SPDocument *doc, gchar const */*filename*/, nr_arena_item_invoke_update(root, &final_bbox, &gc, NR_ARENA_ITEM_STATE_ALL, NR_ARENA_ITEM_STATE_NONE); - guchar *px = g_try_new(guchar, 4L * width * height); + guchar *px = NULL; + guint64 size = 4L * (guint64)width * (guint64)height; + if(size < (guint64)G_MAXSIZE) { + // g_try_new is limited to g_size type which is defined as unisgned int. Need to test for very large nubers + px = g_try_new(guchar, size); + } if(px != NULL) { @@ -158,15 +162,15 @@ sp_generate_internal_bitmap(SPDocument *doc, gchar const */*filename*/, dtc[2] = NR_RGBA32_B(bgcolor); dtc[3] = NR_RGBA32_A(bgcolor); - for (unsigned int fy = 0; fy < height; fy++) { - guchar *p = NR_PIXBLOCK_PX(&B) + fy * B.rs; + for (gsize fy = 0; fy < height; fy++) { + guchar *p = NR_PIXBLOCK_PX(&B) + fy * (gsize)B.rs; for (unsigned int fx = 0; fx < width; fx++) { for (int i = 0; i < 4; i++) { *p++ = dtc[i]; } } } - + nr_arena_item_invoke_render(NULL, root, &final_bbox, &B, NR_ARENA_ITEM_RENDER_NO_CACHE ); @@ -178,7 +182,7 @@ sp_generate_internal_bitmap(SPDocument *doc, gchar const */*filename*/, } else { - g_warning("sp_generate_internal_bitmap: not enough memory to create pixel buffer. Need %ld.", 4L * width * height); + g_warning("sp_generate_internal_bitmap: not enough memory to create pixel buffer. Need %lld.", size); } sp_item_invoke_hide (SP_ITEM(sp_document_root(doc)), dkey); nr_object_unref((NRObject *) arena); -- cgit v1.2.3 From 9e7ff0929c1d9b443023fa2525a3fc09e1a3b3cc Mon Sep 17 00:00:00 2001 From: bulia byak Date: Mon, 5 Oct 2009 04:44:56 +0000 Subject: fix shift+middle button zoom area when there are other modifiers in the mask; safe typo fix, everywhere else it's checked this way (bzr r8715) --- src/event-context.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/event-context.cpp b/src/event-context.cpp index 958e8cb2b..9b846f2b7 100644 --- a/src/event-context.cpp +++ b/src/event-context.cpp @@ -384,7 +384,7 @@ static gint sp_event_context_private_root_handler(SPEventContext *event_context, } break; case 2: - if (event->button.state == GDK_SHIFT_MASK) { + if (event->button.state & GDK_SHIFT_MASK) { zoom_rb = 2; } else { // When starting panning, make sure there are no snap events pending because these might disable the panning again -- cgit v1.2.3 From 2c936cac227be351907a49a8641daba74f1c6fe5 Mon Sep 17 00:00:00 2001 From: Josh Andler Date: Mon, 5 Oct 2009 19:44:19 +0000 Subject: Updated tooltip for clarity per Krzysztof. (bzr r8720) --- src/ui/dialog/inkscape-preferences.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index df0209b81..79d6a0702 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -1113,7 +1113,7 @@ void InkscapePreferences::initPageSave() { _save_use_current_dir.init( _("Use current directory for \"Save As ...\""), "/dialogs/save_as/use_current_dir", true); _page_save.add_line( false, "", _save_use_current_dir, "", - _("The \"Save As ...\" dialog uses the current working directory for saving (if the file was previously saved). If not previously saved, the most recent \"Save As ...\" directory is used."), true); + _("When this option is on, the \"Save as...\" dialog will always open in the directory where the currently open document is. When it's off, it will open in the directory where you last saved a file using that dialog."), true); // Autosave options -- cgit v1.2.3 From d532f515d744ab0dbb1fec8f0fbf0ec588148237 Mon Sep 17 00:00:00 2001 From: Josh Andler Date: Mon, 5 Oct 2009 20:38:16 +0000 Subject: Fix for 419577 by Johan (bzr r8722) --- src/sp-lpe-item.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/sp-lpe-item.cpp b/src/sp-lpe-item.cpp index e4d278e34..49264c684 100644 --- a/src/sp-lpe-item.cpp +++ b/src/sp-lpe-item.cpp @@ -543,7 +543,11 @@ void sp_lpe_item_remove_current_path_effect(SPLPEItem *lpeitem, bool keep_paths) new_list.remove(lperef); //current lpe ref is always our 'own' pointer from the path_effect_list std::string r = patheffectlist_write_svg(new_list); - SP_OBJECT_REPR(lpeitem)->setAttribute("inkscape:path-effect", r.c_str()); + if (!r.empty()) { + SP_OBJECT_REPR(lpeitem)->setAttribute("inkscape:path-effect", r.c_str()); + } else { + SP_OBJECT_REPR(lpeitem)->setAttribute("inkscape:path-effect", NULL); + } if (!keep_paths) { sp_lpe_item_cleanup_original_path_recursive(lpeitem); -- cgit v1.2.3 From 4f6b04e92c3ed3aa02908967f76bd14bb02926d2 Mon Sep 17 00:00:00 2001 From: Josh Andler Date: Mon, 5 Oct 2009 20:47:05 +0000 Subject: Patch by Johan to fix crashing by undefined path parameters in 4 LPEs (bzr r8723) --- src/live_effects/lpe-envelope.cpp | 9 +++++++++ src/live_effects/lpe-interpolate.cpp | 7 ++++++- src/live_effects/lpe-mirror_symmetry.cpp | 5 +++++ src/live_effects/lpe-patternalongpath.cpp | 7 ++++++- 4 files changed, 26 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/live_effects/lpe-envelope.cpp b/src/live_effects/lpe-envelope.cpp index a730f14ff..abd975b4e 100755 --- a/src/live_effects/lpe-envelope.cpp +++ b/src/live_effects/lpe-envelope.cpp @@ -69,6 +69,15 @@ LPEEnvelope::doEffect_pwd2 (Geom::Piecewise > const & pwd using namespace Geom; + // Don't allow empty path parameters: + if ( bend_path1.get_pathvector().empty() + || bend_path2.get_pathvector().empty() + || bend_path3.get_pathvector().empty() + || bend_path4.get_pathvector().empty() ) + { + return pwd2_in; + } + /* The code below is inspired from the Bend Path code developed by jfb and mgsloan Please, read it before tring to understand this one diff --git a/src/live_effects/lpe-interpolate.cpp b/src/live_effects/lpe-interpolate.cpp index e19d2e6e7..e77a392e9 100644 --- a/src/live_effects/lpe-interpolate.cpp +++ b/src/live_effects/lpe-interpolate.cpp @@ -52,8 +52,13 @@ LPEInterpolate::~LPEInterpolate() Geom::PathVector LPEInterpolate::doEffect_path (Geom::PathVector const & path_in) { - if ( (path_in.size() < 2) || (number_of_steps < 2)) + if ( (path_in.size() < 2) || (number_of_steps < 2)) { return path_in; + } + // Don't allow empty path parameter: + if ( trajectory_path.get_pathvector().empty() ) { + return path_in; + } std::vector path_out; diff --git a/src/live_effects/lpe-mirror_symmetry.cpp b/src/live_effects/lpe-mirror_symmetry.cpp index cd724b70e..a3a0faf37 100644 --- a/src/live_effects/lpe-mirror_symmetry.cpp +++ b/src/live_effects/lpe-mirror_symmetry.cpp @@ -60,6 +60,11 @@ LPEMirrorSymmetry::doOnApply (SPLPEItem *lpeitem) std::vector LPEMirrorSymmetry::doEffect_path (std::vector const & path_in) { + // Don't allow empty path parameter: + if ( reflection_line.get_pathvector().empty() ) { + return path_in; + } + std::vector path_out; if (!discard_orig_path) { path_out = path_in; diff --git a/src/live_effects/lpe-patternalongpath.cpp b/src/live_effects/lpe-patternalongpath.cpp index 29c5517bf..45b2b67b4 100644 --- a/src/live_effects/lpe-patternalongpath.cpp +++ b/src/live_effects/lpe-patternalongpath.cpp @@ -33,7 +33,7 @@ B is a map t --> B(t) = ( a(t), b(t) ). The first step is to re-parametrize B by its arc length: this is the parametrization in which a point p on B is located by its distance s from start. One obtains a new map s --> U(s) = (a'(s),b'(s)), that still describes the same path B, but where the distance along B from start to U(s) is s itself. -We also need a unit normal to the path. This can be obtained by computing a unit tangent vector, and rotate it by 90°. Call this normal vector N(s). +We also need a unit normal to the path. This can be obtained by computing a unit tangent vector, and rotate it by 90�. Call this normal vector N(s). The basic deformation associated to B is then given by: @@ -104,6 +104,11 @@ LPEPatternAlongPath::doEffect_pwd2 (Geom::Piecewise > con { using namespace Geom; + // Don't allow empty path parameter: + if ( pattern.get_pathvector().empty() ) { + return pwd2_in; + } + /* Much credit should go to jfb and mgsloan of lib2geom development for the code below! */ Piecewise > output; std::vector > > pre_output; -- cgit v1.2.3 From b891975a296e89d5b072ec4d66978122b584dc55 Mon Sep 17 00:00:00 2001 From: Josh Andler Date: Wed, 7 Oct 2009 01:42:19 +0000 Subject: Patch by Diederik to mitigate crash on 318726. (bzr r8735) --- src/seltrans.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/seltrans.cpp b/src/seltrans.cpp index 708ee4b09..8ff00d60a 100644 --- a/src/seltrans.cpp +++ b/src/seltrans.cpp @@ -1630,10 +1630,17 @@ Geom::Point Inkscape::SelTrans::_calcAbsAffineGeom(Geom::Scale const geom_scale) Inkscape::Preferences *prefs = Inkscape::Preferences::get(); bool const transform_stroke = prefs->getBool("/options/transform/stroke", true); - Geom::Rect visual_bbox = get_visual_bbox(_geometric_bbox, _absolute_affine, _strokewidth, transform_stroke); + if (_geometric_bbox) { + Geom::Rect visual_bbox = get_visual_bbox(_geometric_bbox, _absolute_affine, _strokewidth, transform_stroke); + // return the new handle position + return visual_bbox.min() + visual_bbox.dimensions() * Geom::Scale(_handle_x, _handle_y); + } - // return the new handle position - return visual_bbox.min() + visual_bbox.dimensions() * Geom::Scale(_handle_x, _handle_y); + // Fall back scenario, in case we don't have a geometric bounding box at hand; + // (Due to some bugs related to bounding boxes having at least one zero dimension; For more details + // see https://bugs.launchpad.net/inkscape/+bug/318726) + g_warning("No geometric bounding box has been calculated; this is a bug that needs fixing!"); + return _calcAbsAffineDefault(geom_scale); // this is bogus, but we must return _something_ } void Inkscape::SelTrans::_keepClosestPointOnly(std::vector > &points, const Geom::Point &reference) -- cgit v1.2.3 From 4d9b6c156619318ead3205d97a838f310a1f748b Mon Sep 17 00:00:00 2001 From: Josh Andler Date: Wed, 7 Oct 2009 21:09:58 +0000 Subject: Patch by Johan to fix 391368 (bzr r8739) --- src/sp-item-group.cpp | 26 ++++++++++++++++---------- src/sp-path.cpp | 8 ++++---- 2 files changed, 20 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp index 9c19ce75a..54f62e093 100644 --- a/src/sp-item-group.cpp +++ b/src/sp-item-group.cpp @@ -72,7 +72,7 @@ static void sp_group_hide (SPItem * item, unsigned int key); static void sp_group_snappoints (SPItem const *item, bool const target, SnapPointsWithType &p, Inkscape::SnapPreferences const *snapprefs); static void sp_group_update_patheffect(SPLPEItem *lpeitem, bool write); -static void sp_group_perform_patheffect(SPGroup *group, SPGroup *topgroup); +static void sp_group_perform_patheffect(SPGroup *group, SPGroup *topgroup, bool write); static SPLPEItemClass * parent_class; @@ -856,30 +856,36 @@ sp_group_update_patheffect (SPLPEItem *lpeitem, bool write) } } - sp_group_perform_patheffect(SP_GROUP(lpeitem), SP_GROUP(lpeitem)); + sp_group_perform_patheffect(SP_GROUP(lpeitem), SP_GROUP(lpeitem), write); } } static void -sp_group_perform_patheffect(SPGroup *group, SPGroup *topgroup) +sp_group_perform_patheffect(SPGroup *group, SPGroup *topgroup, bool write) { GSList const *item_list = sp_item_group_item_list(SP_GROUP(group)); for ( GSList const *iter = item_list; iter; iter = iter->next ) { SPObject *subitem = static_cast(iter->data); if (SP_IS_GROUP(subitem)) { - sp_group_perform_patheffect(SP_GROUP(subitem), topgroup); + sp_group_perform_patheffect(SP_GROUP(subitem), topgroup, write); } else if (SP_IS_SHAPE(subitem)) { - SPCurve * c = sp_shape_get_curve(SP_SHAPE(subitem)); + SPCurve * c = NULL; + if (SP_IS_PATH(subitem)) { + c = sp_path_get_curve_for_edit(SP_PATH(subitem)); + } else { + c = sp_shape_get_curve(SP_SHAPE(subitem)); + } // only run LPEs when the shape has a curve defined if (c) { sp_lpe_item_perform_path_effect(SP_LPE_ITEM(topgroup), c); sp_shape_set_curve(SP_SHAPE(subitem), c, TRUE); - Inkscape::XML::Node *repr = SP_OBJECT_REPR(subitem); - - gchar *str = sp_svg_write_path(c->get_pathvector()); - repr->setAttribute("d", str); - g_free(str); + if (write) { + Inkscape::XML::Node *repr = SP_OBJECT_REPR(subitem); + gchar *str = sp_svg_write_path(c->get_pathvector()); + repr->setAttribute("d", str); + g_free(str); + } c->unref(); } diff --git a/src/sp-path.cpp b/src/sp-path.cpp index a2f0f3169..a863c12b4 100644 --- a/src/sp-path.cpp +++ b/src/sp-path.cpp @@ -379,7 +379,7 @@ sp_path_set_transform(SPItem *item, Geom::Matrix const &xform) // Transform the original-d path if this is a valid LPE item, other else the (ordinary) path if (path->original_curve && SP_IS_LPE_ITEM(item) && - sp_lpe_item_has_path_effect(SP_LPE_ITEM(item))) { + sp_lpe_item_has_path_effect_recursive(SP_LPE_ITEM(item))) { path->original_curve->transform(xform); } else { shape->curve->transform(xform); @@ -427,7 +427,7 @@ sp_path_update_patheffect(SPLPEItem *lpeitem, bool write) } else { repr->setAttribute("d", NULL); } - } else { + } else if (!success) { // LPE was unsuccesfull. Read the old 'd'-attribute. if (gchar const * value = repr->attribute("d")) { Geom::PathVector pv = sp_svg_read_pathv(value); @@ -489,7 +489,7 @@ SPCurve* sp_path_get_curve_for_edit (SPPath *path) { if (path->original_curve && SP_IS_LPE_ITEM(path) && - sp_lpe_item_has_path_effect(SP_LPE_ITEM(path))) { + sp_lpe_item_has_path_effect_recursive(SP_LPE_ITEM(path))) { return sp_path_get_original_curve(path); } else { return sp_shape_get_curve( (SPShape *) path ); @@ -504,7 +504,7 @@ const SPCurve* sp_path_get_curve_reference (SPPath *path) { if (path->original_curve && SP_IS_LPE_ITEM(path) && - sp_lpe_item_has_path_effect(SP_LPE_ITEM(path))) { + sp_lpe_item_has_path_effect_recursive(SP_LPE_ITEM(path))) { return path->original_curve; } else { return path->curve; -- cgit v1.2.3 From 4cb87fc2c565a1f6481d541d1623b7bd19bc9983 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Thu, 8 Oct 2009 03:58:02 +0000 Subject: Fix variable name legibility. (bzr r8740) --- src/svg/svg-length-test.h | 76 +++++++++++++++++++++++------------------------ 1 file changed, 38 insertions(+), 38 deletions(-) (limited to 'src') diff --git a/src/svg/svg-length-test.h b/src/svg/svg-length-test.h index ce709b51d..3ac01467a 100644 --- a/src/svg/svg-length-test.h +++ b/src/svg/svg-length-test.h @@ -28,68 +28,68 @@ public: void testRead() { for(size_t i=0; i Date: Thu, 8 Oct 2009 08:44:05 +0000 Subject: Fixed signed/unsigned problem with precision calc. Fixes bug #399604. (bzr r8742) --- src/svg/path-string.cpp | 2 +- src/svg/svg-affine.cpp | 32 ++++++++++++++++---------------- src/svg/svg-length.cpp | 36 ++++++++++++++++++------------------ src/svg/svg.h | 28 ++++++++++++++-------------- 4 files changed, 49 insertions(+), 49 deletions(-) (limited to 'src') diff --git a/src/svg/path-string.cpp b/src/svg/path-string.cpp index 0baaf521e..a850d7c10 100644 --- a/src/svg/path-string.cpp +++ b/src/svg/path-string.cpp @@ -129,7 +129,7 @@ void Inkscape::SVG::PathString::State::appendNumber(double v, int precision, int size_t const oldsize = str.size(); str.append(reserve, (char)0); char* begin_of_num = const_cast(str.data()+oldsize); // Slightly evil, I know (but std::string should be storing its data in one big block of memory, so...) - size_t added = sp_svg_number_write_de(begin_of_num, v, precision, minexp); + size_t added = sp_svg_number_write_de(begin_of_num, reserve, v, precision, minexp); str.resize(oldsize+added); // remove any trailing characters } diff --git a/src/svg/svg-affine.cpp b/src/svg/svg-affine.cpp index 1ff9776e5..91a9fa7e5 100644 --- a/src/svg/svg-affine.cpp +++ b/src/svg/svg-affine.cpp @@ -177,9 +177,9 @@ sp_svg_transform_write(Geom::Matrix const &transform) unsigned p = 0; strcpy (c + p, "scale("); p += 6; - p += sp_svg_number_write_de (c + p, transform[0], prec, min_exp); + p += sp_svg_number_write_de( c + p, sizeof(c) - p, transform[0], prec, min_exp ); c[p++] = ','; - p += sp_svg_number_write_de (c + p, transform[3], prec, min_exp); + p += sp_svg_number_write_de( c + p, sizeof(c) - p, transform[3], prec, min_exp ); c[p++] = ')'; c[p] = '\000'; g_assert( p <= sizeof(c) ); @@ -192,9 +192,9 @@ sp_svg_transform_write(Geom::Matrix const &transform) unsigned p = 0; strcpy (c + p, "translate("); p += 10; - p += sp_svg_number_write_de (c + p, transform[4], prec, min_exp); + p += sp_svg_number_write_de( c + p, sizeof(c) - p, transform[4], prec, min_exp ); c[p++] = ','; - p += sp_svg_number_write_de (c + p, transform[5], prec, min_exp); + p += sp_svg_number_write_de( c + p, sizeof(c) - p, transform[5], prec, min_exp ); c[p++] = ')'; c[p] = '\000'; g_assert( p <= sizeof(c) ); @@ -204,17 +204,17 @@ sp_svg_transform_write(Geom::Matrix const &transform) unsigned p = 0; strcpy (c + p, "matrix("); p += 7; - p += sp_svg_number_write_de (c + p, transform[0], prec, min_exp); + p += sp_svg_number_write_de( c + p, sizeof(c) - p, transform[0], prec, min_exp ); c[p++] = ','; - p += sp_svg_number_write_de (c + p, transform[1], prec, min_exp); + p += sp_svg_number_write_de( c + p, sizeof(c) - p, transform[1], prec, min_exp ); c[p++] = ','; - p += sp_svg_number_write_de (c + p, transform[2], prec, min_exp); + p += sp_svg_number_write_de( c + p, sizeof(c) - p, transform[2], prec, min_exp ); c[p++] = ','; - p += sp_svg_number_write_de (c + p, transform[3], prec, min_exp); + p += sp_svg_number_write_de( c + p, sizeof(c) - p, transform[3], prec, min_exp ); c[p++] = ','; - p += sp_svg_number_write_de (c + p, transform[4], prec, min_exp); + p += sp_svg_number_write_de( c + p, sizeof(c) - p, transform[4], prec, min_exp ); c[p++] = ','; - p += sp_svg_number_write_de (c + p, transform[5], prec, min_exp); + p += sp_svg_number_write_de( c + p, sizeof(c) - p, transform[5], prec, min_exp ); c[p++] = ')'; c[p] = '\000'; g_assert( p <= sizeof(c) ); @@ -226,17 +226,17 @@ sp_svg_transform_write(Geom::Matrix const &transform) unsigned p = 0; strcpy (c + p, "matrix("); p += 7; - p += sp_svg_number_write_de (c + p, transform[0], prec, min_exp); + p += sp_svg_number_write_de( c + p, sizeof(c) - p, transform[0], prec, min_exp ); c[p++] = ','; - p += sp_svg_number_write_de (c + p, transform[1], prec, min_exp); + p += sp_svg_number_write_de( c + p, sizeof(c) - p, transform[1], prec, min_exp ); c[p++] = ','; - p += sp_svg_number_write_de (c + p, transform[2], prec, min_exp); + p += sp_svg_number_write_de( c + p, sizeof(c) - p, transform[2], prec, min_exp ); c[p++] = ','; - p += sp_svg_number_write_de (c + p, transform[3], prec, min_exp); + p += sp_svg_number_write_de( c + p, sizeof(c) - p, transform[3], prec, min_exp ); c[p++] = ','; - p += sp_svg_number_write_de (c + p, transform[4], prec, min_exp); + p += sp_svg_number_write_de( c + p, sizeof(c) - p, transform[4], prec, min_exp ); c[p++] = ','; - p += sp_svg_number_write_de (c + p, transform[5], prec, min_exp); + p += sp_svg_number_write_de( c + p, sizeof(c) - p, transform[5], prec, min_exp ); c[p++] = ')'; c[p] = '\000'; g_assert( p <= sizeof(c) ); diff --git a/src/svg/svg-length.cpp b/src/svg/svg-length.cpp index 1d41f9871..942f74d46 100644 --- a/src/svg/svg-length.cpp +++ b/src/svg/svg-length.cpp @@ -43,7 +43,7 @@ unsigned int sp_svg_number_read_f(gchar const *str, float *val) if ((gchar const *) e == str) { return 0; } - + *val = v; return 1; } @@ -59,7 +59,7 @@ unsigned int sp_svg_number_read_d(gchar const *str, double *val) if ((gchar const *) e == str) { return 0; } - + *val = v; return 1; } @@ -72,14 +72,14 @@ static unsigned int sp_svg_number_write_ui(gchar *buf, unsigned int val) c[16u - (++i)] = '0' + (val % 10u); val /= 10u; } while (val > 0u); - + memcpy(buf, &c[16u - i], i); buf[i] = 0; - + return i; } -static unsigned int sp_svg_number_write_i(gchar *buf, int val) +static unsigned int sp_svg_number_write_i(gchar *buf, int bufLen, int val) { int p = 0; unsigned int uval; @@ -91,11 +91,11 @@ static unsigned int sp_svg_number_write_i(gchar *buf, int val) } p += sp_svg_number_write_ui(buf+p, uval); - + return p; } -static unsigned sp_svg_number_write_d(gchar *buf, double val, unsigned int tprec, unsigned int fprec) +static unsigned sp_svg_number_write_d(gchar *buf, int bufLen, double val, unsigned int tprec, unsigned int fprec) { /* Process sign */ int i = 0; @@ -103,15 +103,15 @@ static unsigned sp_svg_number_write_d(gchar *buf, double val, unsigned int tprec buf[i++] = '-'; val = fabs(val); } - + /* Determine number of integral digits */ int idigits = 0; if (val >= 1.0) { idigits = (int) floor(log10(val)) + 1; } - + /* Determine the actual number of fractional digits */ - fprec = MAX(fprec, tprec - idigits); + fprec = MAX(static_cast(fprec), static_cast(tprec) - idigits); /* Round value */ val += 0.5 / pow(10.0, fprec); /* Extract integral and fractional parts */ @@ -146,7 +146,7 @@ static unsigned sp_svg_number_write_d(gchar *buf, double val, unsigned int tprec return end_i; } -unsigned int sp_svg_number_write_de(gchar *buf, double val, unsigned int tprec, int min_exp) +unsigned int sp_svg_number_write_de(gchar *buf, int bufLen, double val, unsigned int tprec, int min_exp) { int eval = (int)floor(log10(fabs(val))); if (val == 0.0 || eval < min_exp) { @@ -158,12 +158,12 @@ unsigned int sp_svg_number_write_de(gchar *buf, double val, unsigned int tprec, (unsigned int)eval+1; unsigned int maxnumdigitsWithExp = tprec + ( eval<0 ? 4 : 3 ); // It's not necessary to take larger exponents into account, because then maxnumdigitsWithoutExp is DEFINITELY larger if (maxnumdigitsWithoutExp <= maxnumdigitsWithExp) { - return sp_svg_number_write_d(buf, val, tprec, 0); + return sp_svg_number_write_d(buf, bufLen, val, tprec, 0); } else { val = eval < 0 ? val * pow(10.0, -eval) : val / pow(10.0, eval); - int p = sp_svg_number_write_d(buf, val, tprec, 0); + int p = sp_svg_number_write_d(buf, bufLen, val, tprec, 0); buf[p++] = 'e'; - p += sp_svg_number_write_i(buf + p, eval); + p += sp_svg_number_write_i(buf + p, bufLen - p, eval); return p; } } @@ -255,7 +255,7 @@ std::vector sp_svg_length_list_read(gchar const *str) float computed; char *next = (char *) str; std::vector list; - + while (sp_svg_length_read_lff(next, &unit, &value, &computed, &next)) { SVGLength length; @@ -266,9 +266,9 @@ std::vector sp_svg_length_list_read(gchar const *str) (*next == ',' || *next == ' ' || *next == '\n' || *next == '\r' || *next == '\t')) { // the list can be comma- or space-separated, but we will be generous and accept // a mix, including newlines and tabs - next++; + next++; } - + if (!next || !*next) { break; } @@ -291,7 +291,7 @@ static unsigned sp_svg_length_read_lff(gchar const *str, SVGLength::Unit *unit, if (e == str) { return 0; } - + if (!e[0]) { /* Unitless */ if (unit) { diff --git a/src/svg/svg.h b/src/svg/svg.h index 0eab21226..0b2c3ae53 100644 --- a/src/svg/svg.h +++ b/src/svg/svg.h @@ -1,5 +1,5 @@ -#ifndef __SP_SVG_H__ -#define __SP_SVG_H__ +#ifndef SEEN_SP_SVG_H +#define SEEN_SP_SVG_H /* * SVG data parser @@ -28,14 +28,14 @@ * - no valid end character checking * Return FALSE and let val untouched on error */ - -unsigned int sp_svg_number_read_f (const gchar *str, float *val); -unsigned int sp_svg_number_read_d (const gchar *str, double *val); + +unsigned int sp_svg_number_read_f( const gchar *str, float *val ); +unsigned int sp_svg_number_read_d( const gchar *str, double *val ); /* * No buffer overflow checking is done, so better wrap them if needed */ -unsigned int sp_svg_number_write_de (gchar *buf, double val, unsigned int tprec, int min_exp); +unsigned int sp_svg_number_write_de( gchar *buf, int bufLen, double val, unsigned int tprec, int min_exp ); /* Length */ @@ -48,9 +48,9 @@ unsigned int sp_svg_number_write_de (gchar *buf, double val, unsigned int tprec, * Any return value pointer can be NULL */ -unsigned int sp_svg_length_read_computed_absolute (const gchar *str, float *length); -std::vector sp_svg_length_list_read (const gchar *str); -unsigned int sp_svg_length_read_ldd (const gchar *str, SVGLength::Unit *unit, double *value, double *computed); +unsigned int sp_svg_length_read_computed_absolute( const gchar *str, float *length ); +std::vector sp_svg_length_list_read( const gchar *str ); +unsigned int sp_svg_length_read_ldd( const gchar *str, SVGLength::Unit *unit, double *value, double *computed ); std::string sp_svg_length_write_with_units(SVGLength const &length); @@ -59,15 +59,15 @@ bool sp_svg_transform_read(gchar const *str, Geom::Matrix *transform); gchar *sp_svg_transform_write(Geom::Matrix const &transform); gchar *sp_svg_transform_write(Geom::Matrix const *transform); -double sp_svg_read_percentage (const char * str, double def); +double sp_svg_read_percentage( const char * str, double def ); /* NB! As paths can be long, we use here dynamic string */ -Geom::PathVector sp_svg_read_pathv (char const * str); -gchar * sp_svg_write_path (Geom::PathVector const &p); -gchar * sp_svg_write_path (Geom::Path const &p); +Geom::PathVector sp_svg_read_pathv( char const * str ); +gchar * sp_svg_write_path( Geom::PathVector const &p ); +gchar * sp_svg_write_path( Geom::Path const &p ); -#endif +#endif // SEEN_SP_SVG_H /* Local Variables: -- cgit v1.2.3 From 73669a540717d2ad6dded3b38c93a96f273be793 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Thu, 8 Oct 2009 08:49:48 +0000 Subject: Follow-up ui rollback for fixing bug #399604. (bzr r8743) --- src/ui/dialog/inkscape-preferences.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 79d6a0702..c7dc789ca 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -1037,7 +1037,7 @@ void InkscapePreferences::initPageSVGOutput() _page_svgoutput.add_group_header( _("Numbers")); - _svgoutput_numericprecision.init("/options/svgoutput/numericprecision", 3.0, 16.0, 1.0, 2.0, 8.0, true, false); + _svgoutput_numericprecision.init("/options/svgoutput/numericprecision", 1.0, 16.0, 1.0, 2.0, 8.0, true, false); _page_svgoutput.add_line( false, _("Numeric precision:"), _svgoutput_numericprecision, "", _("How many digits to write after the decimal dot"), false); _svgoutput_minimumexponent.init("/options/svgoutput/minimumexponent", -32.0, -1, 1.0, 2.0, -8.0, true, false); -- cgit v1.2.3 From f54fc047a58825574b5142522fe2380572ec0e92 Mon Sep 17 00:00:00 2001 From: Josh Andler Date: Thu, 8 Oct 2009 21:25:50 +0000 Subject: Patch by Johan to fix 365903. (bzr r8748) --- src/live_effects/lpe-knot.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/live_effects/lpe-knot.cpp b/src/live_effects/lpe-knot.cpp index 793061b2f..340cdf633 100644 --- a/src/live_effects/lpe-knot.cpp +++ b/src/live_effects/lpe-knot.cpp @@ -10,6 +10,7 @@ */ #include "sp-shape.h" +#include "sp-path.h" #include "display/curve.h" #include "live_effects/lpe-knot.h" #include "svg/svg.h" @@ -25,6 +26,10 @@ #include <2geom/basic-intersection.h> #include <2geom/exception.h> +// for change crossing undo +#include "verbs.h" +#include "document.h" + #include namespace Inkscape { @@ -486,7 +491,12 @@ void collectPathsAndWidths (SPLPEItem const *lpeitem, std::vector &p } } else if (SP_IS_SHAPE(lpeitem)) { - SPCurve * c = sp_shape_get_curve(SP_SHAPE(lpeitem)); + SPCurve * c = NULL; + if (SP_IS_PATH(lpeitem)) { + c = sp_path_get_curve_for_edit(SP_PATH(lpeitem)); + } else { + c = sp_shape_get_curve(SP_SHAPE(lpeitem)); + } if (c) { Geom::PathVector subpaths = c->get_pathvector(); for (unsigned i=0; icrossing_points[s].sign<<".\n"; } lpe->crossing_points_vector.param_set_and_write_new_value(lpe->crossing_points.to_vector()); + sp_document_done(lpe->getSPDoc(), SP_VERB_DIALOG_LIVE_PATH_EFFECT, /// @todo Is this the right verb? + _("Change knot crossing")); // FIXME: this should not directly ask for updating the item. It should write to SVG, which triggers updating. - sp_lpe_item_update_patheffect (SP_LPE_ITEM(item), false, true); +// sp_lpe_item_update_patheffect (SP_LPE_ITEM(item), false, true); } } -- cgit v1.2.3 From 217244fe1ea48fff70ccc26e3031db20291cf245 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Thu, 8 Oct 2009 21:45:52 +0000 Subject: Added simplistic test cases (bzr r8749) --- src/svg/svg-length-test.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'src') diff --git a/src/svg/svg-length-test.h b/src/svg/svg-length-test.h index 3ac01467a..2c2fe34f0 100644 --- a/src/svg/svg-length-test.h +++ b/src/svg/svg-length-test.h @@ -134,6 +134,36 @@ public: TSM_ASSERT_EQUALS(validStrings, validStrings.size(), 0u); } + + + void testFourPlaces() + { + double val = 761.92918978947023; + int precision = 4; + int minexp = -8; + char buf[256] = {0}; + + memset(buf, 0xCC, sizeof(buf)); // Make it easy to detect an overrun. + unsigned int retval = sp_svg_number_write_de( buf, sizeof(buf), val, precision, minexp ); + TSM_ASSERT_EQUALS("Number of chars written", retval, 5u); + TSM_ASSERT_EQUALS("Numeric string written", std::string(buf), std::string("761.9")); + TSM_ASSERT_EQUALS(std::string("Buffer overrun ") + buf, '\xCC', buf[retval + 1]); + } + + void testTwoPlaces() + { + double val = 761.92918978947023; + int precision = 2; + int minexp = -8; + char buf[256] = {0}; + + memset(buf, 0xCC, sizeof(buf)); // Make it easy to detect an overrun. + unsigned int retval = sp_svg_number_write_de( buf, sizeof(buf), val, precision, minexp ); + TSM_ASSERT_EQUALS("Number of chars written", retval, 3u); + TSM_ASSERT_EQUALS("Numeric string written", std::string(buf), std::string("760")); + TSM_ASSERT_EQUALS(std::string("Buffer overrun ") + buf, '\xCC', buf[retval + 1]); + } + // TODO: More tests }; -- cgit v1.2.3 From 0d815ac5672dc97bc5e6af2283ef632b42eb1967 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Fri, 9 Oct 2009 00:29:51 +0000 Subject: Refactored multiple methods to single data-driven one. (bzr r8750) --- src/svg/svg-length-test.h | 45 ++++++++++++++++++--------------------------- 1 file changed, 18 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/svg/svg-length-test.h b/src/svg/svg-length-test.h index 2c2fe34f0..833b4a08b 100644 --- a/src/svg/svg-length-test.h +++ b/src/svg/svg-length-test.h @@ -13,9 +13,13 @@ private: struct test_t { char const* str; SVGLength::Unit unit; float value; float computed; }; + struct testd_t { + char const* str; double val; int prec; int minexp; + }; static test_t const absolute_tests[12]; static test_t const relative_tests[3]; static char const * fail_tests[8]; + public: SvgLengthTest() { } @@ -134,34 +138,21 @@ public: TSM_ASSERT_EQUALS(validStrings, validStrings.size(), 0u); } - - - void testFourPlaces() - { - double val = 761.92918978947023; - int precision = 4; - int minexp = -8; - char buf[256] = {0}; - - memset(buf, 0xCC, sizeof(buf)); // Make it easy to detect an overrun. - unsigned int retval = sp_svg_number_write_de( buf, sizeof(buf), val, precision, minexp ); - TSM_ASSERT_EQUALS("Number of chars written", retval, 5u); - TSM_ASSERT_EQUALS("Numeric string written", std::string(buf), std::string("761.9")); - TSM_ASSERT_EQUALS(std::string("Buffer overrun ") + buf, '\xCC', buf[retval + 1]); - } - - void testTwoPlaces() + void testPlaces() { - double val = 761.92918978947023; - int precision = 2; - int minexp = -8; - char buf[256] = {0}; - - memset(buf, 0xCC, sizeof(buf)); // Make it easy to detect an overrun. - unsigned int retval = sp_svg_number_write_de( buf, sizeof(buf), val, precision, minexp ); - TSM_ASSERT_EQUALS("Number of chars written", retval, 3u); - TSM_ASSERT_EQUALS("Numeric string written", std::string(buf), std::string("760")); - TSM_ASSERT_EQUALS(std::string("Buffer overrun ") + buf, '\xCC', buf[retval + 1]); + testd_t const precTests[] = { + {"760", 761.92918978947023, 2, -8}, + {"761.9", 761.92918978947023, 4, -8}, + }; + + for ( size_t i = 0; i < G_N_ELEMENTS(precTests); i++ ) { + char buf[256] = {0}; + memset(buf, 0xCC, sizeof(buf)); // Make it easy to detect an overrun. + unsigned int retval = sp_svg_number_write_de( buf, sizeof(buf), precTests[i].val, precTests[i].prec, precTests[i].minexp ); + TSM_ASSERT_EQUALS("Number of chars written", retval, strlen(precTests[i].str)); + TSM_ASSERT_EQUALS("Numeric string written", std::string(buf), std::string(precTests[i].str)); + TSM_ASSERT_EQUALS(std::string("Buffer overrun ") + precTests[i].str, '\xCC', buf[retval + 1]); + } } // TODO: More tests -- cgit v1.2.3 From 5fde0d7605af20d0c7a71cbe4ec8e4219e3d363a Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Fri, 9 Oct 2009 00:31:14 +0000 Subject: Cleanup of out-of-sync tests (bzr r8751) --- src/attributes-test.h | 9 +++++---- src/livarot/ShapeDraw.cpp | 1 - 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/attributes-test.h b/src/attributes-test.h index d6851a42b..1d8f32843 100644 --- a/src/attributes-test.h +++ b/src/attributes-test.h @@ -44,6 +44,7 @@ struct {char const *attr; bool supported;} const all_attrs[] = { {"begin", true}, {"additive", true}, {"font", true}, + {"-inkscape-font-specification", true}, // TODO look into this attribute's name {"marker", true}, {"line-height", true}, @@ -338,7 +339,7 @@ struct {char const *attr; bool supported;} const all_attrs[] = { {"sodipodi:insensitive", true}, {"sodipodi:nonprintable", true}, {"inkscape:groupmode", true}, - {"sodipodi:version", true}, + {"sodipodi:version", false}, {"inkscape:version", true}, {"inkscape:object-paths", true}, {"inkscape:object-nodes", true}, @@ -355,9 +356,9 @@ struct {char const *attr; bool supported;} const all_attrs[] = { {"inkscape:snap-object-midpoints", true}, {"inkscape:snap-bbox-edge-midpoints", true}, {"inkscape:snap-bbox-midpoints", true}, - //{"inkscape:snap-intersection-grid-guide", true}, - {"inkscape:snap-grids", true}, - {"inkscape:snap-to-guides", true}, + //{"inkscape:snap-intersection-grid-guide", true}, + {"inkscape:snap-grids", true}, + {"inkscape:snap-to-guides", true}, {"inkscape:snap-intersection-paths", true}, {"inkscape:original-d", true}, {"inkscape:pageopacity", true}, diff --git a/src/livarot/ShapeDraw.cpp b/src/livarot/ShapeDraw.cpp index f3a8dbd1f..d222cc49c 100644 --- a/src/livarot/ShapeDraw.cpp +++ b/src/livarot/ShapeDraw.cpp @@ -24,7 +24,6 @@ Shape::Plot (double ix, double iy, double ir, double mx, double my, bool doPoint fprintf(outFile,"\"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd\">\n"); fprintf(outFile," Date: Sun, 11 Oct 2009 23:52:47 +0000 Subject: Johan's patch for 425557 (bzr r8762) --- src/2geom/bezier.h | 39 ++++++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/2geom/bezier.h b/src/2geom/bezier.h index 4ab965f42..1fe846935 100644 --- a/src/2geom/bezier.h +++ b/src/2geom/bezier.h @@ -52,29 +52,26 @@ inline Coord subdivideArr(Coord t, Coord const *v, Coord *left, Coord *right, un */ unsigned N = order+1; - std::valarray vtemp(2*N); + std::valarray row(N); for (unsigned i = 0; i < N; i++) - vtemp[i] = v[i]; + row[i] = v[i]; // Triangle computation const double omt = (1-t); if(left) - left[0] = vtemp[0]; + left[0] = row[0]; if(right) - right[order] = vtemp[order]; - double *prev_row = &vtemp[0]; - double *row = &vtemp[N]; + right[order] = row[order]; for (unsigned i = 1; i < N; i++) { for (unsigned j = 0; j < N - i; j++) { - row[j] = omt*prev_row[j] + t*prev_row[j+1]; + row[j] = omt*row[j] + t*row[j+1]; } if(left) left[i] = row[0]; if(right) right[order-i] = row[order-i]; - std::swap(prev_row, row); } - return (prev_row[0]); + return (row[0]); /* Coord vtemp[order+1][order+1]; @@ -97,6 +94,20 @@ inline Coord subdivideArr(Coord t, Coord const *v, Coord *left, Coord *right, un return (vtemp[order][0]);*/ } +template +inline T bernsteinValueAt(double t, T const *c_, unsigned n) { + double u = 1.0 - t; + double bc = 1; + double tn = 1; + T tmp = c_[0]*u; + for(unsigned i=1; i&>(c_)[0], order(), solutions, 0, 0.0, 1.0); return solutions; } + std::vector roots(Interval const ivl) const { + std::vector solutions; + find_bernstein_roots(&const_cast&>(c_)[0], order(), solutions, 0, ivl[0], ivl[1]); + return solutions; + } }; -- cgit v1.2.3 From da507beea868c07d95b2065bfeac2950393c15a7 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Wed, 14 Oct 2009 07:18:26 +0000 Subject: Applying second patch for bug #425557. (bzr r8768) --- src/2geom/bezier.h | 33 +++++++++++++++++++++------------ src/2geom/d2.h | 8 ++++---- 2 files changed, 25 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/2geom/bezier.h b/src/2geom/bezier.h index 1fe846935..9e68d93ae 100644 --- a/src/2geom/bezier.h +++ b/src/2geom/bezier.h @@ -46,7 +46,7 @@ namespace Geom { inline Coord subdivideArr(Coord t, Coord const *v, Coord *left, Coord *right, unsigned order) { /* * Bernstein : - * Evaluate a Bernstein function at a particular parameter value + * Evaluate a Bernstein function at a particular parameter value * Fill in control points for resulting sub-curves. * */ @@ -236,25 +236,34 @@ public: //inline Coord const &operator[](unsigned ix) const { return c_[ix]; } inline void setPoint(unsigned ix, double val) { c_[ix] = val; } - /* This is inelegant, as it uses several extra stores. I think there might be a way to - * evaluate roughly in situ. */ - + /** + * The size of the returned vector equals n_derivs+1. + */ std::vector valueAndDerivatives(Coord t, unsigned n_derivs) const { - std::vector val_n_der; + /* This is inelegant, as it uses several extra stores. I think there might be a way to + * evaluate roughly in situ. */ + + // initialize return vector with zeroes, such that we only need to replace the non-zero derivs + std::vector val_n_der(n_derivs + 1, Coord(0.0)); + + // initialize temp storage variables std::valarray d_(order()+1); - unsigned nn = n_derivs + 1; // the size of the result vector equals n_derivs+1 ... - if(nn > order()) - nn = order()+1; // .. but with a maximum of order() + 1! - for(unsigned i = 0; i < size(); i++) + for (unsigned i = 0; i < size(); i++) { d_[i] = c_[i]; - val_n_der.resize(nn); - for(unsigned di = 0; di < nn; di++) { + } + + unsigned nn = n_derivs + 1; + if(n_derivs > order()) { + nn = order()+1; // only calculate the non zero derivs + } + for (unsigned di = 0; di < nn; di++) { //val_n_der[di] = (subdivideArr(t, &d_[0], NULL, NULL, order() - di)); val_n_der[di] = bernsteinValueAt(t, &d_[0], order() - di); - for(unsigned i = 0; i < order() - di; i++) { + for (unsigned i = 0; i < order() - di; i++) { d_[i] = (order()-di)*(d_[i+1] - d_[i]); } } + return val_n_der; } diff --git a/src/2geom/d2.h b/src/2geom/d2.h index afa00b40d..547d8c658 100644 --- a/src/2geom/d2.h +++ b/src/2geom/d2.h @@ -97,10 +97,10 @@ class D2{ } std::vector valueAndDerivatives(double t, unsigned n) const { std::vector x = f[X].valueAndDerivatives(t, n), - y = f[Y].valueAndDerivatives(t, n); - std::vector res; - for(unsigned i = 0; i <= n; i++) { - res.push_back(Point(x[i], y[i])); + y = f[Y].valueAndDerivatives(t, n); // always returns a vector of size n+1 + std::vector res(n+1); + for (unsigned i = 0; i <= n; i++) { + res[i] = Point(x[i], y[i]); } return res; } -- cgit v1.2.3 From ec444a1a2619f5b984170583e42c2980afe787e9 Mon Sep 17 00:00:00 2001 From: Josh Andler Date: Wed, 14 Oct 2009 21:53:02 +0000 Subject: Patch by Tavmjong for 451588 (bzr r8771) --- src/extension/internal/pov-out.cpp | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/extension/internal/pov-out.cpp b/src/extension/internal/pov-out.cpp index f30cbc317..f8916655d 100644 --- a/src/extension/internal/pov-out.cpp +++ b/src/extension/internal/pov-out.cpp @@ -306,10 +306,12 @@ bool PovOutput::doCurve(SPItem *item, const String &id) //Count the NR_CURVETOs/LINETOs (including closing line segment) int segmentCount = 0; for(Geom::PathVector::const_iterator it = pathv.begin(); it != pathv.end(); ++it) - { + { segmentCount += (*it).size(); - if (it->closed()) - segmentCount += 1; + + // If segment not closed, add space for a closing segment. + if (!it->closed()) segmentCount += 1; + } out("/*###################################################\n"); @@ -340,10 +342,14 @@ bool PovOutput::doCurve(SPItem *item, const String &id) cminmax.expandTo(pit->initialPoint()); /** - * For all segments in the subpath + * For all segments in the subpath, including extra closing segment defined by 2geom */ for (Geom::Path::const_iterator cit = pit->begin(); cit != pit->end_closed(); ++cit) - { + { + + // If path is closed, we don't need extra closing segment. + if( pit->closed() && cit == pit->end() ) + continue; if( is_straight_curve(*cit) ) { @@ -374,6 +380,11 @@ bool PovOutput::doCurve(SPItem *item, const String &id) out(",\n"); else out("\n"); + if (segmentNr > segmentCount) + { + err("Too many segments"); + return false; + } cminmax.expandTo(cit->finalPoint()); -- cgit v1.2.3 From 65153786612ddeaa63d7ea5fbed0c2698a023fe7 Mon Sep 17 00:00:00 2001 From: bulia byak Date: Thu, 15 Oct 2009 06:39:10 +0000 Subject: fix crash: draw two paths, select both, object - clip - set, node tool, edit clippath, drag a clippath node, undo (bzr r8773) --- src/shape-editor.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/shape-editor.cpp b/src/shape-editor.cpp index b44d889e0..4999eb7cf 100644 --- a/src/shape-editor.cpp +++ b/src/shape-editor.cpp @@ -353,6 +353,9 @@ bool ShapeEditor::is_over_stroke (Geom::Point event_p, bool remember) { const SPItem *item = get_item(SH_NODEPATH); + if (!item || !SP_IS_ITEM(item)) + return false; + //Translate click point into proper coord system this->curvepoint_doc = desktop->w2d(event_p); this->curvepoint_doc *= sp_item_dt2i_affine(item); -- cgit v1.2.3 From a655ef868bd318ef5ca60e7f25bf2987f313faec Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Thu, 15 Oct 2009 17:51:53 +0000 Subject: Fix for bug #423326 (Untranslated file types). Okayed by Joshua A. Andler on IRC (thanks!). (bzr r8779) --- src/ui/dialog/filedialogimpl-win32.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/ui/dialog/filedialogimpl-win32.cpp b/src/ui/dialog/filedialogimpl-win32.cpp index 2196ef0de..d22a368f2 100644 --- a/src/ui/dialog/filedialogimpl-win32.cpp +++ b/src/ui/dialog/filedialogimpl-win32.cpp @@ -193,11 +193,11 @@ void FileOpenDialogImplWin32::createFilterMenu() ustring all_inkscape_files_filter, all_image_files_filter, all_vectors_filter, all_bitmaps_filter; Filter all_files, all_inkscape_files, all_image_files, all_vectors, all_bitmaps; - const gchar *all_files_filter_name = N_("All Files"); - const gchar *all_inkscape_files_filter_name = N_("All Inkscape Files"); - const gchar *all_image_files_filter_name = N_("All Images"); - const gchar *all_vectors_filter_name = N_("All Vectors"); - const gchar *all_bitmaps_filter_name = N_("All Bitmaps"); + const gchar *all_files_filter_name = _("All Files"); + const gchar *all_inkscape_files_filter_name = _("All Inkscape Files"); + const gchar *all_image_files_filter_name = _("All Images"); + const gchar *all_vectors_filter_name = _("All Vectors"); + const gchar *all_bitmaps_filter_name = _("All Bitmaps"); // Calculate the amount of memory required int filter_count = 5; // 5 - one for each filter type -- cgit v1.2.3 From d1e778ca433a52ab65916e2a6c4d36f78faddbf1 Mon Sep 17 00:00:00 2001 From: Josh Andler Date: Fri, 16 Oct 2009 22:28:40 +0000 Subject: More proper fix for 451588 by Tavmjong (bzr r8788) --- src/extension/internal/pov-out.cpp | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/extension/internal/pov-out.cpp b/src/extension/internal/pov-out.cpp index f8916655d..1cb14fb58 100644 --- a/src/extension/internal/pov-out.cpp +++ b/src/extension/internal/pov-out.cpp @@ -303,16 +303,28 @@ bool PovOutput::doCurve(SPItem *item, const String &id) Geom::Matrix tf = sp_item_i2d_affine(item); Geom::PathVector pathv = pathv_to_linear_and_cubic_beziers( curve->get_pathvector() * tf ); - //Count the NR_CURVETOs/LINETOs (including closing line segment) + /* + * We need to know the number of segments (NR_CURVETOs/LINETOs, including + * closing line segment) before we write out segment data. Since we are + * going to skip degenerate (zero length) paths, we need to loop over all + * subpaths and segments first. + */ int segmentCount = 0; - for(Geom::PathVector::const_iterator it = pathv.begin(); it != pathv.end(); ++it) + /** + * For all Subpaths in the + */ + for (Geom::PathVector::const_iterator pit = pathv.begin(); pit != pathv.end(); ++pit) + { + /** + * For all segments in the subpath, including extra closing segment defined by 2geom + */ + for (Geom::Path::const_iterator cit = pit->begin(); cit != pit->end_closed(); ++cit) { - segmentCount += (*it).size(); - - // If segment not closed, add space for a closing segment. - if (!it->closed()) segmentCount += 1; + // Skip zero length segments. + if( !cit->isDegenerate() ) ++segmentCount; } + } out("/*###################################################\n"); out("### PRISM: %s\n", id.c_str()); @@ -347,8 +359,8 @@ bool PovOutput::doCurve(SPItem *item, const String &id) for (Geom::Path::const_iterator cit = pit->begin(); cit != pit->end_closed(); ++cit) { - // If path is closed, we don't need extra closing segment. - if( pit->closed() && cit == pit->end() ) + // Skip zero length segments + if( cit->isDegenerate() ) continue; if( is_straight_curve(*cit) ) @@ -371,7 +383,7 @@ bool PovOutput::doCurve(SPItem *item, const String &id) nrNodes += 8; } else - { + { err("logical error, because pathv_to_linear_and_cubic_beziers was used"); return false; } -- cgit v1.2.3 From 62696234b51b95b6da2b2612162cc4f185481a47 Mon Sep 17 00:00:00 2001 From: Josh Andler Date: Sun, 18 Oct 2009 19:17:16 +0000 Subject: Patch by Adib for 429529 (bzr r8792) --- src/extension/system.cpp | 2 +- src/file.cpp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/extension/system.cpp b/src/extension/system.cpp index f41217959..6ffa7f57f 100644 --- a/src/extension/system.cpp +++ b/src/extension/system.cpp @@ -206,7 +206,7 @@ save(Extension *key, SPDocument *doc, gchar const *filename, bool setextension, } /* If autodetect fails, save as Inkscape SVG */ if (omod == NULL) { - omod = dynamic_cast(db.get(SP_MODULE_KEY_OUTPUT_SVG_INKSCAPE)); + // omod = dynamic_cast(db.get(SP_MODULE_KEY_OUTPUT_SVG_INKSCAPE)); use exception and let user choose } } else { omod = dynamic_cast(key); diff --git a/src/file.cpp b/src/file.cpp index 4964d30d5..e0ecd5084 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -883,6 +883,10 @@ sp_file_save_document(Gtk::Window &parentWindow, SPDocument *doc) ext = fn.substr( pos ); } success = file_save(parentWindow, doc, fn, Inkscape::Extension::db.get(ext.c_str()), FALSE, TRUE, Inkscape::Extension::FILE_SAVE_METHOD_SAVE_AS); + if (success == false) { + // give the user the chance to change filename or extension + return sp_file_save_dialog(parentWindow, doc, Inkscape::Extension::FILE_SAVE_METHOD_INKSCAPE_SVG); + } } } else { SP_ACTIVE_DESKTOP->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("No changes need to be saved.")); -- cgit v1.2.3 From 92c8fdf13fbf882c84e330a22b226dcd0026f13b Mon Sep 17 00:00:00 2001 From: Josh Andler Date: Mon, 19 Oct 2009 16:26:43 +0000 Subject: Patch by Luca for 449709 (bzr r8793) --- src/display/nr-filter.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/display/nr-filter.cpp b/src/display/nr-filter.cpp index 3ca2b0dba..d0e0ec11e 100644 --- a/src/display/nr-filter.cpp +++ b/src/display/nr-filter.cpp @@ -168,6 +168,8 @@ int Filter::render(NRArenaItem const *item, NRPixBlock *pb) // TODO: with filterRes of 0x0 should return an empty image std::pair resolution = _filter_resolution(filter_area, trans, filterquality); + if(!(resolution.first > 0 && resolution.second > 0)) + return 1; units.set_resolution(resolution.first, resolution.second); if (_x_pixels > 0) { units.set_automatic_resolution(false); -- cgit v1.2.3 From 3275b1fb072c201142091481f6cb2ad324994fcf Mon Sep 17 00:00:00 2001 From: bulia byak Date: Mon, 19 Oct 2009 23:56:11 +0000 Subject: since SP_VERB_XMPP_CLIENT is commented out in .h, it must be commented out here to, otherwise compilation on windows fails (bzr r8797) --- src/verbs.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/verbs.cpp b/src/verbs.cpp index fd549e381..29d24c101 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -2667,10 +2667,10 @@ Verb *Verb::_base_verbs[] = { N_("Create multiple clones of selected object, arranging them into a pattern or scattering"), INKSCAPE_ICON_DIALOG_TILE_CLONES), new DialogVerb(SP_VERB_DIALOG_ITEM, "DialogObjectProperties", N_("_Object Properties..."), N_("Edit the ID, locked and visible status, and other object properties"), INKSCAPE_ICON_DIALOG_OBJECT_PROPERTIES), -#ifdef WITH_INKBOARD +/*#ifdef WITH_INKBOARD new DialogVerb(SP_VERB_XMPP_CLIENT, "DialogXmppClient", N_("_Instant Messaging..."), N_("Jabber Instant Messaging Client"), NULL), -#endif +#endif*/ new DialogVerb(SP_VERB_DIALOG_INPUT, "DialogInput", N_("_Input Devices..."), N_("Configure extended input devices, such as a graphics tablet"), INKSCAPE_ICON_DIALOG_INPUT_DEVICES), new DialogVerb(SP_VERB_DIALOG_INPUT2, "DialogInput2", N_("_Input Devices (new)..."), -- cgit v1.2.3 From 41bb684f180db264ed37af7d58ef12079a582250 Mon Sep 17 00:00:00 2001 From: bulia byak Date: Sun, 25 Oct 2009 02:48:06 +0000 Subject: remove registerEditWidget, move this to SPDesktop::init instead; a noop change but fixes a weird crash on Windows (bzr r8805) --- src/desktop.cpp | 4 +++- src/desktop.h | 5 +---- src/ui/view/edit-widget.cpp | 3 +-- src/widgets/desktop-widget.cpp | 3 +-- 4 files changed, 6 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/desktop.cpp b/src/desktop.cpp index f7ef1a8cd..319a0d407 100644 --- a/src/desktop.cpp +++ b/src/desktop.cpp @@ -164,8 +164,10 @@ SPDesktop::SPDesktop() : } void -SPDesktop::init (SPNamedView *nv, SPCanvas *aCanvas) +SPDesktop::init (SPNamedView *nv, SPCanvas *aCanvas, Inkscape::UI::View::EditWidgetInterface *widget) { + _widget = widget; + // Temporary workaround for link order issues: Inkscape::DeviceManager::getManager().getDevices(); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); diff --git a/src/desktop.h b/src/desktop.h index 4438c90e5..cfb977425 100644 --- a/src/desktop.h +++ b/src/desktop.h @@ -180,7 +180,7 @@ struct SPDesktop : public Inkscape::UI::View::View #endif SPDesktop(); - void init (SPNamedView* nv, SPCanvas* canvas); + void init (SPNamedView* nv, SPCanvas* canvas, Inkscape::UI::View::EditWidgetInterface *widget); virtual ~SPDesktop(); void destroy(); @@ -303,9 +303,6 @@ struct SPDesktop : public Inkscape::UI::View::View void fullscreen(); void focusMode(bool mode = true); - void registerEditWidget (Inkscape::UI::View::EditWidgetInterface *widget) - { _widget = widget; } - Geom::Matrix w2d() const; //transformation from window to desktop coordinates (used for zooming) Geom::Point w2d(Geom::Point const &p) const; Geom::Point d2w(Geom::Point const &p) const; diff --git a/src/ui/view/edit-widget.cpp b/src/ui/view/edit-widget.cpp index 1d319f97f..770a9bf87 100644 --- a/src/ui/view/edit-widget.cpp +++ b/src/ui/view/edit-widget.cpp @@ -1551,11 +1551,10 @@ void EditWidget::initEdit (SPDocument *doc) { _desktop = new SPDesktop(); - _desktop->registerEditWidget (this); _namedview = sp_document_namedview (doc, 0); _svg_canvas.init (_desktop); - _desktop->init (_namedview, _svg_canvas.spobj()); + _desktop->init (_namedview, _svg_canvas.spobj(), this); sp_namedview_window_from_document (_desktop); sp_namedview_update_layers_from_document (_desktop); _dt2r = 1.0 / _namedview->doc_units->unittobase; diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index 5fd32487f..e3bf1ae9c 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -1339,8 +1339,7 @@ sp_desktop_widget_new (SPNamedView *namedview) dtw->desktop = new SPDesktop(); dtw->stub = new SPDesktopWidget::WidgetStub (dtw); - dtw->desktop->registerEditWidget (dtw->stub); - dtw->desktop->init (namedview, dtw->canvas); + dtw->desktop->init (namedview, dtw->canvas, dtw->stub); inkscape_add_desktop (dtw->desktop); // Add the shape geometry to libavoid for autorouting connectors. -- cgit v1.2.3 From 7e9866358d46080aa5c4adeb830fbad43896724d Mon Sep 17 00:00:00 2001 From: bulia byak Date: Sat, 7 Nov 2009 23:59:36 +0000 Subject: revert the PS rotation part of Adrian's patch for 437550, see discussion in the bug (bzr r8820) --- src/extension/internal/cairo-render-context.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'src') diff --git a/src/extension/internal/cairo-render-context.cpp b/src/extension/internal/cairo-render-context.cpp index cae496543..1594ced7d 100644 --- a/src/extension/internal/cairo-render-context.cpp +++ b/src/extension/internal/cairo-render-context.cpp @@ -768,15 +768,7 @@ CairoRenderContext::setupSurface(double width, double height) #endif #ifdef CAIRO_HAS_PS_SURFACE case CAIRO_SURFACE_TYPE_PS: - if (!_eps && width > height) { - surface = cairo_ps_surface_create_for_stream(Inkscape::Extension::Internal::_write_callback, _stream, height, width); - cairo_matrix_init (&ctm, 0, -1, 1, 0, 0, 0); - cairo_matrix_translate (&ctm, -width, 0); - cairo_ps_surface_dsc_begin_page_setup (surface); - cairo_ps_surface_dsc_comment (surface, "%%PageOrientation: Landscape"); - } else { - surface = cairo_ps_surface_create_for_stream(Inkscape::Extension::Internal::_write_callback, _stream, width, height); - } + surface = cairo_ps_surface_create_for_stream(Inkscape::Extension::Internal::_write_callback, _stream, width, height); if(CAIRO_STATUS_SUCCESS != cairo_surface_status(surface)) { return FALSE; } -- cgit v1.2.3 From ed4a352d52944eb8a4695762c2075f2f12fab562 Mon Sep 17 00:00:00 2001 From: bulia byak Date: Sun, 8 Nov 2009 00:09:18 +0000 Subject: Krzysztof's patch for 388257 (bzr r8821) --- src/extension/internal/cairo-render-context.cpp | 33 ++++++++++++++----------- 1 file changed, 19 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/extension/internal/cairo-render-context.cpp b/src/extension/internal/cairo-render-context.cpp index 1594ced7d..721d3addc 100644 --- a/src/extension/internal/cairo-render-context.cpp +++ b/src/extension/internal/cairo-render-context.cpp @@ -1450,7 +1450,7 @@ CairoRenderContext::renderImage(guchar *px, unsigned int w, unsigned int h, unsi #define GLYPH_ARRAY_SIZE 64 unsigned int -CairoRenderContext::_showGlyphs(cairo_t *cr, PangoFont *font, std::vector const &glyphtext, bool is_stroke) +CairoRenderContext::_showGlyphs(cairo_t *cr, PangoFont *font, std::vector const &glyphtext, bool path) { cairo_glyph_t glyph_array[GLYPH_ARRAY_SIZE]; cairo_glyph_t *glyphs = glyph_array; @@ -1474,15 +1474,10 @@ CairoRenderContext::_showGlyphs(cairo_t *cr, PangoFont *font, std::vector GLYPH_ARRAY_SIZE) @@ -1544,20 +1539,30 @@ CairoRenderContext::renderGlyphtext(PangoFont *font, Geom::Matrix const *font_ma _showGlyphs(_cr, font, glyphtext, TRUE); } } else { - + bool fill = false, stroke = false, have_path = false; if (style->fill.isColor() || style->fill.isPaintserver()) { // set fill style _setFillStyle(style, NULL); - - _showGlyphs(_cr, font, glyphtext, FALSE); + fill = true; } if (style->stroke.isColor() || style->stroke.isPaintserver()) { // set stroke style _setStrokeStyle(style, NULL); - - // paint stroke - _showGlyphs(_cr, font, glyphtext, TRUE); + stroke = true; + } + if (fill) { + if (_is_texttopath) { + _showGlyphs(_cr, font, glyphtext, true); + have_path = true; + if (stroke) cairo_fill_preserve(_cr); + else cairo_fill(_cr); + } else { + _showGlyphs(_cr, font, glyphtext, false); + } + } + if (stroke) { + if (!have_path) _showGlyphs(_cr, font, glyphtext, true); cairo_stroke(_cr); } } -- cgit v1.2.3 From 377e6a7d2da99c714f8b9a99d9b48e3e9fbae5fc Mon Sep 17 00:00:00 2001 From: bulia byak Date: Sun, 8 Nov 2009 00:50:58 +0000 Subject: patch by Krzysztof for 459811 (bzr r8822) --- src/sp-ellipse.cpp | 5 +++-- src/widgets/toolbox.cpp | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/sp-ellipse.cpp b/src/sp-ellipse.cpp index 769fa54fd..12ba0ed0e 100644 --- a/src/sp-ellipse.cpp +++ b/src/sp-ellipse.cpp @@ -893,10 +893,11 @@ sp_arc_position_set(SPArc *arc, gdouble x, gdouble y, gdouble rx, gdouble ry) ge->rx.computed = rx; ge->ry.computed = ry; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + // those pref values are in degrees, while we want radians if (prefs->getDouble("/tools/shapes/arc/start", 0.0) != 0) - ge->start = prefs->getDouble("/tools/shapes/arc/start", 0.0); + ge->start = prefs->getDouble("/tools/shapes/arc/start", 0.0) * M_PI / 180; if (prefs->getDouble("/tools/shapes/arc/end", 0.0) != 0) - ge->end = prefs->getDouble("/tools/shapes/arc/end", 0.0); + ge->end = prefs->getDouble("/tools/shapes/arc/end", 0.0) * M_PI / 180; if (!prefs->getBool("/tools/shapes/arc/open")) ge->closed = 1; else diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index 46ad08262..e0fe9bfd1 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -4929,7 +4929,7 @@ sp_arctb_startend_value_changed(GtkAdjustment *adj, GObject *tbl, gchar const *v if (sp_document_get_undo_sensitive(sp_desktop_document(desktop))) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - prefs->setDouble(Glib::ustring("/tools/shapes/arc") + value_name, (adj->value * M_PI)/ 180); + prefs->setDouble(Glib::ustring("/tools/shapes/arc/") + value_name, adj->value); } // quit if run by the attr_changed listener -- cgit v1.2.3 From 02415463cf767b7fe490e773971d65df12f55752 Mon Sep 17 00:00:00 2001 From: Josh Andler Date: Sun, 8 Nov 2009 01:09:47 +0000 Subject: Fix for crash 409043 (bzr r8823) --- src/box3d-side.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') diff --git a/src/box3d-side.cpp b/src/box3d-side.cpp index 241279100..69bae53d9 100644 --- a/src/box3d-side.cpp +++ b/src/box3d-side.cpp @@ -225,6 +225,16 @@ box3d_side_set_shape (SPShape *shape) box3d_side_compute_corner_ids(side, corners); SPCurve *c = new SPCurve(); + + if (!box3d_get_corner_screen(box, corners[0]).isFinite() || + !box3d_get_corner_screen(box, corners[1]).isFinite() || + !box3d_get_corner_screen(box, corners[2]).isFinite() || + !box3d_get_corner_screen(box, corners[3]).isFinite() ) + { + g_warning ("Trying to draw a 3D box side with invalid coordinates.\n"); + return; + } + c->moveto(box3d_get_corner_screen(box, corners[0])); c->lineto(box3d_get_corner_screen(box, corners[1])); c->lineto(box3d_get_corner_screen(box, corners[2])); -- cgit v1.2.3 From a5433a16699362caee5735d5b907f6d4efbf1eac Mon Sep 17 00:00:00 2001 From: Josh Andler Date: Sun, 8 Nov 2009 01:19:29 +0000 Subject: Patch by Johan for 445790 (bzr r8824) --- src/livarot/PathStroke.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/livarot/PathStroke.cpp b/src/livarot/PathStroke.cpp index 465bb205c..93280d794 100644 --- a/src/livarot/PathStroke.cpp +++ b/src/livarot/PathStroke.cpp @@ -63,7 +63,13 @@ void Path::Stroke(Shape *dest, bool doClose, double width, JoinType join, } if ( lastP > lastM+1 ) { - if ( pts[lastP - 1].closed ) { + Geom::Point sbStart = pts[lastM].p; + Geom::Point sbEnd = pts[lastP - 1].p; + // if ( pts[lastP - 1].closed ) { // this is correct, but this bugs text rendering (doesn't close text stroke)... + if ( Geom::LInfty(sbEnd-sbStart) < 0.00001 ) { // why close lines that shouldn't be closed? + // ah I see, because close is defined here for + // a whole path and should be defined per subpath. + // debut==fin => ferme (on devrait garder un element pour les close(), mais tant pis) DoStroke(lastM, lastP - lastM, dest, true, width, join, butt, miter, true); } else { DoStroke(lastM, lastP - lastM, dest, doClose, width, join, butt, miter, true); -- cgit v1.2.3 From 1fae37c51a93b9df8e59703d23c0aa295dd0a4d3 Mon Sep 17 00:00:00 2001 From: Josh Andler Date: Sun, 8 Nov 2009 01:29:06 +0000 Subject: Patch for 456148 by Johan (bzr r8825) --- src/extension/internal/cairo-renderer.cpp | 80 +++--- src/sp-shape.cpp | 408 ++++++++++++++++++------------ src/splivarot.cpp | 66 +++-- 3 files changed, 342 insertions(+), 212 deletions(-) (limited to 'src') diff --git a/src/extension/internal/cairo-renderer.cpp b/src/extension/internal/cairo-renderer.cpp index da88a5eae..8cc386135 100644 --- a/src/extension/internal/cairo-renderer.cpp +++ b/src/extension/internal/cairo-renderer.cpp @@ -192,11 +192,28 @@ static void sp_shape_render (SPItem *item, CairoRenderContext *ctx) ctx->renderPathVector(pathv, style, &pbox); - for(Geom::PathVector::const_iterator path_it = pathv.begin(); path_it != pathv.end(); ++path_it) { - // START position - for (int i = 0; i < 2; i++) { // SP_MARKER_LOC and SP_MARKER_LOC_START - if ( shape->marker[i] ) { - SPMarker* marker = SP_MARKER (shape->marker[i]); + // START marker + for (int i = 0; i < 2; i++) { // SP_MARKER_LOC and SP_MARKER_LOC_START + if ( shape->marker[i] ) { + SPMarker* marker = SP_MARKER (shape->marker[i]); + Geom::Matrix tr; + if (marker->orient_auto) { + tr = sp_shape_marker_get_transform_at_start(pathv.begin()->front()); + } else { + tr = Geom::Rotate::from_degrees(marker->orient) * Geom::Translate(pathv.begin()->front().pointAt(0)); + } + sp_shape_render_invoke_marker_rendering(marker, tr, style, ctx); + } + } + // MID marker + for (int i = 0; i < 3; i += 2) { // SP_MARKER_LOC and SP_MARKER_LOC_MID + if ( !shape->marker[i] ) continue; + SPMarker* marker = SP_MARKER (shape->marker[i]); + for(Geom::PathVector::const_iterator path_it = pathv.begin(); path_it != pathv.end(); ++path_it) { + // START position + if ( path_it != pathv.begin() + && ! ((path_it == (pathv.end()-1)) && (path_it->size_default() == 0)) ) // if this is the last path and it is a moveto-only, there is no mid marker there + { Geom::Matrix tr; if (marker->orient_auto) { tr = sp_shape_marker_get_transform_at_start(path_it->front()); @@ -205,11 +222,8 @@ static void sp_shape_render (SPItem *item, CairoRenderContext *ctx) } sp_shape_render_invoke_marker_rendering(marker, tr, style, ctx); } - } - - // MID position - for (int i = 0; i < 3; i += 2) { // SP_MARKER_LOC and SP_MARKER_LOC_MID - if ( shape->marker[i] && (path_it->size_default() > 1) ) { + // MID position + if (path_it->size_default() > 1) { Geom::Path::const_iterator curve_it1 = path_it->begin(); // incoming curve Geom::Path::const_iterator curve_it2 = ++(path_it->begin()); // outgoing curve while (curve_it2 != path_it->end_default()) @@ -217,9 +231,6 @@ static void sp_shape_render (SPItem *item, CairoRenderContext *ctx) /* Put marker between curve_it1 and curve_it2. * Loop to end_default (so including closing segment), because when a path is closed, * there should be a midpoint marker between last segment and closing straight line segment */ - - SPMarker* marker = SP_MARKER (shape->marker[i]); - Geom::Matrix tr; if (marker->orient_auto) { tr = sp_shape_marker_get_transform(*curve_it1, *curve_it2); @@ -233,32 +244,43 @@ static void sp_shape_render (SPItem *item, CairoRenderContext *ctx) ++curve_it2; } } - } - - // END position - for (int i = 0; i < 4; i += 3) { // SP_MARKER_LOC and SP_MARKER_LOC_END - if ( shape->marker[i] ) { - SPMarker* marker = SP_MARKER (shape->marker[i]); - - /* Get reference to last curve in the path. - * For moveto-only path, this returns the "closing line segment". */ - unsigned int index = path_it->size_default(); - if (index > 0) { - index--; - } - Geom::Curve const &lastcurve = (*path_it)[index]; - + // END position + if ( path_it != (pathv.end()-1) && !path_it->empty()) { + Geom::Curve const &lastcurve = path_it->back_default(); Geom::Matrix tr; if (marker->orient_auto) { tr = sp_shape_marker_get_transform_at_end(lastcurve); } else { tr = Geom::Rotate::from_degrees(marker->orient) * Geom::Translate(lastcurve.pointAt(1)); } - sp_shape_render_invoke_marker_rendering(marker, tr, style, ctx); } } } + // END marker + for (int i = 0; i < 4; i += 3) { // SP_MARKER_LOC and SP_MARKER_LOC_END + if ( shape->marker[i] ) { + SPMarker* marker = SP_MARKER (shape->marker[i]); + + /* Get reference to last curve in the path. + * For moveto-only path, this returns the "closing line segment". */ + Geom::Path const &path_last = pathv.back(); + unsigned int index = path_last.size_default(); + if (index > 0) { + index--; + } + Geom::Curve const &lastcurve = path_last[index]; + + Geom::Matrix tr; + if (marker->orient_auto) { + tr = sp_shape_marker_get_transform_at_end(lastcurve); + } else { + tr = Geom::Rotate::from_degrees(marker->orient) * Geom::Translate(lastcurve.pointAt(1)); + } + + sp_shape_render_invoke_marker_rendering(marker, tr, style, ctx); + } + } } static void sp_group_render(SPItem *item, CairoRenderContext *ctx) diff --git a/src/sp-shape.cpp b/src/sp-shape.cpp index e7ded6303..519002e9e 100644 --- a/src/sp-shape.cpp +++ b/src/sp-shape.cpp @@ -409,9 +409,13 @@ sp_shape_update_marker_view (SPShape *shape, NRArenaItem *ai) int counter[4] = {0}; Geom::PathVector const & pathv = shape->curve->get_pathvector(); - for(Geom::PathVector::const_iterator path_it = pathv.begin(); path_it != pathv.end(); ++path_it) { - // START position - Geom::Matrix const m (sp_shape_marker_get_transform_at_start(path_it->front())); + + // the first vertex should get a start marker, the last an end marker, and all the others a mid marker + // see bug 456148 + + // START marker + { + Geom::Matrix const m (sp_shape_marker_get_transform_at_start(pathv.begin()->front())); for (int i = 0; i < 2; i++) { // SP_MARKER_LOC and SP_MARKER_LOC_START if ( shape->marker[i] ) { sp_marker_show_instance ((SPMarker* ) shape->marker[i], ai, @@ -420,18 +424,53 @@ sp_shape_update_marker_view (SPShape *shape, NRArenaItem *ai) counter[i]++; } } + } - // MID position - if ( (shape->marker[SP_MARKER_LOC_MID] || shape->marker[SP_MARKER_LOC]) && (path_it->size_default() > 1) ) { - Geom::Path::const_iterator curve_it1 = path_it->begin(); // incoming curve - Geom::Path::const_iterator curve_it2 = ++(path_it->begin()); // outgoing curve - while (curve_it2 != path_it->end_default()) + // MID marker + if (shape->marker[SP_MARKER_LOC_MID] || shape->marker[SP_MARKER_LOC]) { + for(Geom::PathVector::const_iterator path_it = pathv.begin(); path_it != pathv.end(); ++path_it) { + // START position + if ( path_it != pathv.begin() + && ! ((path_it == (pathv.end()-1)) && (path_it->size_default() == 0)) ) // if this is the last path and it is a moveto-only, don't draw mid marker there { - /* Put marker between curve_it1 and curve_it2. - * Loop to end_default (so including closing segment), because when a path is closed, - * there should be a midpoint marker between last segment and closing straight line segment - */ - Geom::Matrix const m (sp_shape_marker_get_transform(*curve_it1, *curve_it2)); + Geom::Matrix const m (sp_shape_marker_get_transform_at_start(path_it->front())); + for (int i = 0; i < 3; i += 2) { // SP_MARKER_LOC and SP_MARKER_LOC_MID + if ( shape->marker[i] ) { + sp_marker_show_instance ((SPMarker* ) shape->marker[i], ai, + NR_ARENA_ITEM_GET_KEY(ai) + i, counter[i], m, + style->stroke_width.computed); + counter[i]++; + } + } + } + // MID position + if ( path_it->size_default() > 1) { + Geom::Path::const_iterator curve_it1 = path_it->begin(); // incoming curve + Geom::Path::const_iterator curve_it2 = ++(path_it->begin()); // outgoing curve + while (curve_it2 != path_it->end_default()) + { + /* Put marker between curve_it1 and curve_it2. + * Loop to end_default (so including closing segment), because when a path is closed, + * there should be a midpoint marker between last segment and closing straight line segment + */ + Geom::Matrix const m (sp_shape_marker_get_transform(*curve_it1, *curve_it2)); + for (int i = 0; i < 3; i += 2) { // SP_MARKER_LOC and SP_MARKER_LOC_MID + if (shape->marker[i]) { + sp_marker_show_instance ((SPMarker* ) shape->marker[i], ai, + NR_ARENA_ITEM_GET_KEY(ai) + i, counter[i], m, + style->stroke_width.computed); + counter[i]++; + } + } + + ++curve_it1; + ++curve_it2; + } + } + // END position + if ( path_it != (pathv.end()-1) && !path_it->empty()) { + Geom::Curve const &lastcurve = path_it->back_default(); + Geom::Matrix const m = sp_shape_marker_get_transform_at_end(lastcurve); for (int i = 0; i < 3; i += 2) { // SP_MARKER_LOC and SP_MARKER_LOC_MID if (shape->marker[i]) { sp_marker_show_instance ((SPMarker* ) shape->marker[i], ai, @@ -440,30 +479,28 @@ sp_shape_update_marker_view (SPShape *shape, NRArenaItem *ai) counter[i]++; } } - - ++curve_it1; - ++curve_it2; } } + } - // END position - if ( shape->marker[SP_MARKER_LOC_END] || shape->marker[SP_MARKER_LOC] ) { - /* Get reference to last curve in the path. - * For moveto-only path, this returns the "closing line segment". */ - unsigned int index = path_it->size_default(); - if (index > 0) { - index--; - } - Geom::Curve const &lastcurve = (*path_it)[index]; - Geom::Matrix const m = sp_shape_marker_get_transform_at_end(lastcurve); + // END marker + if ( shape->marker[SP_MARKER_LOC_END] || shape->marker[SP_MARKER_LOC] ) { + /* Get reference to last curve in the path. + * For moveto-only path, this returns the "closing line segment". */ + Geom::Path const &path_last = pathv.back(); + unsigned int index = path_last.size_default(); + if (index > 0) { + index--; + } + Geom::Curve const &lastcurve = path_last[index]; + Geom::Matrix const m = sp_shape_marker_get_transform_at_end(lastcurve); - for (int i = 0; i < 4; i += 3) { // SP_MARKER_LOC and SP_MARKER_LOC_END - if (shape->marker[i]) { - sp_marker_show_instance ((SPMarker* ) shape->marker[i], ai, - NR_ARENA_ITEM_GET_KEY(ai) + i, counter[i], m, - style->stroke_width.computed); - counter[i]++; - } + for (int i = 0; i < 4; i += 3) { // SP_MARKER_LOC and SP_MARKER_LOC_END + if (shape->marker[i]) { + sp_marker_show_instance ((SPMarker* ) shape->marker[i], ai, + NR_ARENA_ITEM_GET_KEY(ai) + i, counter[i], m, + style->stroke_width.computed); + counter[i]++; } } } @@ -522,38 +559,62 @@ static void sp_shape_bbox(SPItem const *item, NRRect *bbox, Geom::Matrix const & // Union with bboxes of the markers, if any if (sp_shape_has_markers (shape)) { - /* TODO: make code prettier: lots of variables can be taken out of the loop! */ + /** \todo make code prettier! */ Geom::PathVector const & pathv = shape->curve->get_pathvector(); - for(Geom::PathVector::const_iterator path_it = pathv.begin(); path_it != pathv.end(); ++path_it) { - for (unsigned i = 0; i < 2; i++) { // SP_MARKER_LOC and SP_MARKER_LOC_START - if ( shape->marker[i] ) { - SPMarker* marker = SP_MARKER (shape->marker[i]); - SPItem* marker_item = sp_item_first_item_child (SP_OBJECT (marker)); - - if (marker_item) { - Geom::Matrix tr(sp_shape_marker_get_transform_at_start(path_it->front())); - if (!marker->orient_auto) { - Geom::Point transl = tr.translation(); - tr = Geom::Rotate::from_degrees(marker->orient) * Geom::Translate(transl); - } - if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH) { - tr = Geom::Scale(style->stroke_width.computed) * tr; - } - - // total marker transform - tr = marker_item->transform * marker->c2p * tr * transform; - - // get bbox of the marker with that transform - NRRect marker_bbox; - sp_item_invoke_bbox (marker_item, &marker_bbox, from_2geom(tr), true); - // union it with the shape bbox - nr_rect_d_union (&cbbox, &cbbox, &marker_bbox); + // START marker + for (unsigned i = 0; i < 2; i++) { // SP_MARKER_LOC and SP_MARKER_LOC_START + if ( shape->marker[i] ) { + SPMarker* marker = SP_MARKER (shape->marker[i]); + SPItem* marker_item = sp_item_first_item_child (SP_OBJECT (marker)); + + if (marker_item) { + Geom::Matrix tr(sp_shape_marker_get_transform_at_start(pathv.begin()->front())); + if (!marker->orient_auto) { + Geom::Point transl = tr.translation(); + tr = Geom::Rotate::from_degrees(marker->orient) * Geom::Translate(transl); } + if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH) { + tr = Geom::Scale(style->stroke_width.computed) * tr; + } + + // total marker transform + tr = marker_item->transform * marker->c2p * tr * transform; + + // get bbox of the marker with that transform + NRRect marker_bbox; + sp_item_invoke_bbox (marker_item, &marker_bbox, from_2geom(tr), true); + // union it with the shape bbox + nr_rect_d_union (&cbbox, &cbbox, &marker_bbox); } } - - for (unsigned i = 0; i < 3; i += 2) { // SP_MARKER_LOC and SP_MARKER_LOC_MID - if ( shape->marker[i] && (path_it->size_default() > 1) ) { + } + // MID marker + for (unsigned i = 0; i < 3; i += 2) { // SP_MARKER_LOC and SP_MARKER_LOC_MID + SPMarker* marker = SP_MARKER (shape->marker[i]); + if ( !shape->marker[i] ) continue; + SPItem* marker_item = sp_item_first_item_child (SP_OBJECT (marker)); + if ( !marker_item ) continue; + + for(Geom::PathVector::const_iterator path_it = pathv.begin(); path_it != pathv.end(); ++path_it) { + // START position + if ( path_it != pathv.begin() + && ! ((path_it == (pathv.end()-1)) && (path_it->size_default() == 0)) ) // if this is the last path and it is a moveto-only, there is no mid marker there + { + Geom::Matrix tr(sp_shape_marker_get_transform_at_start(path_it->front())); + if (!marker->orient_auto) { + Geom::Point transl = tr.translation(); + tr = Geom::Rotate::from_degrees(marker->orient) * Geom::Translate(transl); + } + if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH) { + tr = Geom::Scale(style->stroke_width.computed) * tr; + } + tr = marker_item->transform * marker->c2p * tr * transform; + NRRect marker_bbox; + sp_item_invoke_bbox (marker_item, &marker_bbox, from_2geom(tr), true); + nr_rect_d_union (&cbbox, &cbbox, &marker_bbox); + } + // MID position + if ( path_it->size_default() > 1) { Geom::Path::const_iterator curve_it1 = path_it->begin(); // incoming curve Geom::Path::const_iterator curve_it2 = ++(path_it->begin()); // outgoing curve while (curve_it2 != path_it->end_default()) @@ -566,63 +627,75 @@ static void sp_shape_bbox(SPItem const *item, NRRect *bbox, Geom::Matrix const & SPItem* marker_item = sp_item_first_item_child (SP_OBJECT (marker)); if (marker_item) { - Geom::Matrix tr(sp_shape_marker_get_transform(*curve_it1, *curve_it2)); - if (!marker->orient_auto) { - Geom::Point transl = tr.translation(); - tr = Geom::Rotate::from_degrees(marker->orient) * Geom::Translate(transl); - } - if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH) { - tr = Geom::Scale(style->stroke_width.computed) * tr; - } - - // total marker transform - tr = marker_item->transform * marker->c2p * tr * transform; - - // get bbox of the marker with that transform - NRRect marker_bbox; - sp_item_invoke_bbox (marker_item, &marker_bbox, from_2geom(tr), true); - // union it with the shape bbox - nr_rect_d_union (&cbbox, &cbbox, &marker_bbox); + Geom::Matrix tr(sp_shape_marker_get_transform(*curve_it1, *curve_it2)); + if (!marker->orient_auto) { + Geom::Point transl = tr.translation(); + tr = Geom::Rotate::from_degrees(marker->orient) * Geom::Translate(transl); + } + if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH) { + tr = Geom::Scale(style->stroke_width.computed) * tr; + } + tr = marker_item->transform * marker->c2p * tr * transform; + NRRect marker_bbox; + sp_item_invoke_bbox (marker_item, &marker_bbox, from_2geom(tr), true); + nr_rect_d_union (&cbbox, &cbbox, &marker_bbox); } ++curve_it1; ++curve_it2; } } + // END position + if ( path_it != (pathv.end()-1) && !path_it->empty()) { + Geom::Curve const &lastcurve = path_it->back_default(); + Geom::Matrix tr = sp_shape_marker_get_transform_at_end(lastcurve); + if (!marker->orient_auto) { + Geom::Point transl = tr.translation(); + tr = Geom::Rotate::from_degrees(marker->orient) * Geom::Translate(transl); + } + if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH) { + tr = Geom::Scale(style->stroke_width.computed) * tr; + } + tr = marker_item->transform * marker->c2p * tr * transform; + NRRect marker_bbox; + sp_item_invoke_bbox (marker_item, &marker_bbox, tr, true); + nr_rect_d_union (&cbbox, &cbbox, &marker_bbox); + } } + } + // END marker + for (unsigned i = 0; i < 4; i += 3) { // SP_MARKER_LOC and SP_MARKER_LOC_END + if ( shape->marker[i] ) { + SPMarker* marker = SP_MARKER (shape->marker[i]); + SPItem* marker_item = sp_item_first_item_child (SP_OBJECT (marker)); + + if (marker_item) { + /* Get reference to last curve in the path. + * For moveto-only path, this returns the "closing line segment". */ + Geom::Path const &path_last = pathv.back(); + unsigned int index = path_last.size_default(); + if (index > 0) { + index--; + } + Geom::Curve const &lastcurve = path_last[index]; - for (unsigned i = 0; i < 4; i += 3) { // SP_MARKER_LOC and SP_MARKER_LOC_END - if ( shape->marker[i] ) { - SPMarker* marker = SP_MARKER (shape->marker[i]); - SPItem* marker_item = sp_item_first_item_child (SP_OBJECT (marker)); - - if (marker_item) { - /* Get reference to last curve in the path. - * For moveto-only path, this returns the "closing line segment". */ - unsigned int index = path_it->size_default(); - if (index > 0) { - index--; - } - Geom::Curve const &lastcurve = (*path_it)[index]; - - Geom::Matrix tr = sp_shape_marker_get_transform_at_end(lastcurve); - if (!marker->orient_auto) { - Geom::Point transl = tr.translation(); - tr = Geom::Rotate::from_degrees(marker->orient) * Geom::Translate(transl); - } - if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH) { - tr = Geom::Scale(style->stroke_width.computed) * tr; - } - - // total marker transform - tr = marker_item->transform * marker->c2p * tr * transform; - - // get bbox of the marker with that transform - NRRect marker_bbox; - sp_item_invoke_bbox (marker_item, &marker_bbox, tr, true); - // union it with the shape bbox - nr_rect_d_union (&cbbox, &cbbox, &marker_bbox); + Geom::Matrix tr = sp_shape_marker_get_transform_at_end(lastcurve); + if (!marker->orient_auto) { + Geom::Point transl = tr.translation(); + tr = Geom::Rotate::from_degrees(marker->orient) * Geom::Translate(transl); } + if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH) { + tr = Geom::Scale(style->stroke_width.computed) * tr; + } + + // total marker transform + tr = marker_item->transform * marker->c2p * tr * transform; + + // get bbox of the marker with that transform + NRRect marker_bbox; + sp_item_invoke_bbox (marker_item, &marker_bbox, tr, true); + // union it with the shape bbox + nr_rect_d_union (&cbbox, &cbbox, &marker_bbox); } } } @@ -693,57 +766,67 @@ sp_shape_print (SPItem *item, SPPrintContext *ctx) sp_print_stroke (ctx, shape->curve->get_pathvector(), &i2d, style, &pbox, &dbox, &bbox); } - /* TODO: make code prettier: lots of variables can be taken out of the loop! */ + /** \todo make code prettier */ Geom::PathVector const & pathv = shape->curve->get_pathvector(); - for(Geom::PathVector::const_iterator path_it = pathv.begin(); path_it != pathv.end(); ++path_it) { - if ( shape->marker[SP_MARKER_LOC_START] || shape->marker[SP_MARKER_LOC]) { - Geom::Matrix tr(sp_shape_marker_get_transform_at_start(path_it->front())); - if (shape->marker[SP_MARKER_LOC_START]) { - sp_shape_print_invoke_marker_printing(shape->marker[SP_MARKER_LOC_START], tr, style, ctx); - } - if (shape->marker[SP_MARKER_LOC]) { - sp_shape_print_invoke_marker_printing(shape->marker[SP_MARKER_LOC], tr, style, ctx); - } + // START marker + for (int i = 0; i < 2; i++) { // SP_MARKER_LOC and SP_MARKER_LOC_START + if ( shape->marker[i] ) { + Geom::Matrix tr(sp_shape_marker_get_transform_at_start(pathv.begin()->front())); + sp_shape_print_invoke_marker_printing(shape->marker[i], tr, style, ctx); } - - if ( (shape->marker[SP_MARKER_LOC_MID] || shape->marker[SP_MARKER_LOC]) && (path_it->size_default() > 1) ) { - Geom::Path::const_iterator curve_it1 = path_it->begin(); // incoming curve - Geom::Path::const_iterator curve_it2 = ++(path_it->begin()); // outgoing curve - while (curve_it2 != path_it->end_default()) - { - /* Put marker between curve_it1 and curve_it2. - * Loop to end_default (so including closing segment), because when a path is closed, - * there should be a midpoint marker between last segment and closing straight line segment */ - Geom::Matrix tr(sp_shape_marker_get_transform(*curve_it1, *curve_it2)); - - if (shape->marker[SP_MARKER_LOC_MID]) { - sp_shape_print_invoke_marker_printing(shape->marker[SP_MARKER_LOC_MID], tr, style, ctx); + } + // MID marker + for (int i = 0; i < 3; i += 2) { // SP_MARKER_LOC and SP_MARKER_LOC_MID + if (shape->marker[i]) { + for(Geom::PathVector::const_iterator path_it = pathv.begin(); path_it != pathv.end(); ++path_it) { + // START position + if ( path_it != pathv.begin() + && ! ((path_it == (pathv.end()-1)) && (path_it->size_default() == 0)) ) // if this is the last path and it is a moveto-only, there is no mid marker there + { + Geom::Matrix tr(sp_shape_marker_get_transform_at_start(path_it->front())); + sp_shape_print_invoke_marker_printing(shape->marker[i], tr, style, ctx); } - if (shape->marker[SP_MARKER_LOC]) { - sp_shape_print_invoke_marker_printing(shape->marker[SP_MARKER_LOC], tr, style, ctx); + // MID position + if ( path_it->size_default() > 1) { + Geom::Path::const_iterator curve_it1 = path_it->begin(); // incoming curve + Geom::Path::const_iterator curve_it2 = ++(path_it->begin()); // outgoing curve + while (curve_it2 != path_it->end_default()) + { + /* Put marker between curve_it1 and curve_it2. + * Loop to end_default (so including closing segment), because when a path is closed, + * there should be a midpoint marker between last segment and closing straight line segment */ + Geom::Matrix tr(sp_shape_marker_get_transform(*curve_it1, *curve_it2)); + + sp_shape_print_invoke_marker_printing(shape->marker[i], tr, style, ctx); + + ++curve_it1; + ++curve_it2; + } + } + if ( path_it != (pathv.end()-1) && !path_it->empty()) { + Geom::Curve const &lastcurve = path_it->back_default(); + Geom::Matrix tr = sp_shape_marker_get_transform_at_end(lastcurve); + sp_shape_print_invoke_marker_printing(shape->marker[i], tr, style, ctx); } - - ++curve_it1; - ++curve_it2; } } + } + // END marker + if ( shape->marker[SP_MARKER_LOC_END] || shape->marker[SP_MARKER_LOC]) { + /* Get reference to last curve in the path. + * For moveto-only path, this returns the "closing line segment". */ + Geom::Path const &path_last = pathv.back(); + unsigned int index = path_last.size_default(); + if (index > 0) { + index--; + } + Geom::Curve const &lastcurve = path_last[index]; - if ( shape->marker[SP_MARKER_LOC_END] || shape->marker[SP_MARKER_LOC]) { - /* Get reference to last curve in the path. - * For moveto-only path, this returns the "closing line segment". */ - unsigned int index = path_it->size_default(); - if (index > 0) { - index--; - } - Geom::Curve const &lastcurve = (*path_it)[index]; - - Geom::Matrix tr = sp_shape_marker_get_transform_at_end(lastcurve); + Geom::Matrix tr = sp_shape_marker_get_transform_at_end(lastcurve); - if (shape->marker[SP_MARKER_LOC_END]) { - sp_shape_print_invoke_marker_printing(shape->marker[SP_MARKER_LOC_END], tr, style, ctx); - } - if (shape->marker[SP_MARKER_LOC]) { - sp_shape_print_invoke_marker_printing(shape->marker[SP_MARKER_LOC], tr, style, ctx); + for (int i = 0; i < 4; i += 3) { // SP_MARKER_LOC and SP_MARKER_LOC_END + if (shape->marker[i]) { + sp_shape_print_invoke_marker_printing(shape->marker[i], tr, style, ctx); } } } @@ -863,15 +946,17 @@ int sp_shape_number_of_markers (SPShape *shape, int type) { Geom::PathVector const & pathv = shape->curve->get_pathvector(); + if (pathv.size() == 0) { + return 0; + } switch(type) { case SP_MARKER_LOC: { if ( shape->marker[SP_MARKER_LOC] ) { - guint n = 2*pathv.size(); + guint n = 0; for(Geom::PathVector::const_iterator path_it = pathv.begin(); path_it != pathv.end(); ++path_it) { - n += path_it->size(); - n += path_it->closed() ? 1 : 0; + n += path_it->size_default() + 1; } return n; } else { @@ -879,17 +964,17 @@ sp_shape_number_of_markers (SPShape *shape, int type) } } case SP_MARKER_LOC_START: - return shape->marker[SP_MARKER_LOC_START] ? pathv.size() : 0; + // there is only a start marker on the first path of a pathvector + return shape->marker[SP_MARKER_LOC_START] ? 1 : 0; case SP_MARKER_LOC_MID: { if ( shape->marker[SP_MARKER_LOC_MID] ) { - guint n = 0; + guint n = 0; for(Geom::PathVector::const_iterator path_it = pathv.begin(); path_it != pathv.end(); ++path_it) { - n += path_it->size(); - n += path_it->closed() ? 1 : 0; + n += path_it->size_default() + 1; } - return n; + return n - 2; // minus the start and end marker. } else { return 0; } @@ -897,7 +982,8 @@ sp_shape_number_of_markers (SPShape *shape, int type) case SP_MARKER_LOC_END: { - return shape->marker[SP_MARKER_LOC_END] ? pathv.size() : 0; + // there is only an end marker on the last path of a pathvector + return shape->marker[SP_MARKER_LOC_END] ? 1 : 0; } default: diff --git a/src/splivarot.cpp b/src/splivarot.cpp index feba2cab6..085dfeda0 100644 --- a/src/splivarot.cpp +++ b/src/splivarot.cpp @@ -856,19 +856,32 @@ sp_selected_path_outline(SPDesktop *desktop) SPShape *shape = SP_SHAPE(item); Geom::PathVector const & pathv = curve->get_pathvector(); - for(Geom::PathVector::const_iterator path_it = pathv.begin(); path_it != pathv.end(); ++path_it) { - for (int i = 0; i < 2; i++) { // SP_MARKER_LOC and SP_MARKER_LOC_START - if ( SPObject *marker_obj = shape->marker[i] ) { + + // START marker + for (int i = 0; i < 2; i++) { // SP_MARKER_LOC and SP_MARKER_LOC_START + if ( SPObject *marker_obj = shape->marker[i] ) { + Geom::Matrix const m (sp_shape_marker_get_transform_at_start(pathv.front().front())); + sp_selected_path_outline_add_marker( marker_obj, m, + Geom::Scale(i_style->stroke_width.computed), transform, + g_repr, xml_doc, doc ); + } + } + // MID marker + for (int i = 0; i < 3; i += 2) { // SP_MARKER_LOC and SP_MARKER_LOC_MID + SPObject *midmarker_obj = shape->marker[i]; + if (!midmarker_obj) continue; + for(Geom::PathVector::const_iterator path_it = pathv.begin(); path_it != pathv.end(); ++path_it) { + // START position + if ( path_it != pathv.begin() + && ! ((path_it == (pathv.end()-1)) && (path_it->size_default() == 0)) ) // if this is the last path and it is a moveto-only, there is no mid marker there + { Geom::Matrix const m (sp_shape_marker_get_transform_at_start(path_it->front())); - sp_selected_path_outline_add_marker( marker_obj, m, + sp_selected_path_outline_add_marker( midmarker_obj, m, Geom::Scale(i_style->stroke_width.computed), transform, g_repr, xml_doc, doc ); } - } - - for (int i = 0; i < 3; i += 2) { // SP_MARKER_LOC and SP_MARKER_LOC_MID - SPObject *midmarker_obj = shape->marker[i]; - if ( midmarker_obj && (path_it->size_default() > 1) ) { + // MID position + if (path_it->size_default() > 1) { Geom::Path::const_iterator curve_it1 = path_it->begin(); // incoming curve Geom::Path::const_iterator curve_it2 = ++(path_it->begin()); // outgoing curve while (curve_it2 != path_it->end_default()) @@ -886,25 +899,34 @@ sp_selected_path_outline(SPDesktop *desktop) ++curve_it2; } } - } - - for (int i = 0; i < 4; i += 3) { // SP_MARKER_LOC and SP_MARKER_LOC_END - if ( SPObject *marker_obj = shape->marker[i] ) { - /* Get reference to last curve in the path. - * For moveto-only path, this returns the "closing line segment". */ - unsigned int index = path_it->size_default(); - if (index > 0) { - index--; - } - Geom::Curve const &lastcurve = (*path_it)[index]; - + // END position + if ( path_it != (pathv.end()-1) && !path_it->empty()) { + Geom::Curve const &lastcurve = path_it->back_default(); Geom::Matrix const m = sp_shape_marker_get_transform_at_end(lastcurve); - sp_selected_path_outline_add_marker( marker_obj, m, + sp_selected_path_outline_add_marker( midmarker_obj, m, Geom::Scale(i_style->stroke_width.computed), transform, g_repr, xml_doc, doc ); } } } + // END marker + for (int i = 0; i < 4; i += 3) { // SP_MARKER_LOC and SP_MARKER_LOC_END + if ( SPObject *marker_obj = shape->marker[i] ) { + /* Get reference to last curve in the path. + * For moveto-only path, this returns the "closing line segment". */ + Geom::Path const &path_last = pathv.back(); + unsigned int index = path_last.size_default(); + if (index > 0) { + index--; + } + Geom::Curve const &lastcurve = path_last[index]; + + Geom::Matrix const m = sp_shape_marker_get_transform_at_end(lastcurve); + sp_selected_path_outline_add_marker( marker_obj, m, + Geom::Scale(i_style->stroke_width.computed), transform, + g_repr, xml_doc, doc ); + } + } selection->add(g_repr); -- cgit v1.2.3 From f8320ca81e834951f4fb9b3d4dcf48f2db5d6fc3 Mon Sep 17 00:00:00 2001 From: bulia byak Date: Mon, 9 Nov 2009 17:14:07 +0000 Subject: regression patch from 388257 (bzr r8826) --- src/extension/internal/cairo-render-context.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/extension/internal/cairo-render-context.cpp b/src/extension/internal/cairo-render-context.cpp index 721d3addc..023a9b837 100644 --- a/src/extension/internal/cairo-render-context.cpp +++ b/src/extension/internal/cairo-render-context.cpp @@ -1541,17 +1541,14 @@ CairoRenderContext::renderGlyphtext(PangoFont *font, Geom::Matrix const *font_ma } else { bool fill = false, stroke = false, have_path = false; if (style->fill.isColor() || style->fill.isPaintserver()) { - // set fill style - _setFillStyle(style, NULL); fill = true; } if (style->stroke.isColor() || style->stroke.isPaintserver()) { - // set stroke style - _setStrokeStyle(style, NULL); stroke = true; } if (fill) { + _setFillStyle(style, NULL); if (_is_texttopath) { _showGlyphs(_cr, font, glyphtext, true); have_path = true; @@ -1562,6 +1559,7 @@ CairoRenderContext::renderGlyphtext(PangoFont *font, Geom::Matrix const *font_ma } } if (stroke) { + _setStrokeStyle(style, NULL); if (!have_path) _showGlyphs(_cr, font, glyphtext, true); cairo_stroke(_cr); } -- cgit v1.2.3 From ef0a6a40cbad39f2a94c95c94d977b199dddfebf Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Mon, 9 Nov 2009 17:58:28 +0000 Subject: Migrate file MRU prefs (bzr r8827) --- src/inkscape.cpp | 1 + src/preferences.cpp | 151 ++++++++++++++++++++++++++++++++++++++++++---------- src/preferences.h | 6 +++ 3 files changed, 131 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/inkscape.cpp b/src/inkscape.cpp index 586abd22b..8506f05de 100644 --- a/src/inkscape.cpp +++ b/src/inkscape.cpp @@ -1457,6 +1457,7 @@ profile_path(const char *filename) if (needsMigration) { // TODO here is a point to hook in preference migration g_warning("Preferences need to be migrated from 0.46 or older %s to %s", legacyDir, prefdir); + Inkscape::Preferences::migrate( legacyDir, prefdir ); } bool needsRenameWarning = ( !Inkscape::IO::file_test( prefdir, G_FILE_TEST_EXISTS ) && Inkscape::IO::file_test( dev47Dir, G_FILE_TEST_EXISTS ) ); diff --git a/src/preferences.cpp b/src/preferences.cpp index cb71e03b2..d4d67837b 100644 --- a/src/preferences.cpp +++ b/src/preferences.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include "preferences.h" #include "preferences-skeleton.h" #include "inkscape.h" @@ -26,6 +27,34 @@ namespace Inkscape { +static Inkscape::XML::Document *loadImpl( std::string const& prefsFilename, Glib::ustring & errMsg ); +static void migrateDetails( Inkscape::XML::Document *from, Inkscape::XML::Document *to ); + +static Inkscape::XML::Document *migrateFromDoc = 0; + +// TODO clean up. Function copied from file.cpp: +// what gets passed here is not actually an URI... it is an UTF-8 encoded filename (!) +static void file_add_recent(gchar const *uri) +{ + if (!uri) { + g_warning("file_add_recent: uri == NULL"); + } else { + GtkRecentManager *recent = gtk_recent_manager_get_default(); + gchar *fn = g_filename_from_utf8(uri, -1, NULL, NULL, NULL); + if (fn) { + if (g_file_test(fn, G_FILE_TEST_EXISTS)) { + gchar *uriToAdd = g_filename_to_uri(fn, NULL, NULL); + if (uriToAdd) { + gtk_recent_manager_add_item(recent, uriToAdd); + g_free(uriToAdd); + } + } + g_free(fn); + } + } +} + + // private inner class definition /** @@ -47,7 +76,6 @@ private: Glib::ustring const _filter; }; - Preferences::Preferences() : _prefs_basename(PREFERENCES_FILE_NAME), _prefs_dir(""), @@ -156,58 +184,72 @@ void Preferences::_load() } // Yes, the pref file exists. + Glib::ustring errMsg; + Inkscape::XML::Document *prefs_read = loadImpl( _prefs_filename, errMsg ); + + if ( prefs_read ) { + if ( migrateFromDoc ) { + migrateDetails( migrateFromDoc, _prefs_doc ); + } + // Merge the loaded prefs with defaults. + _prefs_doc->root()->mergeFrom(prefs_read->root(), "id"); + Inkscape::GC::release(prefs_read); + _writable = true; + } else { + _reportError(errMsg, not_saved); + } +} + +//_reportError(msg, not_saved); +static Inkscape::XML::Document *loadImpl( std::string const& prefsFilename, Glib::ustring & errMsg ) +{ // 2. Is it a regular file? - if (!g_file_test(_prefs_filename.data(), G_FILE_TEST_IS_REGULAR)) { - //_reportError(Glib::ustring::compose(_("The preferences file %1 is not a regular file."), - // Glib::filename_to_utf8(_prefs_filename)), not_saved); + if (!g_file_test(prefsFilename.data(), G_FILE_TEST_IS_REGULAR)) { gchar *msg = g_strdup_printf(_("The preferences file %s is not a regular file."), - Glib::filename_to_utf8(_prefs_filename).data()); - _reportError(msg, not_saved); + Glib::filename_to_utf8(prefsFilename).data()); + errMsg = msg; g_free(msg); - return; + return 0; } // 3. Is the file readable? gchar *prefs_xml = NULL; gsize len = 0; - if (!g_file_get_contents(_prefs_filename.data(), &prefs_xml, &len, NULL)) { - //_reportError(Glib::ustring::compose(_("The preferences file %1 could not be read."), - // Glib::filename_to_utf8(_prefs_filename)), not_saved); + if (!g_file_get_contents(prefsFilename.data(), &prefs_xml, &len, NULL)) { gchar *msg = g_strdup_printf(_("The preferences file %s could not be read."), - Glib::filename_to_utf8(_prefs_filename).data()); - _reportError(msg, not_saved); + Glib::filename_to_utf8(prefsFilename).data()); + errMsg = msg; g_free(msg); - return; + return 0; } // 4. Is it valid XML? Inkscape::XML::Document *prefs_read = sp_repr_read_mem(prefs_xml, len, NULL); g_free(prefs_xml); if (!prefs_read) { - //_reportError(Glib::ustring::compose(_("The preferences file %1 is not a valid XML document."), - // Glib::filename_to_utf8(_prefs_filename)), not_saved); gchar *msg = g_strdup_printf(_("The preferences file %s is not a valid XML document."), - Glib::filename_to_utf8(_prefs_filename).data()); - _reportError(msg, not_saved); + Glib::filename_to_utf8(prefsFilename).data()); + errMsg = msg; g_free(msg); - return; + return 0; } // 5. Basic sanity check: does the root element have a correct name? if (strcmp(prefs_read->root()->name(), "inkscape")) { - //_reportError(Glib::ustring::compose(_("The file %1 is not a valid Inkscape preferences file."), - // Glib::filename_to_utf8(_prefs_filename)), not_saved); gchar *msg = g_strdup_printf(_("The file %s is not a valid Inkscape preferences file."), - Glib::filename_to_utf8(_prefs_filename).data()); - _reportError(msg, not_saved); + Glib::filename_to_utf8(prefsFilename).data()); + errMsg = msg; g_free(msg); Inkscape::GC::release(prefs_read); - return; + return 0; } - // Merge the loaded prefs with defaults. - _prefs_doc->root()->mergeFrom(prefs_read->root(), "id"); - Inkscape::GC::release(prefs_read); - _writable = true; + return prefs_read; +} + +static void migrateDetails( Inkscape::XML::Document *from, Inkscape::XML::Document *to ) +{ + // TODO pull in additional prefs with more granularity + to->root()->mergeFrom(from->root(), "id"); } /** @@ -252,6 +294,61 @@ bool Preferences::getLastError( Glib::ustring& primary, Glib::ustring& secondary return result; } +void Preferences::migrate( std::string const& legacyDir, std::string const& prefdir ) +{ + int mode = S_IRWXU; +#ifdef S_IRGRP + mode |= S_IRGRP; +#endif +#ifdef S_IXGRP + mode |= S_IXGRP; +#endif +#ifdef S_IXOTH + mode |= S_IXOTH; +#endif + if ( g_mkdir_with_parents(prefdir.data(), mode) == -1 ) { + } else { + } + + gchar * oldPrefFile = g_build_filename(legacyDir.data(), PREFERENCES_FILE_NAME, NULL); + if (oldPrefFile) { + if (g_file_test(oldPrefFile, G_FILE_TEST_EXISTS)) { + Glib::ustring errMsg; + Inkscape::XML::Document *oldPrefs = loadImpl( oldPrefFile, errMsg ); + if (oldPrefs) { + Glib::ustring docId("documents"); + Glib::ustring recentId("recent"); + Inkscape::XML::Node *node = oldPrefs->root(); + Inkscape::XML::Node *child = NULL; + for (child = node->firstChild(); child; child = child->next()) { + if (docId == child->attribute("id")) { + for (child = child->firstChild(); child; child = child->next()) { + if (recentId == child->attribute("id")) { + for (child = child->firstChild(); child; child = child->next()) { + gchar const* uri = child->attribute("uri"); + if (uri) { + file_add_recent(uri); + } + } + break; + } + } + break; + } + } + + migrateFromDoc = oldPrefs; + //Inkscape::GC::release(oldPrefs); + oldPrefs = 0; + } else { + g_warning( "%s", errMsg.c_str() ); + } + } + g_free(oldPrefFile); + oldPrefFile = 0; + } +} + // Now for the meat. /** diff --git a/src/preferences.h b/src/preferences.h index d8706a501..a7be08009 100644 --- a/src/preferences.h +++ b/src/preferences.h @@ -420,6 +420,12 @@ public: * @{ */ + + /** + * Copies values from old location to new. + */ + static void migrate( std::string const& legacyDir, std::string const& prefdir ); + /** * @brief Access the singleton Preferences object. */ -- cgit v1.2.3 From 848ad66977870874b3dbbc441376f6f55fdcdef1 Mon Sep 17 00:00:00 2001 From: Josh Andler Date: Mon, 9 Nov 2009 21:37:25 +0000 Subject: Comment out non-functioning menu item (bzr r8828) --- src/menus-skeleton.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/menus-skeleton.h b/src/menus-skeleton.h index c4a789e48..d7a18f211 100644 --- a/src/menus-skeleton.h +++ b/src/menus-skeleton.h @@ -124,7 +124,7 @@ static char const menus_skeleton[] = " \n" " \n" " \n" -" \n" +//" \n" " \n" " \n" " \n" -- cgit v1.2.3 From 77c6c3e159eaf8d10a3aee72756bddb197d707cd Mon Sep 17 00:00:00 2001 From: Josh Andler Date: Mon, 9 Nov 2009 21:52:06 +0000 Subject: Patch by Adib for 271695 (bzr r8829) --- src/extension/internal/cairo-render-context.cpp | 44 ++++++++++++++++++------- src/extension/internal/cairo-render-context.h | 3 ++ 2 files changed, 35 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/extension/internal/cairo-render-context.cpp b/src/extension/internal/cairo-render-context.cpp index 023a9b837..c33beab8a 100644 --- a/src/extension/internal/cairo-render-context.cpp +++ b/src/extension/internal/cairo-render-context.cpp @@ -125,14 +125,27 @@ CairoRenderContext::CairoRenderContext(CairoRenderer *parent) : _renderer(parent), _render_mode(RENDER_MODE_NORMAL), _clip_mode(CLIP_MODE_MASK) -{} +{ + font_table = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, font_data_free); +} CairoRenderContext::~CairoRenderContext(void) { + if(font_table != NULL) { + g_hash_table_remove_all(font_table); + } + if (_cr) cairo_destroy(_cr); if (_surface) cairo_surface_destroy(_surface); if (_layout) g_object_unref(_layout); } +void CairoRenderContext::font_data_free(gpointer data) +{ + cairo_font_face_t *font_face = (cairo_font_face_t *)data; + if (font_face) { + cairo_font_face_destroy(font_face); + } +} CairoRenderer* CairoRenderContext::getRenderer(void) const @@ -612,7 +625,7 @@ CairoRenderContext::popLayer(void) // copy over the correct CTM // It must be stored in item_transform of current state after pushState. - Geom::Matrix item_transform; + Geom::Matrix item_transform; if (_state->parent_has_userspace) item_transform = getParentState()->transform * _state->item_transform; else @@ -1015,7 +1028,7 @@ CairoRenderContext::_createPatternPainter(SPPaintServer const *const paintserver } - // Calculate the size of the surface which has to be created + // Calculate the size of the surface which has to be created #define SUBPIX_SCALE 100 // Cairo requires an integer pattern surface width/height. // Subtract 0.5 to prevent small rounding errors from increasing pattern size by one pixel. @@ -1323,7 +1336,7 @@ CairoRenderContext::renderPathVector(Geom::PathVector const & pathv, SPStyle con } bool no_fill = style->fill.isNone() || style->fill_opacity.value == 0; - bool no_stroke = style->stroke.isNone() || style->stroke_width.computed < 1e-9 || + bool no_stroke = style->stroke.isNone() || style->stroke_width.computed < 1e-9 || style->stroke_opacity.value == 0; if (no_fill && no_stroke) @@ -1492,10 +1505,11 @@ CairoRenderContext::renderGlyphtext(PangoFont *font, Geom::Matrix const *font_ma { // create a cairo_font_face from PangoFont double size = style->font_size.computed; - cairo_font_face_t *font_face = NULL; + gpointer fonthash = (gpointer)font; + cairo_font_face_t *font_face = (cairo_font_face_t *)g_hash_table_lookup(font_table, fonthash); FcPattern *fc_pattern = NULL; - + #ifdef USE_PANGO_WIN32 # ifdef CAIRO_HAS_WIN32_FONT LOGFONTA *lfa = pango_win32_font_logfont(font); @@ -1504,17 +1518,23 @@ CairoRenderContext::renderGlyphtext(PangoFont *font, Geom::Matrix const *font_ma ZeroMemory(&lfw, sizeof(LOGFONTW)); memcpy(&lfw, lfa, sizeof(LOGFONTA)); MultiByteToWideChar(CP_OEMCP, MB_PRECOMPOSED, lfa->lfFaceName, LF_FACESIZE, lfw.lfFaceName, LF_FACESIZE); - - font_face = cairo_win32_font_face_create_for_logfontw(&lfw); + + if(font_face == NULL) { + font_face = cairo_win32_font_face_create_for_logfontw(&lfw); + g_hash_table_insert(font_table, fonthash, font_face); + } # endif #else # ifdef CAIRO_HAS_FT_FONT PangoFcFont *fc_font = PANGO_FC_FONT(font); fc_pattern = fc_font->font_pattern; - font_face = cairo_ft_font_face_create_for_pattern(fc_pattern); + if(font_face == NULL) { + font_face = cairo_ft_font_face_create_for_pattern(fc_pattern); + g_hash_table_insert(font_table, fonthash, font_face); + } # endif #endif - + cairo_save(_cr); cairo_set_font_face(_cr, font_face); @@ -1567,8 +1587,8 @@ CairoRenderContext::renderGlyphtext(PangoFont *font, Geom::Matrix const *font_ma cairo_restore(_cr); - if (font_face) - cairo_font_face_destroy(font_face); +// if (font_face) +// cairo_font_face_destroy(font_face); return true; } diff --git a/src/extension/internal/cairo-render-context.h b/src/extension/internal/cairo-render-context.h index 930668e03..e6f2d698e 100644 --- a/src/extension/internal/cairo-render-context.h +++ b/src/extension/internal/cairo-render-context.h @@ -195,6 +195,9 @@ protected: void _concatTransform(cairo_t *cr, double xx, double yx, double xy, double yy, double x0, double y0); void _concatTransform(cairo_t *cr, Geom::Matrix const *transform); + GHashTable *font_table; + static void font_data_free(gpointer data); + CairoRenderState *_createState(void); }; -- cgit v1.2.3 From 1263bbdf686287a74fdd52e8036b38411492a13e Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Tue, 10 Nov 2009 02:29:49 +0000 Subject: Fixed copying of old settings, along with some data() vs. c_str() cleanup. Fixes bug #437929. (bzr r8831) --- src/preferences.cpp | 65 +++++++++++++++++++++++++++++++---------------------- 1 file changed, 38 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/preferences.cpp b/src/preferences.cpp index d4d67837b..39a9e4d69 100644 --- a/src/preferences.cpp +++ b/src/preferences.cpp @@ -90,7 +90,7 @@ Preferences::Preferences() : _prefs_dir = path; g_free(path); - path = profile_path(_prefs_basename.data()); + path = profile_path(_prefs_basename.c_str()); _prefs_filename = path; g_free(path); @@ -132,17 +132,17 @@ void Preferences::_load() // NOTE: After we upgrade to Glib 2.16, use Glib::ustring::compose // 1. Does the file exist? - if (!g_file_test(_prefs_filename.data(), G_FILE_TEST_EXISTS)) { + if (!g_file_test(_prefs_filename.c_str(), G_FILE_TEST_EXISTS)) { // No - we need to create one. // Does the profile directory exist? - if (!g_file_test(_prefs_dir.data(), G_FILE_TEST_EXISTS)) { + if (!g_file_test(_prefs_dir.c_str(), G_FILE_TEST_EXISTS)) { // No - create the profile directory - if (g_mkdir(_prefs_dir.data(), 0755)) { + if (g_mkdir(_prefs_dir.c_str(), 0755)) { // the creation failed //_reportError(Glib::ustring::compose(_("Cannot create profile directory %1."), // Glib::filename_to_utf8(_prefs_dir)), not_saved); gchar *msg = g_strdup_printf(_("Cannot create profile directory %s."), - Glib::filename_to_utf8(_prefs_dir).data()); + Glib::filename_to_utf8(_prefs_dir).c_str()); _reportError(msg, not_saved); g_free(msg); return; @@ -155,28 +155,32 @@ void Preferences::_load() g_free(dir); } - } else if (!g_file_test(_prefs_dir.data(), G_FILE_TEST_IS_DIR)) { + } else if (!g_file_test(_prefs_dir.c_str(), G_FILE_TEST_IS_DIR)) { // The profile dir is not actually a directory //_reportError(Glib::ustring::compose(_("%1 is not a valid directory."), // Glib::filename_to_utf8(_prefs_dir)), not_saved); gchar *msg = g_strdup_printf(_("%s is not a valid directory."), - Glib::filename_to_utf8(_prefs_dir).data()); + Glib::filename_to_utf8(_prefs_dir).c_str()); _reportError(msg, not_saved); g_free(msg); return; } // The profile dir exists and is valid. - if (!g_file_set_contents(_prefs_filename.data(), preferences_skeleton, PREFERENCES_SKELETON_SIZE, NULL)) { + if (!g_file_set_contents(_prefs_filename.c_str(), preferences_skeleton, PREFERENCES_SKELETON_SIZE, NULL)) { // The write failed. //_reportError(Glib::ustring::compose(_("Failed to create the preferences file %1."), // Glib::filename_to_utf8(_prefs_filename)), not_saved); gchar *msg = g_strdup_printf(_("Failed to create the preferences file %s."), - Glib::filename_to_utf8(_prefs_filename).data()); + Glib::filename_to_utf8(_prefs_filename).c_str()); _reportError(msg, not_saved); g_free(msg); return; } + if ( migrateFromDoc ) { + migrateDetails( migrateFromDoc, _prefs_doc ); + } + // The prefs file was just created. // We can return now and skip the rest of the load process. _writable = true; @@ -188,9 +192,6 @@ void Preferences::_load() Inkscape::XML::Document *prefs_read = loadImpl( _prefs_filename, errMsg ); if ( prefs_read ) { - if ( migrateFromDoc ) { - migrateDetails( migrateFromDoc, _prefs_doc ); - } // Merge the loaded prefs with defaults. _prefs_doc->root()->mergeFrom(prefs_read->root(), "id"); Inkscape::GC::release(prefs_read); @@ -204,9 +205,9 @@ void Preferences::_load() static Inkscape::XML::Document *loadImpl( std::string const& prefsFilename, Glib::ustring & errMsg ) { // 2. Is it a regular file? - if (!g_file_test(prefsFilename.data(), G_FILE_TEST_IS_REGULAR)) { + if (!g_file_test(prefsFilename.c_str(), G_FILE_TEST_IS_REGULAR)) { gchar *msg = g_strdup_printf(_("The preferences file %s is not a regular file."), - Glib::filename_to_utf8(prefsFilename).data()); + Glib::filename_to_utf8(prefsFilename).c_str()); errMsg = msg; g_free(msg); return 0; @@ -214,9 +215,9 @@ static Inkscape::XML::Document *loadImpl( std::string const& prefsFilename, Glib // 3. Is the file readable? gchar *prefs_xml = NULL; gsize len = 0; - if (!g_file_get_contents(prefsFilename.data(), &prefs_xml, &len, NULL)) { + if (!g_file_get_contents(prefsFilename.c_str(), &prefs_xml, &len, NULL)) { gchar *msg = g_strdup_printf(_("The preferences file %s could not be read."), - Glib::filename_to_utf8(prefsFilename).data()); + Glib::filename_to_utf8(prefsFilename).c_str()); errMsg = msg; g_free(msg); return 0; @@ -227,7 +228,7 @@ static Inkscape::XML::Document *loadImpl( std::string const& prefsFilename, Glib g_free(prefs_xml); if (!prefs_read) { gchar *msg = g_strdup_printf(_("The preferences file %s is not a valid XML document."), - Glib::filename_to_utf8(prefsFilename).data()); + Glib::filename_to_utf8(prefsFilename).c_str()); errMsg = msg; g_free(msg); return 0; @@ -236,7 +237,7 @@ static Inkscape::XML::Document *loadImpl( std::string const& prefsFilename, Glib // 5. Basic sanity check: does the root element have a correct name? if (strcmp(prefs_read->root()->name(), "inkscape")) { gchar *msg = g_strdup_printf(_("The file %s is not a valid Inkscape preferences file."), - Glib::filename_to_utf8(prefsFilename).data()); + Glib::filename_to_utf8(prefsFilename).c_str()); errMsg = msg; g_free(msg); Inkscape::GC::release(prefs_read); @@ -273,7 +274,7 @@ void Preferences::save() // There are many other factors, so ask if you would like to learn them. - JAC Glib::ustring utf8name = Glib::filename_to_utf8(_prefs_filename); if (!utf8name.empty()) { - sp_repr_save_file(_prefs_doc, utf8name.data()); + sp_repr_save_file(_prefs_doc, utf8name.c_str()); } } } @@ -306,11 +307,11 @@ void Preferences::migrate( std::string const& legacyDir, std::string const& pref #ifdef S_IXOTH mode |= S_IXOTH; #endif - if ( g_mkdir_with_parents(prefdir.data(), mode) == -1 ) { + if ( g_mkdir_with_parents(prefdir.c_str(), mode) == -1 ) { } else { } - gchar * oldPrefFile = g_build_filename(legacyDir.data(), PREFERENCES_FILE_NAME, NULL); + gchar * oldPrefFile = g_build_filename(legacyDir.c_str(), PREFERENCES_FILE_NAME, NULL); if (oldPrefFile) { if (g_file_test(oldPrefFile, G_FILE_TEST_EXISTS)) { Glib::ustring errMsg; @@ -319,11 +320,16 @@ void Preferences::migrate( std::string const& legacyDir, std::string const& pref Glib::ustring docId("documents"); Glib::ustring recentId("recent"); Inkscape::XML::Node *node = oldPrefs->root(); - Inkscape::XML::Node *child = NULL; + Inkscape::XML::Node *child = 0; + Inkscape::XML::Node *recentNode = 0; + if (node->attribute("version")) { + node->setAttribute("version", "1"); + } for (child = node->firstChild(); child; child = child->next()) { if (docId == child->attribute("id")) { for (child = child->firstChild(); child; child = child->next()) { if (recentId == child->attribute("id")) { + recentNode = child; for (child = child->firstChild(); child; child = child->next()) { gchar const* uri = child->attribute("uri"); if (uri) { @@ -337,6 +343,11 @@ void Preferences::migrate( std::string const& legacyDir, std::string const& pref } } + if (recentNode) { + while (recentNode->firstChild()) { + recentNode->removeChild(recentNode->firstChild()); + } + } migrateFromDoc = oldPrefs; //Inkscape::GC::release(oldPrefs); oldPrefs = 0; @@ -442,7 +453,7 @@ void Preferences::setDouble(Glib::ustring const &pref_path, double value) */ void Preferences::setString(Glib::ustring const &pref_path, Glib::ustring const &value) { - _setRawValue(pref_path, value.data()); + _setRawValue(pref_path, value.c_str()); } void Preferences::setStyle(Glib::ustring const &pref_path, SPCSSAttr *style) @@ -612,7 +623,7 @@ Inkscape::XML::Node *Preferences::_getNode(Glib::ustring const &pref_key, bool c Inkscape::XML::Node *node = _prefs_doc->root(); Inkscape::XML::Node *child = NULL; - gchar **splits = g_strsplit(pref_key.data(), "/", 0); + gchar **splits = g_strsplit(pref_key.c_str(), "/", 0); if ( splits ) { for (int part_i = 0; splits[part_i]; ++part_i) { @@ -665,7 +676,7 @@ void Preferences::_getRawValue(Glib::ustring const &path, gchar const *&result) if ( node == NULL ) { result = NULL; } else { - gchar const *attr = node->attribute(attr_key.data()); + gchar const *attr = node->attribute(attr_key.c_str()); if ( attr == NULL ) { result = NULL; } else { @@ -682,7 +693,7 @@ void Preferences::_setRawValue(Glib::ustring const &path, gchar const *value) // set the attribute Inkscape::XML::Node *node = _getNode(node_key, true); - node->setAttribute(attr_key.data(), value); + node->setAttribute(attr_key.c_str(), value); } // The _extract* methods are where the actual wrok is done - they define how preferences are stored @@ -737,7 +748,7 @@ SPCSSAttr *Preferences::_extractInheritedStyle(Entry const &v) _keySplit(v._pref_path, node_key, attr_key); Inkscape::XML::Node *node = _getNode(node_key, false); - return sp_repr_css_attr_inherited(node, attr_key.data()); + return sp_repr_css_attr_inherited(node, attr_key.c_str()); } // XML backend helper: Split the path into a node key and an attribute key. -- cgit v1.2.3 From 7b19c82f7ff220b7962d201739c0d2f3e2e6be74 Mon Sep 17 00:00:00 2001 From: Thomas Holder Date: Mon, 23 Nov 2009 19:31:42 +0000 Subject: fix bug 427267, single dots inside transformed groups misplaced (bzr r8835) --- src/draw-context.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/draw-context.cpp b/src/draw-context.cpp index d2794f0c2..de9a7c7e5 100644 --- a/src/draw-context.cpp +++ b/src/draw-context.cpp @@ -841,7 +841,7 @@ void spdc_create_single_dot(SPEventContext *ec, Geom::Point const &pt, char cons Inkscape::Preferences *prefs = Inkscape::Preferences::get(); Geom::Matrix const i2d (sp_item_i2d_affine (item)); - Geom::Point pp = pt * i2d; + Geom::Point pp = pt; double rad = 0.5 * prefs->getDouble(tool_path + "/dot-size", 3.0); if (event_state & GDK_MOD1_MASK) { /* TODO: We vary the dot size between 0.5*rad and 1.5*rad, where rad is the dot size @@ -860,6 +860,7 @@ void spdc_create_single_dot(SPEventContext *ec, Geom::Point const &pt, char cons sp_repr_set_svg_double (repr, "sodipodi:rx", rad * stroke_width); sp_repr_set_svg_double (repr, "sodipodi:ry", rad * stroke_width); item->updateRepr(); + sp_item_set_item_transform(item, i2d.inverse()); sp_desktop_selection(desktop)->set(item); -- cgit v1.2.3 From ca042d328590b13696c0cef7494690ebb904cb35 Mon Sep 17 00:00:00 2001 From: Thomas Holder Date: Mon, 23 Nov 2009 20:21:00 +0000 Subject: fix bug 168663, marker shifted wrong by viewBox (bzr r8836) --- src/marker.cpp | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/marker.cpp b/src/marker.cpp index c66acc192..e4c2e0c30 100644 --- a/src/marker.cpp +++ b/src/marker.cpp @@ -440,22 +440,9 @@ sp_marker_update (SPObject *object, SPCtx *ctx, guint flags) } } - { - Geom::Matrix q; - /* Compose additional transformation from scale and position */ - q[0] = width / vb.width(); - q[1] = 0.0; - q[2] = 0.0; - q[3] = height / vb.height(); - q[4] = -vb.min()[Geom::X] * q[0] + x; - q[5] = -vb.min()[Geom::Y] * q[3] + y; - /* Append viewbox transformation */ - marker->c2p = q * marker->c2p; - } - - /* Append reference translation */ - /* fixme: lala (Lauris) */ - marker->c2p = Geom::Translate(-marker->refX.computed, -marker->refY.computed) * marker->c2p; + // viewbox transformation and reference translation + marker->c2p = Geom::Translate(-marker->refX.computed, -marker->refY.computed) * + Geom::Scale(width / vb.width(), height / vb.height()); rctx.i2doc = marker->c2p * rctx.i2doc; -- cgit v1.2.3 From 8c8294eb59581ba671d185ac72ef072024ff9f9d Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Mon, 23 Nov 2009 20:31:26 +0000 Subject: fix bug 379378 (bzr r8837) --- src/ui/dialog/livepatheffect-editor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp index dd2dc8250..dec437be9 100644 --- a/src/ui/dialog/livepatheffect-editor.cpp +++ b/src/ui/dialog/livepatheffect-editor.cpp @@ -305,7 +305,7 @@ LivePathEffectEditor::effect_list_reload(SPLPEItem *lpeitem) row[columns.col_visible] = (*it)->lpeobject->get_lpe()->isVisible(); } else { Gtk::TreeModel::Row row = *(effectlist_store->append()); - row[columns.col_name] = "Unknown effect!"; + row[columns.col_name] = _("Unknown effect"); row[columns.lperef] = *it; row[columns.col_visible] = false; } -- cgit v1.2.3 From 8c1bebebcb819658b21ee33419361f991ad08da2 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Mon, 23 Nov 2009 20:36:50 +0000 Subject: add LPE extrude. it's not finished yet! (bzr r8838) --- src/live_effects/effect-enum.h | 1 + src/live_effects/effect.cpp | 5 ++ src/live_effects/lpe-extrude.cpp | 145 +++++++++++++++++++++++++++++++++++++++ src/live_effects/lpe-extrude.h | 52 ++++++++++++++ 4 files changed, 203 insertions(+) create mode 100644 src/live_effects/lpe-extrude.cpp create mode 100644 src/live_effects/lpe-extrude.h (limited to 'src') diff --git a/src/live_effects/effect-enum.h b/src/live_effects/effect-enum.h index 1911c6e20..6f1004ae5 100644 --- a/src/live_effects/effect-enum.h +++ b/src/live_effects/effect-enum.h @@ -47,6 +47,7 @@ enum EffectType { DOEFFECTSTACK_TEST, DYNASTROKE, RECURSIVE_SKELETON, + EXTRUDE, INVALID_LPE // This must be last (I made it such that it is not needed anymore I think..., Don't trust on it being last. - johan) }; diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index 1d001b31a..04549622e 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -74,6 +74,7 @@ #include "live_effects/lpe-path_length.h" #include "live_effects/lpe-line_segment.h" #include "live_effects/lpe-recursiveskeleton.h" +#include "live_effects/lpe-extrude.h" namespace Inkscape { @@ -90,6 +91,7 @@ const Util::EnumData LPETypeData[] = { {CIRCLE_WITH_RADIUS, N_("Circle (by center and radius)"), "circle_with_radius"}, {CIRCLE_3PTS, N_("Circle by 3 points"), "circle_3pts"}, {DYNASTROKE, N_("Dynamic stroke"), "dynastroke"}, + {EXTRUDE, N_("Extrude"), "extrude"}, {LATTICE, N_("Lattice Deformation"), "lattice"}, {LINE_SEGMENT, N_("Line Segment"), "line_segment"}, {MIRROR_SYMMETRY, N_("Mirror symmetry"), "mirror_symmetry"}, @@ -232,6 +234,9 @@ Effect::New(EffectType lpenr, LivePathEffectObject *lpeobj) case RECURSIVE_SKELETON: neweffect = static_cast ( new LPERecursiveSkeleton(lpeobj) ); break; + case EXTRUDE: + neweffect = static_cast ( new LPEExtrude(lpeobj) ); + break; default: g_warning("LivePathEffect::Effect::New called with invalid patheffect type (%d)", lpenr); neweffect = NULL; diff --git a/src/live_effects/lpe-extrude.cpp b/src/live_effects/lpe-extrude.cpp new file mode 100644 index 000000000..93ab60fc5 --- /dev/null +++ b/src/live_effects/lpe-extrude.cpp @@ -0,0 +1,145 @@ +#define INKSCAPE_LPE_EXTRUDE_CPP +/** \file + * @brief LPE effect for extruding paths (making them "3D"). + * + */ +/* Authors: + * Johan Engelen + * + * Copyright (C) 2009 Authors + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "live_effects/lpe-extrude.h" + +#include <2geom/path.h> +#include <2geom/piecewise.h> +#include <2geom/transforms.h> + +namespace Inkscape { +namespace LivePathEffect { + +LPEExtrude::LPEExtrude(LivePathEffectObject *lpeobject) : + Effect(lpeobject), + extrude_vector(_("Direction"), _("Defines the direction and magnitude of the extrusion"), "extrude_vector", &wr, this, Geom::Point(-10,10)) +{ + show_orig_path = true; + concatenate_before_pwd2 = false; + + registerParameter( dynamic_cast(&extrude_vector) ); +} + +LPEExtrude::~LPEExtrude() +{ + +} + + +Geom::Piecewise > +LPEExtrude::doEffect_pwd2 (Geom::Piecewise > const & pwd2_in) +{ + using namespace Geom; + + // generate connecting lines (the 'sides' of the extrusion) + Path path(Point(0.,0.)); + path.appendNew( extrude_vector.getVector() ); + Piecewise > connector = path.toPwSb(); + + switch( 1 ) { + case 0: { + Piecewise > pwd2_out = pwd2_in; + // generate extrusion bottom: (just a copy of original path, displaced a bit) + pwd2_out.concat( pwd2_in + extrude_vector.getVector() ); + + // connecting lines should be put at start and end of path if it is not closed + // it is not possible to check whether a piecewise path is closed, + // so we check whether start and end are close + if ( ! are_near(pwd2_in.firstValue(), pwd2_in.lastValue()) ) { + pwd2_out.concat( connector + pwd2_in.firstValue() ); + pwd2_out.concat( connector + pwd2_in.lastValue() ); + } + // connecting lines should be put at cusps + Piecewise > deriv = derivative(pwd2_in); + std::vector cusps; // = roots(deriv); + for (unsigned i = 0; i < cusps.size() ; ++i) { + pwd2_out.concat( connector + pwd2_in.valueAt(cusps[i]) ); + } + // connecting lines should be put where the tangent of the path equals the extrude_vector in direction + std::vector rts = roots(dot(deriv, rot90(extrude_vector.getVector()))); + for (unsigned i = 0; i < rts.size() ; ++i) { + pwd2_out.concat( connector + pwd2_in.valueAt(rts[i]) ); + } + return pwd2_out; + } + + case 1: { + Piecewise > pwd2_out; + bool closed_path = are_near(pwd2_in.firstValue(), pwd2_in.lastValue()); + // split input path in pieces between points where deriv == vector + Piecewise > deriv = derivative(pwd2_in); + std::vector rts = roots(dot(deriv, rot90(extrude_vector.getVector()))); + double portion_t = 0.; + for (unsigned i = 0; i < rts.size() ; ++i) { + Piecewise > cut = portion(pwd2_in, portion_t, rts[i] ); + portion_t = rts[i]; + if (closed_path && i == 0) { + // if the path is closed, skip the first cut and add it to the last cut later + continue; + } + Piecewise > part = cut; + part.continuousConcat(connector + cut.lastValue()); + part.continuousConcat(reverse(cut) + extrude_vector.getVector()); + part.continuousConcat(reverse(connector) + cut.firstValue()); + pwd2_out.concat( part ); + } + if (closed_path) { + Piecewise > cut = portion(pwd2_in, portion_t, pwd2_in.domain().max() ); + cut.continuousConcat(portion(pwd2_in, pwd2_in.domain().min(), rts[0] )); + Piecewise > part = cut; + part.continuousConcat(connector + cut.lastValue()); + part.continuousConcat(reverse(cut) + extrude_vector.getVector()); + part.continuousConcat(reverse(connector) + cut.firstValue()); + pwd2_out.concat( part ); + } else if (!are_near(portion_t, pwd2_in.domain().max())) { + Piecewise > cut = portion(pwd2_in, portion_t, pwd2_in.domain().max() ); + Piecewise > part = cut; + part.continuousConcat(connector + cut.lastValue()); + part.continuousConcat(reverse(cut) + extrude_vector.getVector()); + part.continuousConcat(reverse(connector) + cut.firstValue()); + pwd2_out.concat( part ); + } + return pwd2_out; + } + } +} + +void +LPEExtrude::resetDefaults(SPItem * item) +{ + Effect::resetDefaults(item); + + using namespace Geom; + + Geom::OptRect bbox = item->getBounds(Geom::identity(), SPItem::GEOMETRIC_BBOX); + if (bbox) { + Interval boundingbox_X = (*bbox)[Geom::X]; + Interval boundingbox_Y = (*bbox)[Geom::Y]; + extrude_vector.set_and_write_new_values( Geom::Point(boundingbox_X.middle(), boundingbox_Y.middle()), + (boundingbox_X.extent() + boundingbox_Y.extent())*Geom::Point(-0.05,0.2) ); + } +} + +} //namespace LivePathEffect +} /* namespace Inkscape */ + +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : diff --git a/src/live_effects/lpe-extrude.h b/src/live_effects/lpe-extrude.h new file mode 100644 index 000000000..b704aa856 --- /dev/null +++ b/src/live_effects/lpe-extrude.h @@ -0,0 +1,52 @@ +/** @file + * @brief LPE effect for extruding paths (making them "3D"). + */ +/* Authors: + * Johan Engelen + * + * Copyright (C) 2009 Authors + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#ifndef INKSCAPE_LPE_EXTRUDE_H +#define INKSCAPE_LPE_EXTRUDE_H + +#include "live_effects/effect.h" +#include "live_effects/parameter/parameter.h" +#include "live_effects/parameter/vector.h" + +namespace Inkscape { +namespace LivePathEffect { + +class LPEExtrude : public Effect { +public: + LPEExtrude(LivePathEffectObject *lpeobject); + virtual ~LPEExtrude(); + + virtual Geom::Piecewise > doEffect_pwd2 (Geom::Piecewise > const & pwd2_in); + + virtual void resetDefaults(SPItem * item); + +private: + VectorParam extrude_vector; + + LPEExtrude(const LPEExtrude&); + LPEExtrude& operator=(const LPEExtrude&); +}; + +} //namespace LivePathEffect +} //namespace Inkscape + +#endif + +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : -- cgit v1.2.3 From 4ce34cedc0220cd0dc02433484fa2d09d737a93f Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Mon, 23 Nov 2009 21:14:28 +0000 Subject: work on the lpe group undo bug. it's not solved, but i think LPE code does everything correct now. I think now it's the interplay between undo-system and LPE that bugs. (bzr r8839) --- src/sp-item-group.cpp | 6 ++++- src/sp-lpe-item.cpp | 61 ++++++++++++++++++++++++++------------------------- src/sp-lpe-item.h | 4 ++-- src/sp-path.cpp | 10 +++++++++ 4 files changed, 48 insertions(+), 33 deletions(-) (limited to 'src') diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp index 54f62e093..7ac7880a7 100644 --- a/src/sp-item-group.cpp +++ b/src/sp-item-group.cpp @@ -43,6 +43,7 @@ #include "inkscape.h" #include "desktop-handles.h" #include "selection.h" +#include "live_effects/effect.h" #include "live_effects/lpeobject.h" #include "live_effects/lpeobject-reference.h" #include "sp-title.h" @@ -871,7 +872,7 @@ sp_group_perform_patheffect(SPGroup *group, SPGroup *topgroup, bool write) } else if (SP_IS_SHAPE(subitem)) { SPCurve * c = NULL; if (SP_IS_PATH(subitem)) { - c = sp_path_get_curve_for_edit(SP_PATH(subitem)); + c = sp_path_get_original_curve(SP_PATH(subitem)); } else { c = sp_shape_get_curve(SP_SHAPE(subitem)); } @@ -884,6 +885,9 @@ sp_group_perform_patheffect(SPGroup *group, SPGroup *topgroup, bool write) Inkscape::XML::Node *repr = SP_OBJECT_REPR(subitem); gchar *str = sp_svg_write_path(c->get_pathvector()); repr->setAttribute("d", str); +#ifdef GROUP_VERBOSE +g_message("sp_group_perform_patheffect writes 'd' attribute"); +#endif g_free(str); } diff --git a/src/sp-lpe-item.cpp b/src/sp-lpe-item.cpp index 49264c684..6b71541e6 100644 --- a/src/sp-lpe-item.cpp +++ b/src/sp-lpe-item.cpp @@ -56,7 +56,6 @@ static void sp_lpe_item_remove_child (SPObject * object, Inkscape::XML::Node * c static void sp_lpe_item_enable_path_effects(SPLPEItem *lpeitem, bool enable); -static void lpeobject_ref_changed(SPObject *old_ref, SPObject *ref, SPLPEItem *lpeitem); static void lpeobject_ref_modified(SPObject *href, guint flags, SPLPEItem *lpeitem); static void sp_lpe_item_create_original_path_recursive(SPLPEItem *lpeitem); @@ -120,7 +119,7 @@ sp_lpe_item_init(SPLPEItem *lpeitem) lpeitem->path_effect_list = new PathEffectList(); lpeitem->current_path_effect = NULL; - new (&lpeitem->lpe_modified_connection) sigc::connection(); + lpeitem->lpe_modified_connection_list = new std::list(); } static void @@ -154,8 +153,14 @@ sp_lpe_item_release(SPObject *object) { SPLPEItem *lpeitem = (SPLPEItem *) object; - lpeitem->lpe_modified_connection.disconnect(); - lpeitem->lpe_modified_connection.~connection(); + // disconnect all modified listeners: + for (std::list::iterator mod_it = lpeitem->lpe_modified_connection_list->begin(); + mod_it != lpeitem->lpe_modified_connection_list->end(); ++mod_it) + { + mod_it->disconnect(); + } + delete lpeitem->lpe_modified_connection_list; + lpeitem->lpe_modified_connection_list = NULL; PathEffectList::iterator it = lpeitem->path_effect_list->begin(); while ( it != lpeitem->path_effect_list->end() ) { @@ -165,7 +170,8 @@ sp_lpe_item_release(SPObject *object) it = lpeitem->path_effect_list->erase(it); } // delete the list itself - delete SP_LPE_ITEM(object)->path_effect_list; + delete lpeitem->path_effect_list; + lpeitem->path_effect_list = NULL; if (((SPObjectClass *) parent_class)->release) ((SPObjectClass *) parent_class)->release(object); @@ -187,6 +193,14 @@ sp_lpe_item_set(SPObject *object, unsigned int key, gchar const *value) // Disable the path effects while populating the LPE list sp_lpe_item_enable_path_effects(lpeitem, false); + // disconnect all modified listeners: + for ( std::list::iterator mod_it = lpeitem->lpe_modified_connection_list->begin(); + mod_it != lpeitem->lpe_modified_connection_list->end(); + ++mod_it) + { + mod_it->disconnect(); + } + lpeitem->lpe_modified_connection_list->clear(); // Clear the path effect list PathEffectList::iterator it = lpeitem->path_effect_list->begin(); while ( it != lpeitem->path_effect_list->end() ) @@ -202,10 +216,7 @@ sp_lpe_item_set(SPObject *object, unsigned int key, gchar const *value) std::string href; while (std::getline(iss, href, ';')) { - Inkscape::LivePathEffect::LPEObjectReference *path_effect_ref = new Inkscape::LivePathEffect::LPEObjectReference(SP_OBJECT(lpeitem)); - path_effect_ref->changedSignal().connect(sigc::bind(sigc::ptr_fun(lpeobject_ref_changed), SP_LPE_ITEM(object))); - // Now do the attaching, which emits the changed signal. - // Fixme, it should not do this changed signal and updating before all effects are added to the path_effect_list + Inkscape::LivePathEffect::LPEObjectReference *path_effect_ref = new Inkscape::LivePathEffect::LPEObjectReference(object); try { path_effect_ref->link(href.c_str()); } catch (Inkscape::BadURIException e) { @@ -216,7 +227,11 @@ sp_lpe_item_set(SPObject *object, unsigned int key, gchar const *value) } lpeitem->path_effect_list->push_back(path_effect_ref); - if ( !(path_effect_ref->lpeobject && path_effect_ref->lpeobject->get_lpe()) ) { + if ( path_effect_ref->lpeobject && path_effect_ref->lpeobject->get_lpe() ) { + // connect modified-listener + lpeitem->lpe_modified_connection_list->push_back( + path_effect_ref->lpeobject->connectModified(sigc::bind(sigc::ptr_fun(&lpeobject_ref_modified), lpeitem)) ); + } else { // something has gone wrong in finding the right patheffect. g_warning("Unknown LPE type specified, LPE stack effectively disabled"); // keep the effect in the lpestack, so the whole stack is effectively disabled but maintained @@ -407,28 +422,14 @@ sp_lpe_item_update_patheffect (SPLPEItem *lpeitem, bool wholetree, bool write) } /** - * Gets called when (re)attached to another lpeobject. - */ -static void -lpeobject_ref_changed(SPObject *old_ref, SPObject *ref, SPLPEItem *lpeitem) -{ - if (old_ref) { - sp_signal_disconnect_by_data(old_ref, lpeitem); - } - if ( IS_LIVEPATHEFFECT(ref) && ref != lpeitem ) - { - lpeitem->lpe_modified_connection.disconnect(); - lpeitem->lpe_modified_connection = ref->connectModified(sigc::bind(sigc::ptr_fun(&lpeobject_ref_modified), lpeitem)); - lpeobject_ref_modified(ref, 0, lpeitem); - } -} - -/** - * Gets called when lpeobject repr contents change: i.e. parameter change. + * Gets called when any of the lpestack's lpeobject repr contents change: i.e. parameter change in any of the stacked LPEs */ static void lpeobject_ref_modified(SPObject */*href*/, guint /*flags*/, SPLPEItem *lpeitem) { +#ifdef SHAPE_VERBOSE + g_message("lpeobject_ref_modified"); +#endif sp_lpe_item_update_patheffect (lpeitem, true, true); } @@ -753,8 +754,9 @@ PathEffectList sp_lpe_item_get_effect_list(SPLPEItem *lpeitem) Inkscape::LivePathEffect::LPEObjectReference* sp_lpe_item_get_current_lpereference(SPLPEItem *lpeitem) { - if (!lpeitem->current_path_effect && !lpeitem->path_effect_list->empty()) + if (!lpeitem->current_path_effect && !lpeitem->path_effect_list->empty()) { sp_lpe_item_set_current_path_effect(lpeitem, lpeitem->path_effect_list->back()); + } return lpeitem->current_path_effect; } @@ -773,7 +775,6 @@ bool sp_lpe_item_set_current_path_effect(SPLPEItem *lpeitem, Inkscape::LivePathE { for (PathEffectList::iterator it = lpeitem->path_effect_list->begin(); it != lpeitem->path_effect_list->end(); it++) { if ((*it)->lpeobject_repr == lperef->lpeobject_repr) { - lpeobject_ref_changed(NULL, (*it)->lpeobject, SP_LPE_ITEM(lpeitem)); // FIXME: explain why this is here? lpeitem->current_path_effect = (*it); // current_path_effect should always be a pointer from the path_effect_list ! return true; } diff --git a/src/sp-lpe-item.h b/src/sp-lpe-item.h index 5b6cc241e..4823390de 100644 --- a/src/sp-lpe-item.h +++ b/src/sp-lpe-item.h @@ -39,10 +39,10 @@ struct SPLPEItem : public SPItem { int path_effects_enabled; PathEffectList* path_effect_list; + std::list *lpe_modified_connection_list; // this list contains the connections for listening to lpeobject parameter changes + Inkscape::LivePathEffect::LPEObjectReference* current_path_effect; std::vector lpe_helperpaths; - - sigc::connection lpe_modified_connection; }; struct SPLPEItemClass { diff --git a/src/sp-path.cpp b/src/sp-path.cpp index a863c12b4..2120ddd64 100644 --- a/src/sp-path.cpp +++ b/src/sp-path.cpp @@ -320,6 +320,9 @@ sp_path_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML: repr = xml_doc->createElement("svg:path"); } +#ifdef PATH_VERBOSE +g_message("sp_path_write writes 'd' attribute"); +#endif if ( shape->curve != NULL ) { gchar *str = sp_svg_write_path(shape->curve->get_pathvector()); repr->setAttribute("d", str); @@ -411,6 +414,10 @@ sp_path_update_patheffect(SPLPEItem *lpeitem, bool write) SPPath * const path = (SPPath *) lpeitem; Inkscape::XML::Node *repr = SP_OBJECT_REPR(shape); +#ifdef PATH_VERBOSE +g_message("sp_path_update_patheffect"); +#endif + if (path->original_curve && sp_lpe_item_has_path_effect_recursive(lpeitem)) { SPCurve *curve = path->original_curve->copy(); /* if a path does not have an lpeitem applied, then reset the curve to the original_curve. @@ -420,6 +427,9 @@ sp_path_update_patheffect(SPLPEItem *lpeitem, bool write) bool success = sp_lpe_item_perform_path_effect(SP_LPE_ITEM(shape), curve); if (success && write) { // could also do SP_OBJECT(shape)->updateRepr(); but only the d attribute needs updating. +#ifdef PATH_VERBOSE +g_message("sp_path_update_patheffect writes 'd' attribute"); +#endif if ( shape->curve != NULL ) { gchar *str = sp_svg_write_path(shape->curve->get_pathvector()); repr->setAttribute("d", str); -- cgit v1.2.3 From b0a9bcb9e1da6e5192cf37aedcd3b87a4041b911 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Mon, 23 Nov 2009 21:15:06 +0000 Subject: update 2geom. needed for extrude lpe (bzr r8840) --- src/2geom/d2-sbasis.cpp | 39 +++++++++++++++++++++++++++++++++++++-- src/2geom/d2-sbasis.h | 1 + src/2geom/d2.h | 21 ++++++++++++++++++++- src/2geom/piecewise.h | 9 +++++++-- 4 files changed, 65 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/2geom/d2-sbasis.cpp b/src/2geom/d2-sbasis.cpp index 2c52e4782..aef989fc7 100644 --- a/src/2geom/d2-sbasis.cpp +++ b/src/2geom/d2-sbasis.cpp @@ -58,8 +58,19 @@ Piecewise > rot90(Piecewise > const &M){ return result; } -Piecewise dot(Piecewise > const &a, - Piecewise > const &b){ +/** @brief Calculates the 'dot product' or 'inner product' of \c a and \c b + * @return \f[ + * f(t) \rightarrow \left\{ + * \begin{array}{c} + * a_1 \bullet b_1 \\ + * a_2 \bullet b_2 \\ + * \ldots \\ + * a_n \bullet b_n \\ + * \end{array}\right. + * \f] + * @relates Piecewise */ +Piecewise dot(Piecewise > const &a, Piecewise > const &b) +{ Piecewise result; if (a.empty() || b.empty()) return result; Piecewise > aa = partition(a,b.cuts); @@ -72,6 +83,30 @@ Piecewise dot(Piecewise > const &a, return result; } +/** @brief Calculates the 'dot product' or 'inner product' of \c a and \c b + * @return \f[ + * f(t) \rightarrow \left\{ + * \begin{array}{c} + * a_1 \bullet b \\ + * a_2 \bullet b \\ + * \ldots \\ + * a_n \bullet b \\ + * \end{array}\right. + * \f] + * @relates Piecewise */ +Piecewise dot(Piecewise > const &a, Point const &b) +{ + Piecewise result; + if (a.empty()) return result; + + result.push_cut(a.cuts.front()); + for (unsigned i = 0; i < a.size(); ++i){ + result.push(dot(a.segs[i],b), a.cuts[i+1]); + } + return result; +} + + Piecewise cross(Piecewise > const &a, Piecewise > const &b){ Piecewise result; diff --git a/src/2geom/d2-sbasis.h b/src/2geom/d2-sbasis.h index c61052da7..d404e0618 100644 --- a/src/2geom/d2-sbasis.h +++ b/src/2geom/d2-sbasis.h @@ -73,6 +73,7 @@ Piecewise > sectionize(D2 > const &a); D2 > make_cuts_independent(Piecewise > const &a); Piecewise > rot90(Piecewise > const &a); Piecewise dot(Piecewise > const &a, Piecewise > const &b); +Piecewise dot(Piecewise > const &a, Point const &b); Piecewise cross(Piecewise > const &a, Piecewise > const &b); Piecewise > operator*(Piecewise > const &a, Matrix const &m); diff --git a/src/2geom/d2.h b/src/2geom/d2.h index 547d8c658..b2a0f8866 100644 --- a/src/2geom/d2.h +++ b/src/2geom/d2.h @@ -99,7 +99,7 @@ class D2{ std::vector x = f[X].valueAndDerivatives(t, n), y = f[Y].valueAndDerivatives(t, n); // always returns a vector of size n+1 std::vector res(n+1); - for (unsigned i = 0; i <= n; i++) { + for(unsigned i = 0; i <= n; i++) { res[i] = Point(x[i], y[i]); } return res; @@ -321,6 +321,25 @@ dot(D2 const & a, D2 const & b) { return r; } +/** @brief Calculates the 'dot product' or 'inner product' of \c a and \c b + * @return \f$a \bullet b = a_X b_X + a_Y b_Y\f$. + * @relates D2 */ +template +inline T +dot(D2 const & a, Point const & b) { + boost::function_requires >(); + boost::function_requires >(); + + T r; + for(unsigned i = 0; i < 2; i++) { + r += a[i] * b[i]; + } + return r; +} + +/** @brief Calculates the 'cross product' or 'outer product' of \c a and \c b + * @return \f$a \times b = a_Y b_X - a_X b_Y\f$. + * @relates D2 */ template inline T cross(D2 const & a, D2 const & b) { diff --git a/src/2geom/piecewise.h b/src/2geom/piecewise.h index a5be42587..a0628daf1 100644 --- a/src/2geom/piecewise.h +++ b/src/2geom/piecewise.h @@ -58,7 +58,7 @@ namespace Geom { * \begin{array}{cc} * s_1,& t <= c_2 \\ * s_2,& c_2 <= t <= c_3\\ - * \ldots + * \ldots \\ * s_n,& c_n <= t * \end{array}\right. * \f] @@ -105,6 +105,10 @@ class Piecewise { inline output_type lastValue() const { return valueAt(cuts.back()); } + + /** + * The size of the returned vector equals n_derivs+1. + */ std::vector valueAndDerivatives(double t, unsigned n_derivs) const { unsigned n = segN(t); std::vector ret, val = segs[n].valueAndDerivatives(segT(t, n), n_derivs); @@ -115,6 +119,7 @@ class Piecewise { } return ret; } + //TODO: maybe it is not a good idea to have this? Piecewise operator()(SBasis f); Piecewise operator()(Piecewisef); @@ -773,10 +778,10 @@ Piecewise reverse(Piecewise const &f) { return ret; } - /** * Interpolates between a and b. * \return a if t = 0, b if t = 1, or an interpolation between a and b for t in [0,1] + * \relates Piecewise */ template Piecewise lerp(double t, Piecewise const &a, Piecewise b) { -- cgit v1.2.3 From 4a5dfe33ac8e20c0a04be6757146bb5767fb0ad9 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Mon, 23 Nov 2009 21:16:14 +0000 Subject: decrease header dependencies (bzr r8841) --- src/knotholder.cpp | 1 + src/live_effects/effect.h | 4 +++- src/live_effects/lpeobject.h | 13 ++++++++----- src/shape-editor.cpp | 1 + 4 files changed, 13 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/knotholder.cpp b/src/knotholder.cpp index 5f749cfee..45cb140c0 100644 --- a/src/knotholder.cpp +++ b/src/knotholder.cpp @@ -30,6 +30,7 @@ #include "sp-pattern.h" #include "style.h" #include "live_effects/lpeobject.h" +#include "live_effects/effect.h" #include "desktop.h" #include "display/sp-canvas.h" diff --git a/src/live_effects/effect.h b/src/live_effects/effect.h index 6f195b176..04e3f91b9 100644 --- a/src/live_effects/effect.h +++ b/src/live_effects/effect.h @@ -13,7 +13,6 @@ #include "display/display-forward.h" #include #include -#include <2geom/path.h> #include <2geom/forward.h> #include "ui/widget/registry.h" #include "sp-lpe-item.h" @@ -28,6 +27,9 @@ struct SPDesktop; struct SPItem; class SPNodeContext; struct LivePathEffectObject; +class SPLPEItem; +class KnotHolder; +class KnotHolderEntity; namespace Gtk { class Widget; diff --git a/src/live_effects/lpeobject.h b/src/live_effects/lpeobject.h index dc631a5c1..9f802643b 100644 --- a/src/live_effects/lpeobject.h +++ b/src/live_effects/lpeobject.h @@ -10,13 +10,16 @@ */ #include "sp-object.h" -#include "effect.h" +#include "effect-enum.h" namespace Inkscape { -namespace XML { -class Node; -class Document; -} + namespace XML { + class Node; + class Document; + } + namespace LivePathEffect { + class Effect; + } } #define TYPE_LIVEPATHEFFECT (LivePathEffectObject::livepatheffect_get_type()) diff --git a/src/shape-editor.cpp b/src/shape-editor.cpp index 4999eb7cf..44ad9dc9e 100644 --- a/src/shape-editor.cpp +++ b/src/shape-editor.cpp @@ -17,6 +17,7 @@ #include "sp-object.h" #include "sp-item.h" +#include "sp-lpe-item.h" #include "live_effects/lpeobject.h" #include "selection.h" #include "desktop.h" -- cgit v1.2.3 From 65fd3f75497e45a96737b1e1b5da8ac34353405d Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Mon, 23 Nov 2009 21:24:51 +0000 Subject: decrease header deps (bzr r8842) --- src/live_effects/effect.cpp | 1 + src/live_effects/effect.h | 2 +- src/live_effects/lpe-knot.cpp | 1 + src/live_effects/lpe-perspective_path.cpp | 1 + src/live_effects/parameter/point.cpp | 1 + 5 files changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index 04549622e..9232792f6 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -29,6 +29,7 @@ #include "message-stack.h" #include "desktop.h" #include "nodepath.h" +#include "knotholder.h" #include "live_effects/lpeobject.h" #include "live_effects/parameter/parameter.h" diff --git a/src/live_effects/effect.h b/src/live_effects/effect.h index 04e3f91b9..5d67ed016 100644 --- a/src/live_effects/effect.h +++ b/src/live_effects/effect.h @@ -16,7 +16,7 @@ #include <2geom/forward.h> #include "ui/widget/registry.h" #include "sp-lpe-item.h" -#include "knotholder.h" +//#include "knotholder.h" #include "parameter/bool.h" #include "effect-enum.h" diff --git a/src/live_effects/lpe-knot.cpp b/src/live_effects/lpe-knot.cpp index 340cdf633..b3aa2df45 100644 --- a/src/live_effects/lpe-knot.cpp +++ b/src/live_effects/lpe-knot.cpp @@ -15,6 +15,7 @@ #include "live_effects/lpe-knot.h" #include "svg/svg.h" #include "style.h" +#include "knot-holder-entity.h" #include <2geom/sbasis-to-bezier.h> #include <2geom/sbasis.h> diff --git a/src/live_effects/lpe-perspective_path.cpp b/src/live_effects/lpe-perspective_path.cpp index d5262f33c..091a4d9ae 100644 --- a/src/live_effects/lpe-perspective_path.cpp +++ b/src/live_effects/lpe-perspective_path.cpp @@ -16,6 +16,7 @@ #include "live_effects/lpe-perspective_path.h" #include "sp-item-group.h" +#include "knot-holder-entity.h" #include "inkscape.h" diff --git a/src/live_effects/parameter/point.cpp b/src/live_effects/parameter/point.cpp index 057cc424b..e7abb70ea 100644 --- a/src/live_effects/parameter/point.cpp +++ b/src/live_effects/parameter/point.cpp @@ -16,6 +16,7 @@ #include "ui/widget/registered-widget.h" #include "inkscape.h" #include "verbs.h" +#include "knotholder.h" // needed for on-canvas editting: #include "desktop.h" -- cgit v1.2.3 From bf2ae6a23172bfd947eedab978742fb6e9c66df8 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Tue, 24 Nov 2009 00:09:32 +0000 Subject: hopefully fix build on linux (bzr r8843) --- src/live_effects/Makefile_insert | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/live_effects/Makefile_insert b/src/live_effects/Makefile_insert index d992dd7bb..1cc2e1b69 100644 --- a/src/live_effects/Makefile_insert +++ b/src/live_effects/Makefile_insert @@ -18,6 +18,8 @@ ink_common_sources += \ live_effects/lpe-boolops.h \ live_effects/lpe-dynastroke.cpp \ live_effects/lpe-dynastroke.h \ + live_effects/lpe-extrude.cpp \ + live_effects/lpe-extrude.h \ live_effects/lpe-sketch.cpp \ live_effects/lpe-sketch.h \ live_effects/lpe-knot.cpp \ -- cgit v1.2.3