index f8548cdc4eda0fb199276a687c923b59de6597b8..ed8d6379e4aaae48dd74060d3f0a0cf6b029abd3 100644 (file)
style_clipboard = css;
}
}
- g_free (query);
+ sp_style_unref(query);
}
size_clipboard = selection->bounds();
}
/* Snap the offset of the new item(s) to the grid */
- /* FIXME: this gridsnap fiddling is a hack. */
- Inkscape::GridSnapper &s = desktop->namedview->snap_manager.grid;
- gdouble const curr_gridsnap = s.getDistance();
- s.setDistance(NR_HUGE);
- m = s.freeSnap(Inkscape::Snapper::SNAP_POINT, m, NULL).getPoint();
- s.setDistance(curr_gridsnap);
+ SnapManager &sm = desktop->namedview->snap_manager;
+ SnapManager::SnapperList gs = sm.getGridSnappers();
+ m = sm.freeSnapAlways(Inkscape::Snapper::SNAP_POINT, m, NULL, gs).getPoint();
sp_selection_move_relative(selection, m);
}
Inkscape::GC::release(clone);
}
+ // 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
sp_document_done(sp_desktop_document(desktop), SP_VERB_EDIT_CLONE,
Q_("action|Clone"));
g_return_if_fail(doc != NULL);
g_return_if_fail(desktop->selection != NULL);
g_return_if_fail(!desktop->selection->isEmpty());
- NRRect bbox(0, 0, 0, 0);
- desktop->selection->bounds(&bbox);
- if (!nr_rect_d_test_empty(&bbox)) {
- doc->fitToRect(bbox);
+ NR::Maybe<NR::Rect> const bbox(desktop->selection->bounds());
+ if (bbox && !bbox->isEmpty()) {
+ doc->fitToRect(*bbox);
}
};
void fit_canvas_to_drawing(SPDocument *doc) {
g_return_if_fail(doc != NULL);
- NRRect bbox(0, 0, 0, 0);
- sp_document_ensure_up_to_date (doc);
- sp_item_invoke_bbox(SP_ITEM(doc->root), &bbox, sp_item_i2r_affine(SP_ITEM(doc->root)), TRUE);
-
- if (!nr_rect_d_test_empty(&bbox)) {
- doc->fitToRect(bbox);
+ sp_document_ensure_up_to_date(doc);
+ SPItem const *const root = SP_ITEM(doc->root);
+ NR::Maybe<NR::Rect> const bbox(root->getBounds(sp_item_i2r_affine(root)));
+ if (bbox && !bbox->isEmpty()) {
+ doc->fitToRect(*bbox);
}
};