summaryrefslogtreecommitdiffstats
path: root/src/splivarot.cpp
diff options
context:
space:
mode:
authorJon A. Cruz <jon@joncruz.org>2011-02-22 00:01:57 +0000
committerJon A. Cruz <jon@joncruz.org>2011-02-22 00:01:57 +0000
commitb7c5598b9c8dcb471747713503e21a09bb0a5ca0 (patch)
treed02d336fc4eddac745715949a3e77bc023ee3184 /src/splivarot.cpp
parentNEW: Grayscale color display mode. (toggle assigned keybinding: Shift+keypad5) (diff)
downloadinkscape-b7c5598b9c8dcb471747713503e21a09bb0a5ca0.tar.gz
inkscape-b7c5598b9c8dcb471747713503e21a09bb0a5ca0.zip
Finished cleanup of outdated SP_OBJECT_STYLE C macro.
(bzr r10066)
Diffstat (limited to 'src/splivarot.cpp')
-rw-r--r--src/splivarot.cpp122
1 files changed, 64 insertions, 58 deletions
diff --git a/src/splivarot.cpp b/src/splivarot.cpp
index bcb9b1bb6..fe8d8a894 100644
--- a/src/splivarot.cpp
+++ b/src/splivarot.cpp
@@ -141,8 +141,8 @@ sp_selected_path_boolop(SPDesktop *desktop, bool_op bop, const unsigned int verb
if (bop == bool_op_diff || bop == bool_op_cut || bop == bool_op_slice) {
// check in the tree to find which element of the selection list is topmost (for 2-operand commands only)
- Inkscape::XML::Node *a = SP_OBJECT_REPR(il->data);
- Inkscape::XML::Node *b = SP_OBJECT_REPR(il->next->data);
+ Inkscape::XML::Node *a = reinterpret_cast<SPObject *>(il->data)->getRepr();
+ Inkscape::XML::Node *b = reinterpret_cast<SPObject *>(il->next->data)->getRepr();
if (a == NULL || b == NULL) {
desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("Unable to determine the <b>z-order</b> of the objects selected for difference, XOR, division, or path cut."));
@@ -206,7 +206,7 @@ sp_selected_path_boolop(SPDesktop *desktop, bool_op bop, const unsigned int verb
curOrig = 0;
for (GSList *l = il; l != NULL; l = l->next)
{
- SPCSSAttr *css = sp_repr_css_attr(SP_OBJECT_REPR(il->data), "style");
+ SPCSSAttr *css = sp_repr_css_attr(reinterpret_cast<SPObject *>(il->data)->getRepr(), "style");
gchar const *val = sp_repr_css_property(css, "fill-rule", NULL);
if (val && strcmp(val, "nonzero") == 0) {
origWind[curOrig]= fill_nonZero;
@@ -458,7 +458,7 @@ sp_selected_path_boolop(SPDesktop *desktop, bool_op bop, const unsigned int verb
item_source->adjust_gradient(i2doc);
item_source->adjust_livepatheffect(i2doc);
- Inkscape::XML::Node *repr_source = SP_OBJECT_REPR(source);
+ Inkscape::XML::Node *repr_source = source->getRepr();
// remember important aspects of the source path, to be restored
gint pos = repr_source->position();
@@ -473,7 +473,7 @@ sp_selected_path_boolop(SPDesktop *desktop, bool_op bop, const unsigned int verb
selection->clear();
for (GSList *l = il; l != NULL; l = l->next) {
// if this is the bottommost object,
- if (!strcmp(SP_OBJECT_REPR(l->data)->attribute("id"), id)) {
+ if (!strcmp(reinterpret_cast<SPObject *>(l->data)->getRepr()->attribute("id"), id)) {
// delete it so that its clones don't get alerted; this object will be restored shortly, with the same id
SP_OBJECT(l->data)->deleteObject(false);
} else {
@@ -606,7 +606,7 @@ void sp_selected_path_outline_add_marker( SPObject *marker_object, Geom::Affine
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));
+ SPItem* marker_item = sp_item_first_item_child(marker_object);
Geom::Affine tr(marker_transform);
@@ -617,8 +617,8 @@ void sp_selected_path_outline_add_marker( SPObject *marker_object, Geom::Affine
// total marker transform
tr = marker_item->transform * marker->c2p * tr * transform;
- if (SP_OBJECT_REPR(marker_item)) {
- Inkscape::XML::Node *m_repr = SP_OBJECT_REPR(marker_item)->duplicate(xml_doc);
+ if (marker_item->getRepr()) {
+ Inkscape::XML::Node *m_repr = marker_item->getRepr()->duplicate(xml_doc);
g_repr->appendChild(m_repr);
SPItem *marker_item = (SPItem *) doc->getObjectByRepr(m_repr);
marker_item->doWriteTransform(m_repr, tr);
@@ -629,8 +629,8 @@ static
void item_outline_add_marker( SPObject const *marker_object, Geom::Affine marker_transform,
Geom::Scale stroke_scale, Geom::PathVector* pathv_in )
{
- SPMarker* marker = SP_MARKER (marker_object);
- SPItem* marker_item = sp_item_first_item_child(SP_OBJECT(marker_object));
+ SPMarker const * marker = SP_MARKER(marker_object);
+ SPItem const * marker_item = sp_item_first_item_child(marker_object);
Geom::Affine tr(marker_transform);
if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH) {
@@ -657,11 +657,12 @@ Geom::PathVector* item_outline(SPItem const *item)
{
Geom::PathVector *ret_pathv = NULL;
- if (!SP_IS_SHAPE(item) && !SP_IS_TEXT(item))
+ if (!SP_IS_SHAPE(item) && !SP_IS_TEXT(item)) {
return ret_pathv;
+ }
// no stroke: no outline
- if (!SP_OBJECT_STYLE(item) || SP_OBJECT_STYLE(item)->stroke.noneSet) {
+ if (!item->style || item->style->stroke.noneSet) {
return ret_pathv;
}
@@ -680,7 +681,7 @@ Geom::PathVector* item_outline(SPItem const *item)
}
// remember old stroke style, to be set on fill
- SPStyle *i_style = SP_OBJECT_STYLE(item);
+ SPStyle *i_style = item->style;
Geom::Affine const transform(item->transform);
float const scale = transform.descrim();
@@ -910,14 +911,14 @@ sp_selected_path_outline(SPDesktop *desktop)
}
// pas de stroke pas de chocolat
- if (!SP_OBJECT_STYLE(item) || SP_OBJECT_STYLE(item)->stroke.noneSet) {
+ if (!item->style || item->style->stroke.noneSet) {
curve->unref();
continue;
}
// remember old stroke style, to be set on fill
- SPStyle *i_style = SP_OBJECT_STYLE(item);
- SPCSSAttr *ncss;
+ SPStyle *i_style = item->style;
+ SPCSSAttr *ncss = 0;
{
ncss = sp_css_attr_from_style(i_style, SP_STYLE_FLAG_ALWAYS);
gchar const *s_val = sp_repr_css_property(ncss, "stroke", NULL);
@@ -938,8 +939,8 @@ sp_selected_path_outline(SPDesktop *desktop)
Geom::Affine const transform(item->transform);
float const scale = transform.descrim();
- gchar const *mask = SP_OBJECT_REPR(item)->attribute("mask");
- gchar const *clip_path = SP_OBJECT_REPR(item)->attribute("clip-path");
+ gchar const *mask = item->getRepr()->attribute("mask");
+ gchar const *clip_path = item->getRepr()->attribute("clip-path");
float o_width, o_miter;
JoinType o_join;
@@ -1053,11 +1054,11 @@ sp_selected_path_outline(SPDesktop *desktop)
did = true;
// remember the position of the item
- gint pos = SP_OBJECT_REPR(item)->position();
+ gint pos = item->getRepr()->position();
// remember parent
- Inkscape::XML::Node *parent = SP_OBJECT_REPR(item)->parent();
+ Inkscape::XML::Node *parent = item->getRepr()->parent();
// remember id
- char const *id = SP_OBJECT_REPR(item)->attribute("id");
+ char const *id = item->getRepr()->attribute("id");
// remember title
gchar *title = item->title();
// remember description
@@ -1213,11 +1214,17 @@ sp_selected_path_outline(SPDesktop *desktop)
curve->unref();
selection->remove(item);
- SP_OBJECT(item)->deleteObject(false);
+ item->deleteObject(false);
}
- if (title) g_free(title);
- if (desc) g_free(desc);
+ if (title) {
+ g_free(title);
+ title = 0;
+ }
+ if (desc) {
+ g_free(desc);
+ desc = 0;
+ }
delete res;
delete orig;
@@ -1329,22 +1336,21 @@ sp_selected_path_create_offset_object(SPDesktop *desktop, int expand, bool updat
Geom::Affine const transform(item->transform);
- item->doWriteTransform(SP_OBJECT_REPR(item), Geom::identity());
+ item->doWriteTransform(item->getRepr(), Geom::identity());
//XML Tree being used directly here while it shouldn't be...
- style = g_strdup(SP_OBJECT(item)->getRepr()->attribute("style"));
+ style = g_strdup(item->getRepr()->attribute("style"));
// remember the position of the item
- gint pos = SP_OBJECT_REPR(item)->position();
+ gint pos = item->getRepr()->position();
// remember parent
- Inkscape::XML::Node *parent = SP_OBJECT_REPR(item)->parent();
+ Inkscape::XML::Node *parent = item->getRepr()->parent();
{
- SPStyle *i_style = SP_OBJECT(item)->style;
- int jointype, captype;
+ SPStyle *i_style = item->style;
+ int jointype = i_style->stroke_linejoin.value;
+ int captype = i_style->stroke_linecap.value;
- jointype = i_style->stroke_linejoin.value;
- captype = i_style->stroke_linecap.value;
o_width = i_style->stroke_width.computed;
if (jointype == SP_STROKE_LINEJOIN_MITER)
{
@@ -1399,7 +1405,7 @@ sp_selected_path_create_offset_object(SPDesktop *desktop, int expand, bool updat
orig->ConvertWithBackData(1.0);
orig->Fill(theShape, 0);
- SPCSSAttr *css = sp_repr_css_attr(SP_OBJECT_REPR(item), "style");
+ SPCSSAttr *css = sp_repr_css_attr(item->getRepr(), "style");
gchar const *val = sp_repr_css_property(css, "fill-rule", NULL);
if (val && strcmp(val, "nonzero") == 0)
{
@@ -1462,7 +1468,7 @@ sp_selected_path_create_offset_object(SPDesktop *desktop, int expand, bool updat
if ( updating ) {
//XML Tree being used directly here while it shouldn't be
- char const *id = SP_OBJECT(item)->getRepr()->attribute("id");
+ char const *id = item->getRepr()->attribute("id");
char const *uri = g_strdup_printf("#%s", id);
repr->setAttribute("xlink:href", uri);
g_free((void *) uri);
@@ -1483,16 +1489,16 @@ sp_selected_path_create_offset_object(SPDesktop *desktop, int expand, bool updat
if ( updating ) {
// on conserve l'original
// we reapply the transform to the original (offset will feel it)
- item->doWriteTransform(SP_OBJECT_REPR(item), transform);
+ item->doWriteTransform(item->getRepr(), transform);
} else {
// delete original, apply the transform to the offset
- SP_OBJECT(item)->deleteObject(false);
+ item->deleteObject(false);
nitem->doWriteTransform(repr, transform);
}
// The object just created from a temporary repr is only a seed.
// We need to invoke its write which will update its real repr (in particular adding d=)
- SP_OBJECT(nitem)->updateRepr();
+ nitem->updateRepr();
Inkscape::GC::release(repr);
@@ -1557,20 +1563,19 @@ sp_selected_path_do_offset(SPDesktop *desktop, bool expand, double prefOffset)
Geom::Affine const transform(item->transform);
- item->doWriteTransform(SP_OBJECT_REPR(item), Geom::identity());
+ item->doWriteTransform(item->getRepr(), Geom::identity());
- gchar *style = g_strdup(SP_OBJECT_REPR(item)->attribute("style"));
+ gchar *style = g_strdup(item->getRepr()->attribute("style"));
float o_width, o_miter;
JoinType o_join;
ButtType o_butt;
{
- SPStyle *i_style = SP_OBJECT(item)->style;
- int jointype, captype;
+ SPStyle *i_style = item->style;
+ int jointype = i_style->stroke_linejoin.value;
+ int captype = i_style->stroke_linecap.value;
- jointype = i_style->stroke_linejoin.value;
- captype = i_style->stroke_linecap.value;
o_width = i_style->stroke_width.computed;
switch (jointype) {
@@ -1621,7 +1626,7 @@ sp_selected_path_do_offset(SPDesktop *desktop, bool expand, double prefOffset)
orig->ConvertWithBackData(0.03);
orig->Fill(theShape, 0);
- SPCSSAttr *css = sp_repr_css_attr(SP_OBJECT_REPR(item), "style");
+ SPCSSAttr *css = sp_repr_css_attr(item->getRepr(), "style");
gchar const *val = sp_repr_css_property(css, "fill-rule", NULL);
if (val && strcmp(val, "nonzero") == 0)
{
@@ -1697,14 +1702,14 @@ sp_selected_path_do_offset(SPDesktop *desktop, bool expand, double prefOffset)
curve->unref();
// remember the position of the item
- gint pos = SP_OBJECT_REPR(item)->position();
+ gint pos = item->getRepr()->position();
// remember parent
- Inkscape::XML::Node *parent = SP_OBJECT_REPR(item)->parent();
+ Inkscape::XML::Node *parent = item->getRepr()->parent();
// remember id
- char const *id = SP_OBJECT_REPR(item)->attribute("id");
+ char const *id = item->getRepr()->attribute("id");
selection->remove(item);
- SP_OBJECT(item)->deleteObject(false);
+ item->deleteObject(false);
if (res->descr_cmd.size() > 1) { // if there's 0 or 1 node left, drop this path altogether
@@ -1809,11 +1814,11 @@ sp_selected_path_simplify_item(SPDesktop *desktop,
this is necessary so that the item is transformed twice back and forth,
allowing all compensations to cancel out regardless of the preferences
*/
- item->doWriteTransform(SP_OBJECT_REPR(item), Geom::identity());
+ item->doWriteTransform(item->getRepr(), Geom::identity());
- gchar *style = g_strdup(SP_OBJECT_REPR(item)->attribute("style"));
- gchar *mask = g_strdup(SP_OBJECT_REPR(item)->attribute("mask"));
- gchar *clip_path = g_strdup(SP_OBJECT_REPR(item)->attribute("clip-path"));
+ gchar *style = g_strdup(item->getRepr()->attribute("style"));
+ gchar *mask = g_strdup(item->getRepr()->attribute("mask"));
+ gchar *clip_path = g_strdup(item->getRepr()->attribute("clip-path"));
Path *orig = Path_for_item(item, false);
if (orig == NULL) {
@@ -1824,23 +1829,24 @@ sp_selected_path_simplify_item(SPDesktop *desktop,
curve->unref();
// remember the position of the item
- gint pos = SP_OBJECT_REPR(item)->position();
+ gint pos = item->getRepr()->position();
// remember parent
- Inkscape::XML::Node *parent = SP_OBJECT_REPR(item)->parent();
+ Inkscape::XML::Node *parent = item->getRepr()->parent();
// remember id
- char const *id = SP_OBJECT_REPR(item)->attribute("id");
+ char const *id = item->getRepr()->attribute("id");
// remember path effect
- char const *patheffect = SP_OBJECT_REPR(item)->attribute("inkscape:path-effect");
+ char const *patheffect = item->getRepr()->attribute("inkscape:path-effect");
// remember title
gchar *title = item->title();
// remember description
gchar *desc = item->desc();
//If a group was selected, to not change the selection list
- if (modifySelection)
+ if (modifySelection) {
selection->remove(item);
+ }
- SP_OBJECT(item)->deleteObject(false);
+ item->deleteObject(false);
if ( justCoalesce ) {
orig->Coalesce(threshold * size);