From 43d418f2720546f501594e30e24151248b2a67e8 Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Tue, 21 Oct 2014 09:21:06 +0200 Subject: Updating translators list. (bzr r13631) --- src/ui/dialog/aboutbox.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/aboutbox.cpp b/src/ui/dialog/aboutbox.cpp index f3cffa244..fad10ae11 100644 --- a/src/ui/dialog/aboutbox.cpp +++ b/src/ui/dialog/aboutbox.cpp @@ -452,13 +452,13 @@ void AboutBox::initStrings() { */ gchar const *allTranslators = "3ARRANO.com <3arrano@3arrano.com>, 2005.\n" -"Adib Taraben , 2004.\n" +"Adib Taraben , 2004-2014.\n" "Alan Monfort , 2009-2010.\n" "Alastair McKinstry , 2000.\n" "Aleksandar Urošević , 2004-2006.\n" "Alessio Frusciante , 2002, 2003.\n" "Alexander Shopov , 2006.\n" -"Alexandre Prokoudine , 2005, 2010-2013.\n" +"Alexandre Prokoudine , 2005, 2010-2014.\n" "Alexey Remizov , 2004.\n" "Ali Ghanavatian , 2010.\n" "Álvaro Lopes , 2001, 2002.\n" @@ -503,7 +503,7 @@ void AboutBox::initStrings() { "Hleb Valoshka <375gnu@gmail.com>, 2008-2009.\n" "Hizkuntza Politikarako Sailburuordetza , 2005.\n" "Ilia Penev , 2006.\n" -"Ivan Masár , 2006-2010. \n" +"Ivan Masár , 2006-2014. \n" "Ivan Řihošek , 2014.\n" "Iñaki Larrañaga , 2006.\n" "Jānis Eisaks , 2012-2014.\n" @@ -537,7 +537,7 @@ void AboutBox::initStrings() { "Mahesh subedi , 2006.\n" "Martin Srebotnjak, , 2005, 2010.\n" "Masatake YAMATO , 2002.\n" -"Masato Hashimoto , 2009-2012.\n" +"Masato Hashimoto , 2009-2014.\n" "Matiphas , 2004-2006.\n" "Mattias Hultgren , 2005, 2006.\n" "Maxim Dziumanenko , 2004.\n" @@ -553,7 +553,7 @@ void AboutBox::initStrings() { "Przemysław Loesch , 2005.\n" "Quico Llach , 2000. Traducció sodipodi.\n" "Raymond Ostertag , 2002, 2003.\n" -"Riku Leino , 2006.\n" +"Riku Leino , 2006-2011.\n" "Rune Rønde Laursen , 2006.\n" "Ruud Steltenpool , 2006.\n" "Serdar Soytetir , 2005.\n" @@ -569,9 +569,11 @@ void AboutBox::initStrings() { "Thiago Pimentel , 2006.\n" "Toshifumi Sato , 2005.\n" "Jon South , 2006. \n" -"Uwe Schöler , 2006-2013.\n" +"Uwe Schöler , 2006-2014.\n" "Valek Filippov , 2000, 2003.\n" "Victor Dachev , 2006.\n" +"Victor Westmann , 2011, 2014.\n" +"Ville Pätsi, 2013.\n" "Vincent van Adrighem , 2003.\n" "Vital Khilko , 2003.\n" "Vitaly Lipatov , 2002, 2004.\n" @@ -584,7 +586,7 @@ void AboutBox::initStrings() { "Yaron Shahrabani , 2009.\n" "Yukihiro Nakai , 2000, 2003.\n" "Yuri Beznos , 2006.\n" -"Yuri Chornoivan , 2007-2013.\n" +"Yuri Chornoivan , 2007-2014.\n" "Yuri Syrota , 2000.\n" "Yves Guillou , 2004.\n" "Zdenko Podobný , 2003, 2004." -- cgit v1.2.3 From e2ae473da92a1f96e307e3f1f3e206cad7bd1c38 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Thu, 23 Oct 2014 19:33:47 -0700 Subject: Initial removal of box3d outdated GTKish macros. (bzr r13634) --- src/ui/clipboard.cpp | 131 ++++++++++++++++++++++++++----------------- src/ui/tools/select-tool.cpp | 78 ++++++++++++++++---------- src/ui/tools/spray-tool.cpp | 32 +++++++---- src/ui/tools/tweak-tool.cpp | 86 ++++++++++++++++------------ 4 files changed, 195 insertions(+), 132 deletions(-) (limited to 'src/ui') diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index 1209b19cd..031a92924 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -505,12 +505,15 @@ bool ClipboardManagerImpl::pasteSize(SPDesktop *desktop, bool separately, bool a // resize each object in the selection if (separately) { for (GSList *i = const_cast(selection->itemList()) ; i ; i = i->next) { - SPItem *item = SP_ITEM(i->data); - Geom::OptRect obj_size = item->desktopVisualBounds(); - if ( !obj_size ) { - continue; + SPItem *item = dynamic_cast(static_cast(i->data)); + if (item) { + Geom::OptRect obj_size = item->desktopVisualBounds(); + if ( obj_size ) { + sp_item_scale_rel(item, _getScale(desktop, min, max, *obj_size, apply_x, apply_y)); + } + } else { + g_assert_not_reached(); } - sp_item_scale_rel(item, _getScale(desktop, min, max, *obj_size, apply_x, apply_y)); } } // resize the selection as a whole @@ -640,7 +643,12 @@ void ClipboardManagerImpl::_copySelection(Inkscape::Selection *selection) GSList const *items = selection->itemList(); // copy the defs used by all items for (GSList *i = const_cast(items) ; i != NULL ; i = i->next) { - _copyUsedDefs(SP_ITEM (i->data)); + SPItem *item = dynamic_cast(static_cast(i->data)); + if (item) { + _copyUsedDefs(item); + } else { + g_assert_not_reached(); + } } // copy the representation of the items @@ -648,36 +656,38 @@ void ClipboardManagerImpl::_copySelection(Inkscape::Selection *selection) sorted_items = g_slist_sort(sorted_items, (GCompareFunc) sp_object_compare_position); for (GSList *i = sorted_items ; i ; i = i->next) { - if (!SP_IS_ITEM(i->data)) { - continue; + SPItem *item = dynamic_cast(static_cast(i->data)); + if (item) { + Inkscape::XML::Node *obj = item->getRepr(); + Inkscape::XML::Node *obj_copy = _copyNode(obj, _doc, _root); + + // copy complete inherited style + SPCSSAttr *css = sp_repr_css_attr_inherited(obj, "style"); + sp_repr_css_set(obj_copy, css, "style"); + sp_repr_css_attr_unref(css); + + // write the complete accumulated transform passed to us + // (we're dealing with unattached representations, so we write to their attributes + // instead of using sp_item_set_transform) + gchar *transform_str = sp_svg_transform_write(item->i2doc_affine()); + obj_copy->setAttribute("transform", transform_str); + g_free(transform_str); } - Inkscape::XML::Node *obj = reinterpret_cast(i->data)->getRepr(); - Inkscape::XML::Node *obj_copy = _copyNode(obj, _doc, _root); - - // copy complete inherited style - SPCSSAttr *css = sp_repr_css_attr_inherited(obj, "style"); - sp_repr_css_set(obj_copy, css, "style"); - sp_repr_css_attr_unref(css); - - // write the complete accumulated transform passed to us - // (we're dealing with unattached representations, so we write to their attributes - // instead of using sp_item_set_transform) - gchar *transform_str = sp_svg_transform_write(SP_ITEM(i->data)->i2doc_affine()); - obj_copy->setAttribute("transform", transform_str); - g_free(transform_str); } // copy style for Paste Style action if (sorted_items) { - if (SP_IS_ITEM(sorted_items->data)) { - SPCSSAttr *style = take_style_from_item((SPItem *) sorted_items->data); + SPObject *object = static_cast(sorted_items->data); + SPItem *item = dynamic_cast(object); + if (item) { + SPCSSAttr *style = take_style_from_item(item); sp_repr_css_set(_clipnode, style, "style"); sp_repr_css_attr_unref(style); } // copy path effect from the first path - if (SP_IS_OBJECT(sorted_items->data)) { - gchar const *effect = reinterpret_cast(sorted_items->data)->getRepr()->attribute("inkscape:path-effect"); + if (object) { + gchar const *effect =object->getRepr()->attribute("inkscape:path-effect"); if (effect) { _clipnode->setAttribute("inkscape:path-effect", effect); } @@ -704,35 +714,38 @@ void ClipboardManagerImpl::_copyUsedDefs(SPItem *item) if (style && (style->fill.isPaintserver())) { SPPaintServer *server = item->style->getFillPaintServer(); - if ( SP_IS_LINEARGRADIENT(server) || SP_IS_RADIALGRADIENT(server) ) { - _copyGradient(SP_GRADIENT(server)); + if ( dynamic_cast(server) || dynamic_cast(server) ) { + _copyGradient(dynamic_cast(server)); } - if ( SP_IS_PATTERN(server) ) { - _copyPattern(SP_PATTERN(server)); + SPPattern *pattern = dynamic_cast(server); + if ( pattern ) { + _copyPattern(pattern); } } if (style && (style->stroke.isPaintserver())) { SPPaintServer *server = item->style->getStrokePaintServer(); - if ( SP_IS_LINEARGRADIENT(server) || SP_IS_RADIALGRADIENT(server) ) { - _copyGradient(SP_GRADIENT(server)); + if ( dynamic_cast(server) || dynamic_cast(server) ) { + _copyGradient(dynamic_cast(server)); } - if ( SP_IS_PATTERN(server) ) { - _copyPattern(SP_PATTERN(server)); + SPPattern *pattern = dynamic_cast(server); + if ( pattern ) { + _copyPattern(pattern); } } // For shapes, copy all of the shape's markers - if (SP_IS_SHAPE(item)) { - SPShape *shape = SP_SHAPE (item); + SPShape *shape = dynamic_cast(item); + if (shape) { for (int i = 0 ; i < SP_MARKER_LOC_QTY ; i++) { if (shape->_marker[i]) { _copyNode(shape->_marker[i]->getRepr(), _doc, _defs); } } } + // For lpe items, copy lpe stack if applicable - if (SP_IS_LPE_ITEM(item)) { - SPLPEItem *lpeitem = SP_LPE_ITEM (item); + SPLPEItem *lpeitem = dynamic_cast(item); + if (lpeitem) { if (lpeitem->hasPathEffect()) { for (PathEffectList::iterator it = lpeitem->path_effect_list->begin(); it != lpeitem->path_effect_list->end(); ++it) { @@ -743,14 +756,24 @@ void ClipboardManagerImpl::_copyUsedDefs(SPItem *item) } } } + // For 3D boxes, copy perspectives - if (SP_IS_BOX3D(item)) { - _copyNode(box3d_get_perspective(SP_BOX3D(item))->getRepr(), _doc, _defs); + { + SPBox3D *box = dynamic_cast(item); + if (box) { + _copyNode(box3d_get_perspective(box)->getRepr(), _doc, _defs); + } } + // Copy text paths - if (SP_IS_TEXT_TEXTPATH(item)) { - _copyTextPath(SP_TEXTPATH(item->firstChild())); + { + SPText *text = dynamic_cast(item); + SPTextPath *textpath = (text) ? dynamic_cast(text->firstChild()) : NULL; + if (textpath) { + _copyTextPath(textpath); + } } + // Copy clipping objects if (item->clip_ref){ if (item->clip_ref->getObject()) { @@ -764,8 +787,9 @@ void ClipboardManagerImpl::_copyUsedDefs(SPItem *item) _copyNode(mask->getRepr(), _doc, _defs); // recurse into the mask for its gradients etc. for (SPObject *o = mask->children ; o != NULL ; o = o->next) { - if (SP_IS_ITEM(o)) { - _copyUsedDefs(SP_ITEM(o)); + SPItem *childItem = dynamic_cast(o); + if (childItem) { + _copyUsedDefs(childItem); } } } @@ -774,15 +798,16 @@ void ClipboardManagerImpl::_copyUsedDefs(SPItem *item) // Copy filters if (style->getFilter()) { SPObject *filter = style->getFilter(); - if (SP_IS_FILTER(filter)) { + if (dynamic_cast(filter)) { _copyNode(filter->getRepr(), _doc, _defs); } } // recurse for (SPObject *o = item->children ; o != NULL ; o = o->next) { - if (SP_IS_ITEM(o)) { - _copyUsedDefs(SP_ITEM(o)); + SPItem *childItem = dynamic_cast(o); + if (childItem) { + _copyUsedDefs(childItem); } } } @@ -817,10 +842,10 @@ void ClipboardManagerImpl::_copyPattern(SPPattern *pattern) // items in the pattern may also use gradients and other patterns, so recurse for ( SPObject *child = pattern->firstChild() ; child ; child = child->getNext() ) { - if (!SP_IS_ITEM (child)) { - continue; + SPItem *childItem = dynamic_cast(child); + if (childItem) { + _copyUsedDefs(childItem); } - _copyUsedDefs(SP_ITEM(child)); } if (pattern->ref){ pattern = pattern->ref->getObject(); @@ -939,13 +964,13 @@ void ClipboardManagerImpl::_applyPathEffect(SPItem *item, gchar const *effectsta if ( item == NULL ) { return; } - if ( SP_IS_RECT(item) ) { + if ( dynamic_cast(item) ) { return; } - if (SP_IS_LPE_ITEM(item)) + SPLPEItem *lpeitem = dynamic_cast(item); + if (lpeitem) { - SPLPEItem *lpeitem = SP_LPE_ITEM(item); // for each effect in the stack, check if we need to fork it before adding it to the item lpeitem->forkPathEffectsIfNecessary(1); diff --git a/src/ui/tools/select-tool.cpp b/src/ui/tools/select-tool.cpp index 83bef17c9..21f37e83d 100644 --- a/src/ui/tools/select-tool.cpp +++ b/src/ui/tools/select-tool.cpp @@ -264,15 +264,16 @@ sp_select_context_up_one_layer(SPDesktop *desktop) SPObject *const current_layer = desktop->currentLayer(); if (current_layer) { SPObject *const parent = current_layer->parent; + SPGroup *current_group = dynamic_cast(current_layer); if ( parent && ( parent->parent - || !( SP_IS_GROUP(current_layer) - && ( SPGroup::LAYER - == SP_GROUP(current_layer)->layerMode() ) ) ) ) + || !( current_group + && ( SPGroup::LAYER == current_group->layerMode() ) ) ) ) { desktop->setCurrentLayer(parent); - if (SP_IS_GROUP(current_layer) && SPGroup::LAYER != SP_GROUP(current_layer)->layerMode()) + if (current_group && (SPGroup::LAYER != current_group->layerMode())) { sp_desktop_selection(desktop)->set(current_layer); + } } } } @@ -403,7 +404,8 @@ void SelectTool::sp_select_context_cycle_through_items(Inkscape::Selection *sele } Inkscape::DrawingItem *arenaitem; - SPItem *item = SP_ITEM(this->cycling_cur_item->data); + SPItem *item = dynamic_cast(static_cast(cycling_cur_item->data)); + g_assert(item != NULL); // Deactivate current item if (!g_list_find(this->cycling_items_selected_before, item) && selection->includes(item)) { @@ -427,7 +429,8 @@ void SelectTool::sp_select_context_cycle_through_items(Inkscape::Selection *sele if (next) { this->cycling_cur_item = next; - item = SP_ITEM(this->cycling_cur_item->data); + item = dynamic_cast(static_cast(this->cycling_cur_item->data)); + g_assert(item != NULL); } arenaitem = item->get_arenaitem(desktop->dkey); @@ -442,8 +445,13 @@ void SelectTool::sp_select_context_cycle_through_items(Inkscape::Selection *sele void SelectTool::sp_select_context_reset_opacities() { for (GList *l = this->cycling_items; l != NULL; l = g_list_next(l)) { - Inkscape::DrawingItem *arenaitem = SP_ITEM(l->data)->get_arenaitem(this->desktop->dkey); - arenaitem->setOpacity(SP_SCALE24_TO_FLOAT(SP_ITEM(l->data)->style->opacity.value)); + SPItem *item = dynamic_cast(static_cast(l->data)); + if (item) { + Inkscape::DrawingItem *arenaitem = item->get_arenaitem(desktop->dkey); + arenaitem->setOpacity(SP_SCALE24_TO_FLOAT(item->style->opacity.value)); + } else { + g_assert_not_reached(); + } } g_list_free(this->cycling_items); @@ -475,8 +483,8 @@ bool SelectTool::root_handler(GdkEvent* event) { if (!selection->isEmpty()) { SPItem *clicked_item = static_cast(selection->itemList()->data); - if (SP_IS_GROUP(clicked_item) && !SP_IS_BOX3D(clicked_item)) { // enter group if it's not a 3D box - desktop->setCurrentLayer(reinterpret_cast(clicked_item)); + if (dynamic_cast(clicked_item) && !dynamic_cast(clicked_item)) { // enter group if it's not a 3D box + desktop->setCurrentLayer(clicked_item); sp_desktop_selection(desktop)->clear(); this->dragging = false; sp_event_context_discard_delayed_snap_event(this); @@ -591,8 +599,11 @@ bool SelectTool::root_handler(GdkEvent* event) { item_in_group = desktop->getItemAtPoint(Geom::Point(event->button.x, event->button.y), TRUE); group_at_point = desktop->getGroupAtPoint(Geom::Point(event->button.x, event->button.y)); - if (SP_IS_LAYER(selection->single())) { - group_at_point = SP_GROUP(selection->single()); + { + SPGroup *selGroup = dynamic_cast(selection->single()); + if (selGroup && (selGroup->layerMode() == SPGroup::LAYER)) { + group_at_point = selGroup; + } } // group-at-point is meant to be topmost item if it's a group, @@ -673,10 +684,11 @@ bool SelectTool::root_handler(GdkEvent* event) { selection->toggle(this->item); } else { SPObject* single = selection->single(); + SPGroup *singleGroup = dynamic_cast(single); // without shift, increase state (i.e. toggle scale/rotation handles) if (selection->includes(this->item)) { _seltrans->increaseState(); - } else if (SP_IS_LAYER(single) && single->isAncestorOf(this->item)) { + } else if (singleGroup && (singleGroup->layerMode() == SPGroup::LAYER) && single->isAncestorOf(this->item)) { _seltrans->increaseState(); } else { _seltrans->resetState(); @@ -818,7 +830,7 @@ bool SelectTool::root_handler(GdkEvent* event) { SPItem *item = desktop->getItemAtPoint(p, true, NULL); // Save pointer to current cycle-item so that we can find it again later, in the freshly built list - SPItem *tmp_cur_item = this->cycling_cur_item ? SP_ITEM(this->cycling_cur_item->data) : NULL; + SPItem *tmp_cur_item = this->cycling_cur_item ? dynamic_cast(static_cast(this->cycling_cur_item->data)) : NULL; g_list_free(this->cycling_items); this->cycling_items = NULL; this->cycling_cur_item = NULL; @@ -851,11 +863,14 @@ bool SelectTool::root_handler(GdkEvent* event) { Inkscape::DrawingItem *arenaitem; for(GList *l = this->cycling_items_cmp; l != NULL; l = l->next) { - arenaitem = SP_ITEM(l->data)->get_arenaitem(desktop->dkey); - arenaitem->setOpacity(1.0); - //if (!shift_pressed && !g_list_find(this->cycling_items_selected_before, SP_ITEM(l->data)) && selection->includes(SP_ITEM(l->data))) - if (!g_list_find(this->cycling_items_selected_before, SP_ITEM(l->data)) && selection->includes(SP_ITEM(l->data))) { - selection->remove(SP_ITEM(l->data)); + SPItem *item = dynamic_cast(static_cast(l->data)); + if (item) { + arenaitem = item->get_arenaitem(desktop->dkey); + arenaitem->setOpacity(1.0); + //if (!shift_pressed && !g_list_find(this->cycling_items_selected_before, item) && selection->includes(item)) + if (!g_list_find(this->cycling_items_selected_before, item) && selection->includes(item)) { + selection->remove(item); + } } } @@ -869,16 +884,19 @@ bool SelectTool::root_handler(GdkEvent* event) { // ... and rebuild them with the new items. this->cycling_items_cmp = g_list_copy(this->cycling_items); - SPItem *item; for(GList *l = this->cycling_items; l != NULL; l = l->next) { - item = SP_ITEM(l->data); - arenaitem = item->get_arenaitem(desktop->dkey); - arenaitem->setOpacity(0.3); - - if (selection->includes(item)) { - // already selected items are stored separately, too - this->cycling_items_selected_before = g_list_append(this->cycling_items_selected_before, item); + SPItem *item = dynamic_cast(static_cast(l->data)); + if (item) { + arenaitem = item->get_arenaitem(desktop->dkey); + arenaitem->setOpacity(0.3); + + if (selection->includes(item)) { + // already selected items are stored separately, too + this->cycling_items_selected_before = g_list_append(this->cycling_items_selected_before, item); + } + } else { + g_assert_not_reached(); } } @@ -1134,9 +1152,9 @@ bool SelectTool::root_handler(GdkEvent* event) { if (MOD__CTRL_ONLY(event)) { if (selection->singleItem()) { SPItem *clicked_item = selection->singleItem(); - - if ( SP_IS_GROUP(clicked_item) || SP_IS_BOX3D(clicked_item)) { // enter group or a 3D box - desktop->setCurrentLayer(reinterpret_cast(clicked_item)); + SPGroup *clickedGroup = dynamic_cast(clicked_item); + if ( (clickedGroup && (clickedGroup->layerMode() == SPGroup::LAYER)) || dynamic_cast(clicked_item)) { // enter group or a 3D box + desktop->setCurrentLayer(clicked_item); sp_desktop_selection(desktop)->clear(); } else { this->desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Selected object is not a group. Cannot enter.")); diff --git a/src/ui/tools/spray-tool.cpp b/src/ui/tools/spray-tool.cpp index 29f1b9a73..e15dbb59f 100644 --- a/src/ui/tools/spray-tool.cpp +++ b/src/ui/tools/spray-tool.cpp @@ -384,11 +384,14 @@ static bool sp_spray_recursive(SPDesktop *desktop, gint _distrib) { bool did = false; - - if (SP_IS_BOX3D(item) ) { - // convert 3D boxes to ordinary groups before spraying their shapes - item = box3d_convert_to_group(SP_BOX3D(item)); - selection->add(item); + + { + SPBox3D *box = dynamic_cast(item); + if (box) { + // convert 3D boxes to ordinary groups before spraying their shapes + item = box3d_convert_to_group(box); + selection->add(item); + } } double _fid = g_random_double_range(0, 1); @@ -413,7 +416,7 @@ static bool sp_spray_recursive(SPDesktop *desktop, parent->appendChild(copy); SPObject *new_obj = doc->getObjectByRepr(copy); - item_copied = SP_ITEM(new_obj); // Convertion object->item + item_copied = dynamic_cast(new_obj); // Convertion object->item Geom::Point center=item->getCenter(); sp_spray_scale_rel(center,desktop, item_copied, Geom::Scale(_scale,_scale)); sp_spray_scale_rel(center,desktop, item_copied, Geom::Scale(scale,scale)); @@ -437,7 +440,7 @@ static bool sp_spray_recursive(SPDesktop *desktop, items != NULL; items = items->next) { - SPItem *item1 = SP_ITEM(items->data); + SPItem *item1 = dynamic_cast(static_cast(items->data)); if (i == 1) { parent_item = item1; } @@ -458,7 +461,7 @@ static bool sp_spray_recursive(SPDesktop *desktop, Inkscape::XML::Node *copy = old_repr->duplicate(xml_doc); parent->appendChild(copy); SPObject *new_obj = doc->getObjectByRepr(copy); - item_copied = SP_ITEM(new_obj); + item_copied = dynamic_cast(new_obj); // Move around the cursor Geom::Point move = (Geom::Point(cos(tilt)*cos(dp)*dr/(1-ratio)+sin(tilt)*sin(dp)*dr/(1+ratio), -sin(tilt)*cos(dp)*dr/(1-ratio)+cos(tilt)*sin(dp)*dr/(1+ratio)))+(p-a->midpoint()); @@ -503,7 +506,7 @@ static bool sp_spray_recursive(SPDesktop *desktop, SPObject *clone_object = doc->getObjectByRepr(clone); // Conversion object->item - item_copied = SP_ITEM(clone_object); + item_copied = dynamic_cast(clone_object); Geom::Point center = item->getCenter(); sp_spray_scale_rel(center, desktop, item_copied, Geom::Scale(_scale, _scale)); sp_spray_scale_rel(center, desktop, item_copied, Geom::Scale(scale, scale)); @@ -554,13 +557,16 @@ static bool sp_spray_dilate(SprayTool *tc, Geom::Point /*event_p*/, Geom::Point for (GSList *items = original_selection; items != NULL; items = items->next) { - sp_object_ref(SP_ITEM(items->data)); + SPItem *item = dynamic_cast(static_cast(items->data)); + g_assert(item != NULL); + sp_object_ref(item); } for (GSList *items = original_selection; items != NULL; items = items->next) { - SPItem *item = SP_ITEM(items->data); + SPItem *item = dynamic_cast(static_cast(items->data)); + g_assert(item != NULL); if (is_transform_modes(tc->mode)) { if (sp_spray_recursive(desktop, selection, item, p, vector, tc->mode, radius, move_force, tc->population, tc->scale, tc->scale_variation, reverse, move_mean, move_standard_deviation, tc->ratio, tc->tilt, tc->rotation_variation, tc->distrib)) { @@ -576,7 +582,9 @@ static bool sp_spray_dilate(SprayTool *tc, Geom::Point /*event_p*/, Geom::Point for (GSList *items = original_selection; items != NULL; items = items->next) { - sp_object_unref(SP_ITEM(items->data)); + SPItem *item = dynamic_cast(static_cast(items->data)); + g_assert(item != NULL); + sp_object_unref(item); } } diff --git a/src/ui/tools/tweak-tool.cpp b/src/ui/tools/tweak-tool.cpp index 75650d3af..571a17b70 100644 --- a/src/ui/tools/tweak-tool.cpp +++ b/src/ui/tools/tweak-tool.cpp @@ -372,13 +372,16 @@ sp_tweak_dilate_recursive (Inkscape::Selection *selection, SPItem *item, Geom::P { bool did = false; - if (SP_IS_BOX3D(item) && !is_transform_mode(mode) && !is_color_mode(mode)) { - // convert 3D boxes to ordinary groups before tweaking their shapes - item = box3d_convert_to_group(SP_BOX3D(item)); - selection->add(item); + { + SPBox3D *box = dynamic_cast(item); + if (box && !is_transform_mode(mode) && !is_color_mode(mode)) { + // convert 3D boxes to ordinary groups before tweaking their shapes + item = box3d_convert_to_group(box); + selection->add(item); + } } - if (SP_IS_TEXT(item) || SP_IS_FLOWTEXT(item)) { + if (dynamic_cast(item) || dynamic_cast(item)) { GSList *items = g_slist_prepend (NULL, item); GSList *selected = NULL; GSList *to_select = NULL; @@ -387,22 +390,25 @@ sp_tweak_dilate_recursive (Inkscape::Selection *selection, SPItem *item, Geom::P g_slist_free (items); SPObject* newObj = doc->getObjectByRepr(static_cast(to_select->data)); g_slist_free (to_select); - item = SP_ITEM(newObj); + item = dynamic_cast(newObj); + g_assert(item != NULL); selection->add(item); } - if (SP_IS_GROUP(item) && !SP_IS_BOX3D(item)) { + if (dynamic_cast(item) && !dynamic_cast(item)) { GSList *children = NULL; for (SPObject *child = item->firstChild() ; child; child = child->getNext() ) { - if (SP_IS_ITEM(child)) { + if (dynamic_cast(static_cast(child))) { children = g_slist_prepend(children, child); } } for (GSList *i = children; i; i = i->next) { - SPItem *child = SP_ITEM(i->data); - if (sp_tweak_dilate_recursive (selection, SP_ITEM(child), p, vector, mode, radius, force, fidelity, reverse)) + SPItem *child = dynamic_cast(static_cast(i->data)); + g_assert(child != NULL); + if (sp_tweak_dilate_recursive (selection, child, p, vector, mode, radius, force, fidelity, reverse)) { did = true; + } } g_slist_free(children); @@ -509,13 +515,13 @@ sp_tweak_dilate_recursive (Inkscape::Selection *selection, SPItem *item, Geom::P } } - } else if (SP_IS_PATH(item) || SP_IS_SHAPE(item)) { + } else if (dynamic_cast(item) || dynamic_cast(item)) { Inkscape::XML::Node *newrepr = NULL; gint pos = 0; Inkscape::XML::Node *parent = NULL; char const *id = NULL; - if (!SP_IS_PATH(item)) { + if (!dynamic_cast(item)) { newrepr = sp_selected_item_to_curved_repr(item, 0); if (!newrepr) { return false; @@ -631,7 +637,8 @@ sp_tweak_dilate_recursive (Inkscape::Selection *selection, SPItem *item, Geom::P if (newrepr) { newrepr->setAttribute("d", str); } else { - if (SP_IS_LPE_ITEM(item) && SP_LPE_ITEM(item)->hasPathEffectRecursive()) { + SPLPEItem *lpeitem = dynamic_cast(item); + if (lpeitem && lpeitem->hasPathEffectRecursive()) { item->getRepr()->setAttribute("inkscape:original-d", str); } else { item->getRepr()->setAttribute("d", str); @@ -769,7 +776,7 @@ static void tweak_colors_in_gradient(SPItem *item, Inkscape::PaintTarget fill_or { SPGradient *gradient = getGradient(item, fill_or_stroke); - if (!gradient || !SP_IS_GRADIENT(gradient)) { + if (!gradient || !dynamic_cast(gradient)) { return; } @@ -780,9 +787,9 @@ static void tweak_colors_in_gradient(SPItem *item, Inkscape::PaintTarget fill_or double pos = 0; double r = 0; - if (SP_IS_LINEARGRADIENT(gradient)) { - SPLinearGradient *lg = SP_LINEARGRADIENT(gradient); + SPLinearGradient *lg = dynamic_cast(gradient); + if (lg) { Geom::Point p1(lg->x1.computed, lg->y1.computed); Geom::Point p2(lg->x2.computed, lg->y2.computed); Geom::Point pdiff(p2 - p1); @@ -800,11 +807,13 @@ static void tweak_colors_in_gradient(SPItem *item, Inkscape::PaintTarget fill_or // Calculate radius in lenfth-of-gradient-line units r = radius / vl; - } else if (SP_IS_RADIALGRADIENT(gradient)) { - SPRadialGradient *rg = SP_RADIALGRADIENT(gradient); - Geom::Point c (rg->cx.computed, rg->cy.computed); - pos = Geom::L2(p - c) / rg->r.computed; - r = radius / rg->r.computed; + } else { + SPRadialGradient *rg = dynamic_cast(gradient); + if (rg) { + Geom::Point c (rg->cx.computed, rg->cy.computed); + pos = Geom::L2(p - c) / rg->r.computed; + r = radius / rg->r.computed; + } } // Normalize pos to 0..1, taking into accound gradient spread: @@ -836,14 +845,16 @@ static void tweak_colors_in_gradient(SPItem *item, Inkscape::PaintTarget fill_or double offset_h = 0; SPObject *child_prev = NULL; for (SPObject *child = vector->firstChild(); child; child = child->getNext()) { - if (!SP_IS_STOP(child)) { + SPStop *stop = dynamic_cast(child); + if (!stop) { continue; } - SPStop *stop = SP_STOP (child); offset_h = stop->offset; if (child_prev) { + SPStop *prevStop = dynamic_cast(child_prev); + g_assert(prevStop != NULL); if (offset_h - offset_l > r && pos_e >= offset_l && pos_e <= offset_h) { // the summit falls in this interstop, and the radius is small, @@ -853,9 +864,9 @@ static void tweak_colors_in_gradient(SPItem *item, Inkscape::PaintTarget fill_or tweak_color (mode, stop->specified_color.v.c, rgb_goal, force * (pos_e - offset_l) / (offset_h - offset_l), do_h, do_s, do_l); - tweak_color (mode, SP_STOP(child_prev)->specified_color.v.c, rgb_goal, - force * (offset_h - pos_e) / (offset_h - offset_l), - do_h, do_s, do_l); + tweak_color(mode, prevStop->specified_color.v.c, rgb_goal, + force * (offset_h - pos_e) / (offset_h - offset_l), + do_h, do_s, do_l); stop->updateRepr(); child_prev->updateRepr(); break; @@ -863,9 +874,9 @@ static void tweak_colors_in_gradient(SPItem *item, Inkscape::PaintTarget fill_or // wide brush, may affect more than 2 stops, // paint each stop by the force from the profile curve if (offset_l <= pos_e && offset_l > pos_e - r) { - tweak_color (mode, SP_STOP(child_prev)->specified_color.v.c, rgb_goal, - force * tweak_profile (fabs (pos_e - offset_l), r), - do_h, do_s, do_l); + tweak_color(mode, prevStop->specified_color.v.c, rgb_goal, + force * tweak_profile (fabs (pos_e - offset_l), r), + do_h, do_s, do_l); child_prev->updateRepr(); } @@ -894,10 +905,11 @@ sp_tweak_color_recursive (guint mode, SPItem *item, SPItem *item_at_point, { bool did = false; - if (SP_IS_GROUP(item)) { + if (dynamic_cast(item)) { for (SPObject *child = item->firstChild() ; child; child = child->getNext() ) { - if (SP_IS_ITEM(child)) { - if (sp_tweak_color_recursive (mode, SP_ITEM(child), item_at_point, + SPItem *childItem = dynamic_cast(child); + if (childItem) { + if (sp_tweak_color_recursive (mode, childItem, item_at_point, fill_goal, do_fill, stroke_goal, do_stroke, opacity_goal, do_opacity, @@ -953,11 +965,11 @@ sp_tweak_color_recursive (guint mode, SPItem *item, SPItem *item_at_point, //cycle through filter primitives SPObject *primitive_obj = style->getFilter()->children; while (primitive_obj) { - if (SP_IS_FILTER_PRIMITIVE(primitive_obj)) { - SPFilterPrimitive *primitive = SP_FILTER_PRIMITIVE(primitive_obj); + SPFilterPrimitive *primitive = dynamic_cast(primitive_obj); + if (primitive) { //if primitive is gaussianblur - if(SP_IS_GAUSSIANBLUR(primitive)) { - SPGaussianBlur * spblur = SP_GAUSSIANBLUR(primitive); + SPGaussianBlur * spblur = dynamic_cast(primitive); + if (spblur) { float num = spblur->stdDeviation.getNumber(); blur_now += num * i2dt.descrim(); // sum all blurs in the filter } @@ -1080,7 +1092,7 @@ sp_tweak_dilate (TweakTool *tc, Geom::Point event_p, Geom::Point p, Geom::Point items != NULL; items = items->next) { - SPItem *item = SP_ITEM(items->data); + SPItem *item = dynamic_cast(static_cast(items->data)); if (is_color_mode (tc->mode)) { if (do_fill || do_stroke || do_opacity) { -- cgit v1.2.3 From 0d7c3ee0a778bfc2f5e5cbc1701ee6cd12e62012 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Fri, 24 Oct 2014 21:50:14 -0700 Subject: Cleaned casts from sp-shape by fixing member type. (bzr r13638) --- src/ui/clipboard.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/ui') diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index 031a92924..4b4b14c22 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -54,6 +54,7 @@ #include <2geom/transforms.h> #include "box3d.h" #include "gradient-drag.h" +#include "marker.h" #include "sp-item.h" #include "sp-item-transform.h" // for sp_item_scale_rel, used in _pasteSize #include "sp-path.h" -- cgit v1.2.3