2020-09-03 21:31:31 +00:00
diff --git a/src/extension/system.cpp b/src/extension/system.cpp
2020-09-04 15:57:04 +00:00
index 08de0b4..418f5ba 100644
2020-09-03 21:31:31 +00:00
--- a/src/extension/system.cpp
+++ b/src/extension/system.cpp
@@ -174,7 +174,7 @@ open_internal(Extension *in_plug, gpointer in_data)
// skip all the rest if we already found a function to open it
// since they're ordered by preference now.
if (!*pimod) {
- gchar const *ext = dynamic_cast<Input *>(in_plug)->get_extension();
+ gchar const *ext = dynamic_cast<Input &>(*in_plug).get_extension();
gchar *filenamelower = g_utf8_strdown(filename, -1);
gchar *extensionlower = g_utf8_strdown(ext, -1);
@@ -384,7 +384,7 @@ save_internal(Extension *in_plug, gpointer in_data)
// skip all the rest if we already found someone to save it
// since they're ordered by preference now.
if (!*pomod) {
- gchar const *ext = dynamic_cast<Output *>(in_plug)->get_extension();
+ gchar const *ext = dynamic_cast<Output &>(*in_plug).get_extension();
gchar *filenamelower = g_utf8_strdown(filename, -1);
gchar *extensionlower = g_utf8_strdown(ext, -1);
2020-09-04 15:57:04 +00:00
diff --git a/src/object/object-set.cpp b/src/object/object-set.cpp
index bf41bb0..dafa2c1 100644
--- a/src/object/object-set.cpp
+++ b/src/object/object-set.cpp
@@ -242,7 +242,7 @@ void ObjectSet::set(SPObject *object, bool persist_selection_context) {
_clear();
_add(object);
if(dynamic_cast<Inkscape::Selection*>(this))
- return dynamic_cast<Inkscape::Selection*>(this)->_emitChanged(persist_selection_context);
+ return dynamic_cast<Inkscape::Selection&>(*this)._emitChanged(persist_selection_context);
}
void ObjectSet::setReprList(std::vector<XML::Node*> const &list) {
@@ -257,7 +257,7 @@ void ObjectSet::setReprList(std::vector<XML::Node*> const &list) {
}
_emitSignals();
if(dynamic_cast<Inkscape::Selection*>(this))
- return dynamic_cast<Inkscape::Selection*>(this)->_emitChanged();//
+ return dynamic_cast<Inkscape::Selection&>(*this)._emitChanged();//
}
diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp
index 88c5d8d..c4c3788 100644
--- a/src/selection-chemistry.cpp
+++ b/src/selection-chemistry.cpp
@@ -680,7 +680,7 @@ static void sp_edit_select_all_full(SPDesktop *dt, bool force_all_layers, bool i
switch (inlayer) {
case PREFS_SELECTION_LAYER: {
- if ( (onlysensitive && dynamic_cast<SPItem *>(dt->currentLayer())->isLocked()) ||
+ if ( (onlysensitive && dynamic_cast<SPItem &>(*dt->currentLayer()).isLocked()) ||
(onlyvisible && dt->itemIsHidden(dynamic_cast<SPItem *>(dt->currentLayer()))) )
return;
@@ -775,7 +775,7 @@ Inkscape::XML::Node* ObjectSet::group() {
Geom::Affine item_t(Geom::identity());
if (t_str)
sp_svg_transform_read(t_str, &item_t);
- item_t *= dynamic_cast<SPItem *>(doc->getObjectByRepr(current->parent()))->i2doc_affine();
+ item_t *= dynamic_cast<SPItem &>(*doc->getObjectByRepr(current->parent())).i2doc_affine();
// FIXME: when moving both clone and original from a transformed group (either by
// grouping into another parent, or by cut/paste) the transform from the original's
// parent becomes embedded into original itself, and this affects its clones. Fix
@@ -869,7 +869,7 @@ static void ungroup_impl(ObjectSet *set)
SPItem *original = use;
while (dynamic_cast<SPUse *>(original)) {
- original = dynamic_cast<SPUse *>(original)->get_original();
+ original = dynamic_cast<SPUse &>(*original).get_original();
}
if (groups.find(original) != groups.end()) {
@@ -1651,7 +1651,8 @@ void ObjectSet::applyAffine(Geom::Affine const &affine, bool set_i2d, bool compe
&& includes( sp_textpath_get_path_item(dynamic_cast<SPTextPath *>(item->firstChild())) ));
// ...both a flowtext and its frame?
- bool transform_flowtext_with_frame = (dynamic_cast<SPFlowtext *>(item) && includes( dynamic_cast<SPFlowtext *>(item)->get_frame(nullptr))); // (only the first frame is checked so far)
+ bool transform_flowtext_with_frame = (dynamic_cast<SPFlowtext *>(item) && includes(
+dynamic_cast<SPFlowtext &>(*item).get_frame(nullptr))); // (only the first frame is checked so far)
// ...both an offset and its source?
bool transform_offset_with_source = (dynamic_cast<SPOffset *>(item) && dynamic_cast<SPOffset *>(item)->sourceHref) && includes( sp_offset_get_source(dynamic_cast<SPOffset *>(item)) );
@@ -2048,19 +2049,21 @@ std::vector<SPItem*> sp_get_same_fill_or_stroke_color(SPItem *sel, std::vector<S
(type == SP_FILL_COLOR) ? iter->style->getFillPaintServer() : iter->style->getStrokePaintServer();
if ((dynamic_cast<SPLinearGradient *>(sel_server) || dynamic_cast<SPRadialGradient *>(sel_server) ||
- (dynamic_cast<SPGradient *>(sel_server) && dynamic_cast<SPGradient *>(sel_server)->getVector()->isSwatch()))
+ (dynamic_cast<SPGradient *>(sel_server) && dynamic_cast<SPGradient
+&>(*sel_server).getVector()->isSwatch()))
&&
(dynamic_cast<SPLinearGradient *>(iter_server) || dynamic_cast<SPRadialGradient *>(iter_server) ||
- (dynamic_cast<SPGradient *>(iter_server) && dynamic_cast<SPGradient *>(iter_server)->getVector()->isSwatch()))) {
- SPGradient *sel_vector = dynamic_cast<SPGradient *>(sel_server)->getVector();
- SPGradient *iter_vector = dynamic_cast<SPGradient *>(iter_server)->getVector();
+ (dynamic_cast<SPGradient *>(iter_server) && dynamic_cast<SPGradient
+&>(*iter_server).getVector()->isSwatch()))) {
+ SPGradient *sel_vector = dynamic_cast<SPGradient &>(*sel_server).getVector();
+ SPGradient *iter_vector = dynamic_cast<SPGradient &>(*iter_server).getVector();
if (sel_vector == iter_vector) {
match = true;
}
} else if (dynamic_cast<SPPattern *>(sel_server) && dynamic_cast<SPPattern *>(iter_server)) {
- SPPattern *sel_pat = dynamic_cast<SPPattern *>(sel_server)->rootPattern();
- SPPattern *iter_pat = dynamic_cast<SPPattern *>(iter_server)->rootPattern();
+ SPPattern *sel_pat = dynamic_cast<SPPattern &>(*sel_server).rootPattern();
+ SPPattern *iter_pat = dynamic_cast<SPPattern &>(*iter_server).rootPattern();
if (sel_pat == iter_pat) {
match = true;
}
diff --git a/src/text-chemistry.cpp b/src/text-chemistry.cpp
index 151be25..cce1642 100644
--- a/src/text-chemistry.cpp
+++ b/src/text-chemistry.cpp
@@ -134,7 +134,7 @@ text_put_on_path()
if (SP_IS_TEXT(text)) {
// Replace any new lines (including sodipodi:role="line") by spaces.
- dynamic_cast<SPText *>(text)->remove_newlines();
+ dynamic_cast<SPText &>(*text).remove_newlines();
}
Inkscape::Text::Layout const *layout = te_get_layout(text);
diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp
index cca4172..fe9638e 100644
--- a/src/ui/clipboard.cpp
+++ b/src/ui/clipboard.cpp
@@ -334,7 +334,7 @@ void ClipboardManagerImpl::copySymbol(Inkscape::XML::Node* symbol, gchar const*
SPObject *cmobj = _clipboardSPDoc->getObjectByRepr(repr);
if (cmobj && !user_symbol) { // convert only stock symbols
if (!Geom::are_near(scale_units, 1.0, Geom::EPSILON)) {
- dynamic_cast<SPGroup *>(cmobj)->scaleChildItemsRec(
+ dynamic_cast<SPGroup &>(*cmobj).scaleChildItemsRec(
Geom::Scale(scale_units), Geom::Point(0, SP_ACTIVE_DESKTOP->getDocument()->getHeight().value("px")),
false);
}
diff --git a/src/ui/dialog/filedialogimpl-gtkmm.cpp b/src/ui/dialog/filedialogimpl-gtkmm.cpp
index 5874cac..f119c81 100644
--- a/src/ui/dialog/filedialogimpl-gtkmm.cpp
+++ b/src/ui/dialog/filedialogimpl-gtkmm.cpp
@@ -639,7 +639,7 @@ void FileSaveDialogImplGtk::fileNameChanged() {
Glib::ustring::size_type pos = name.rfind('.');
if ( pos == Glib::ustring::npos ) return;
Glib::ustring ext = name.substr( pos ).casefold();
- if (extension && Glib::ustring(dynamic_cast<Inkscape::Extension::Output *>(extension)->get_extension()).casefold() == ext ) return;
+ if (extension && Glib::ustring(dynamic_cast<Inkscape::Extension::Output &>(*extension).get_extension()).casefold() == ext ) return;
if (knownExtensions.find(ext) == knownExtensions.end()) return;
fromCB = true;
fileTypeComboBox.set_active_text(knownExtensions[ext]->get_filetypename(true));
diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp
index 9b1e130..d1e8efd 100644
--- a/src/ui/dialog/filter-effects-dialog.cpp
+++ b/src/ui/dialog/filter-effects-dialog.cpp
@@ -477,8 +477,8 @@ private:
for(int i = 0; i < cols; ++i) {
_tree.append_column_numeric_editable("", _columns.cols[i], "%.2f");
- dynamic_cast<Gtk::CellRendererText*>(
- _tree.get_column_cell_renderer(i))->signal_edited().connect(
+ dynamic_cast<Gtk::CellRendererText&>(
+ *_tree.get_column_cell_renderer(i)).signal_edited().connect(
sigc::mem_fun(*this, &MatrixAttr::rebind));
}
@@ -575,7 +575,7 @@ public:
if(w == &_label)
return "";
else
- return dynamic_cast<const AttrWidget*>(w)->get_as_attribute();
+ return dynamic_cast<const AttrWidget&>(*w).get_as_attribute();
}
void clear_store()
@@ -2571,7 +2571,7 @@ void FilterEffectsDialog::PrimitiveList::on_drag_end(const Glib::RefPtr<Gdk::Dra
bool FilterEffectsDialog::PrimitiveList::on_scroll_timeout()
{
if(_autoscroll_y) {
- auto a = dynamic_cast<Gtk::ScrolledWindow*>(get_parent())->get_vadjustment();
+ auto a = dynamic_cast<Gtk::ScrolledWindow&>(*get_parent()).get_vadjustment();
double v = a->get_value() + _autoscroll_y;
if(v < 0)
@@ -2586,7 +2586,7 @@ bool FilterEffectsDialog::PrimitiveList::on_scroll_timeout()
if(_autoscroll_x) {
- auto a_h = dynamic_cast<Gtk::ScrolledWindow*>(get_parent())->get_hadjustment();
+ auto a_h = dynamic_cast<Gtk::ScrolledWindow&>(*get_parent()).get_hadjustment();
double h = a_h->get_value() + _autoscroll_x;
if(h < 0)
diff --git a/src/ui/dialog/paint-servers.cpp b/src/ui/dialog/paint-servers.cpp
index ec49312..2c6852f 100644
--- a/src/ui/dialog/paint-servers.cpp
+++ b/src/ui/dialog/paint-servers.cpp
@@ -283,7 +283,7 @@ Glib::RefPtr<Gdk::Pixbuf> PaintServersDialog::get_pixbuf(SPDocument *document, G
preview_document->getRoot()->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
preview_document->ensureUpToDate();
- Geom::OptRect dbox = dynamic_cast<SPItem *>(rect)->visualBounds();
+ Geom::OptRect dbox = dynamic_cast<SPItem &>(*rect).visualBounds();
if (!dbox) {
return pixbuf;
diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp
index 000f7ba..0c4bce9 100644
--- a/src/ui/dialog/svg-fonts-dialog.cpp
+++ b/src/ui/dialog/svg-fonts-dialog.cpp
@@ -826,13 +826,13 @@ Gtk::VBox* SvgFontsDialog::glyphs_tab(){
glyph_from_path_button.set_label(_("Get curves from selection..."));
glyph_from_path_button.signal_clicked().connect(sigc::mem_fun(*this, &SvgFontsDialog::set_glyph_description_from_selected_path));
- dynamic_cast<Gtk::CellRendererText*>( _GlyphsList.get_column_cell_renderer(0))->signal_edited().connect(
+ dynamic_cast<Gtk::CellRendererText&>( *_GlyphsList.get_column_cell_renderer(0)).signal_edited().connect(
sigc::mem_fun(*this, &SvgFontsDialog::glyph_name_edit));
- dynamic_cast<Gtk::CellRendererText*>( _GlyphsList.get_column_cell_renderer(1))->signal_edited().connect(
+ dynamic_cast<Gtk::CellRendererText&>( *_GlyphsList.get_column_cell_renderer(1)).signal_edited().connect(
sigc::mem_fun(*this, &SvgFontsDialog::glyph_unicode_edit));
- dynamic_cast<Gtk::CellRendererText*>( _GlyphsList.get_column_cell_renderer(2))->signal_edited().connect(
+ dynamic_cast<Gtk::CellRendererText&>( *_GlyphsList.get_column_cell_renderer(2)).signal_edited().connect(
sigc::mem_fun(*this, &SvgFontsDialog::glyph_advance_edit));
_glyphs_observer.signal_changed().connect(sigc::mem_fun(*this, &SvgFontsDialog::update_glyphs));
diff --git a/src/ui/widget/ink-flow-box.cpp b/src/ui/widget/ink-flow-box.cpp
index 8485dd9..4b1ebe2 100644
--- a/src/ui/widget/ink-flow-box.cpp
+++ b/src/ui/widget/ink-flow-box.cpp
@@ -72,7 +72,7 @@ void InkFlowBox::on_toggle(gint pos, Gtk::ToggleButton *tbutton)
bool active = true;
for (auto child : tbutton->get_parent()->get_children()) {
if (tbutton != child) {
- dynamic_cast<Gtk::ToggleButton *>(child)->set_active(active);
+ dynamic_cast<Gtk::ToggleButton &>(*child).set_active(active);
active = false;
}
}
@@ -97,7 +97,7 @@ void InkFlowBox::on_global_toggle(Gtk::ToggleButton *tbutton)
bool active = true;
for (auto child : tbutton->get_parent()->get_children()) {
if (tbutton != child) {
- dynamic_cast<Gtk::ToggleButton *>(child)->set_active(active);
+ dynamic_cast<Gtk::ToggleButton &>(*child).set_active(active);
active = false;
}
}
diff --git a/src/ui/widget/spin-button-tool-item.cpp b/src/ui/widget/spin-button-tool-item.cpp
index b283939..b8c639c 100644
--- a/src/ui/widget/spin-button-tool-item.cpp
+++ b/src/ui/widget/spin-button-tool-item.cpp
@@ -207,7 +207,7 @@ SpinButtonToolItem::process_tab(int increment)
if(dynamic_cast<SpinButtonToolItem *>(tool_item)) {
// (1) The tool item is a SpinButtonToolItem, in which case, we just pass
// focus to its spin-button
- dynamic_cast<SpinButtonToolItem *>(tool_item)->grab_button_focus();
+ dynamic_cast<SpinButtonToolItem &>(*tool_item).grab_button_focus();
handled = true;
}
else if(dynamic_cast<Gtk::SpinButton *>(tool_item->get_child())) {
diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp
index ebeb8ca..c25a217 100644
--- a/src/widgets/desktop-widget.cpp
+++ b/src/widgets/desktop-widget.cpp
@@ -1848,7 +1848,7 @@ void SPDesktopWidget::namedviewModified(SPObject *obj, guint flags)
std::vector<Gtk::Widget*> ch = Glib::wrap(GTK_CONTAINER(aux_toolbox))->get_children();
for (auto i:ch) {
if (GTK_IS_CONTAINER(i->gobj())) {
- std::vector<Gtk::Widget*> grch = dynamic_cast<Gtk::Container*>(i)->get_children();
+ std::vector<Gtk::Widget*> grch = dynamic_cast<Gtk::Container&>(*i).get_children();
for (auto j:grch) {
if (!GTK_IS_WIDGET(j->gobj())) // wasn't a widget
diff --git a/src/xml/repr-io.cpp b/src/xml/repr-io.cpp
index ac9794e..fc08250 100644
--- a/src/xml/repr-io.cpp
+++ b/src/xml/repr-io.cpp
@@ -912,7 +912,7 @@ void sp_repr_write_stream( Node *repr, Writer &out, gint indent_level,
{
switch (repr->type()) {
case Inkscape::XML::TEXT_NODE: {
- if( dynamic_cast<const Inkscape::XML::TextNode *>(repr)->is_CData() ) {
+ if( dynamic_cast<const Inkscape::XML::TextNode &>(*repr).is_CData() ) {
// Preserve CDATA sections, not converting '&' to &, etc.
out.printf( "<![CDATA[%s]]>", repr->content() );
} else {