summaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/clipboard.cpp8
-rw-r--r--src/ui/dialog/align-and-distribute.cpp22
-rw-r--r--src/ui/dialog/align-and-distribute.h2
-rw-r--r--src/ui/dialog/filedialogimpl-win32.cpp4
-rw-r--r--src/ui/dialog/tile.cpp16
-rw-r--r--src/ui/dialog/transformation.cpp26
-rw-r--r--src/ui/widget/style-subject.cpp2
-rw-r--r--src/ui/widget/style-subject.h6
8 files changed, 42 insertions, 44 deletions
diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp
index 60379a966..adec1de5d 100644
--- a/src/ui/clipboard.cpp
+++ b/src/ui/clipboard.cpp
@@ -467,7 +467,7 @@ bool ClipboardManagerImpl::pasteSize(SPDesktop *desktop, bool separately, bool a
if (separately) {
for (GSList *i = const_cast<GSList*>(selection->itemList()) ; i ; i = i->next) {
SPItem *item = SP_ITEM(i->data);
- Geom::OptRect obj_size = item->getBboxDesktop();
+ Geom::OptRect obj_size = item->desktopVisualBounds();
if ( !obj_size ) {
continue;
}
@@ -476,7 +476,7 @@ bool ClipboardManagerImpl::pasteSize(SPDesktop *desktop, bool separately, bool a
}
// resize the selection as a whole
else {
- Geom::OptRect sel_size = selection->bounds();
+ Geom::OptRect sel_size = selection->visualBounds();
if ( sel_size ) {
sp_selection_scale_relative(selection, sel_size->midpoint(),
_getScale(desktop, min, max, *sel_size, apply_x, apply_y));
@@ -636,7 +636,7 @@ void ClipboardManagerImpl::_copySelection(Inkscape::Selection *selection)
}
}
- Geom::OptRect size = selection->bounds();
+ Geom::OptRect size = selection->visualBounds();
if (size) {
sp_repr_set_point(_clipnode, "min", size->min());
sp_repr_set_point(_clipnode, "max", size->max());
@@ -852,7 +852,7 @@ void ClipboardManagerImpl::_pasteDocument(SPDesktop *desktop, SPDocument *clipdo
target_document->ensureUpToDate();
// move selection either to original position (in_place) or to mouse pointer
- Geom::OptRect sel_bbox = selection->bounds();
+ Geom::OptRect sel_bbox = selection->visualBounds();
if (sel_bbox) {
// get offset of selection to original position of copied elements
Geom::Point pos_original;
diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp
index 8728e2ef4..36d5a20d0 100644
--- a/src/ui/dialog/align-and-distribute.cpp
+++ b/src/ui/dialog/align-and-distribute.cpp
@@ -155,7 +155,7 @@ private :
selected.erase(master);
/*}*/
//Compute the anchor point
- Geom::OptRect b = thing->getBboxDesktop ();
+ Geom::OptRect b = thing->desktopVisualBounds();
if (b) {
mp = Geom::Point(a.mx0 * b->min()[Geom::X] + a.mx1 * b->max()[Geom::X],
a.my0 * b->min()[Geom::Y] + a.my1 * b->max()[Geom::Y]);
@@ -172,7 +172,7 @@ private :
case AlignAndDistribute::DRAWING:
{
- Geom::OptRect b = sp_desktop_document(desktop)->getRoot()->getBboxDesktop();
+ Geom::OptRect b = sp_desktop_document(desktop)->getRoot()->desktopVisualBounds();
if (b) {
mp = Geom::Point(a.mx0 * b->min()[Geom::X] + a.mx1 * b->max()[Geom::X],
a.my0 * b->min()[Geom::Y] + a.my1 * b->max()[Geom::Y]);
@@ -184,7 +184,7 @@ private :
case AlignAndDistribute::SELECTION:
{
- Geom::OptRect b = selection->bounds();
+ Geom::OptRect b = selection->visualBounds();
if (b) {
mp = Geom::Point(a.mx0 * b->min()[Geom::X] + a.mx1 * b->max()[Geom::X],
a.my0 * b->min()[Geom::Y] + a.my1 * b->max()[Geom::Y]);
@@ -211,7 +211,7 @@ private :
bool changed = false;
Geom::OptRect b;
if (sel_as_group)
- b = selection->bounds();
+ b = selection->visualBounds();
//Move each item in the selected list separately
for (std::list<SPItem *>::iterator it(selected.begin());
@@ -220,7 +220,7 @@ private :
{
sp_desktop_document (desktop)->ensureUpToDate();
if (!sel_as_group)
- b = (*it)->getBboxDesktop();
+ b = (*it)->desktopVisualBounds();
if (b) {
Geom::Point const sp(a.sx0 * b->min()[Geom::X] + a.sx1 * b->max()[Geom::X],
a.sy0 * b->min()[Geom::Y] + a.sy1 * b->max()[Geom::Y]);
@@ -261,7 +261,7 @@ ActionAlign::Coeffs const ActionAlign::_allCoeffs[10] = {
{0., 0., 1., 0., 0., 0., 0., 1.}
};
-BBoxSort::BBoxSort(SPItem *pItem, Geom::Rect bounds, Geom::Dim2 orientation, double kBegin, double kEnd) :
+BBoxSort::BBoxSort(SPItem *pItem, Geom::Rect const &bounds, Geom::Dim2 orientation, double kBegin, double kEnd) :
item(pItem),
bbox (bounds)
{
@@ -324,7 +324,7 @@ private :
it != selected.end();
++it)
{
- Geom::OptRect bbox = (*it)->getBboxDesktop();
+ Geom::OptRect bbox = (*it)->desktopVisualBounds();
if (bbox) {
sorted.push_back(BBoxSort(*it, *bbox, _orientation, _kBegin, _kEnd));
}
@@ -699,7 +699,7 @@ private :
//Check 2 or more selected objects
if (selected.size() < 2) return;
- Geom::OptRect sel_bbox = selection->bounds();
+ Geom::OptRect sel_bbox = selection->visualBounds();
if (!sel_bbox) {
return;
}
@@ -721,7 +721,7 @@ private :
++it)
{
sp_desktop_document (desktop)->ensureUpToDate();
- Geom::OptRect item_box = (*it)->getBboxDesktop ();
+ Geom::OptRect item_box = (*it)->desktopVisualBounds();
if (item_box) {
// find new center, staying within bbox
double x = _dialog.randomize_bbox->min()[Geom::X] + (*item_box)[Geom::X].extent() /2 +
@@ -1245,7 +1245,7 @@ std::list<SPItem *>::iterator AlignAndDistribute::find_master( std::list<SPItem
{
gdouble max = -1e18;
for (std::list<SPItem *>::iterator it = list.begin(); it != list.end(); it++) {
- Geom::OptRect b = (*it)->getBboxDesktop ();
+ Geom::OptRect b = (*it)->desktopVisualBounds();
if (b) {
gdouble dim = (*b)[horizontal ? Geom::X : Geom::Y].extent();
if (dim > max) {
@@ -1262,7 +1262,7 @@ std::list<SPItem *>::iterator AlignAndDistribute::find_master( std::list<SPItem
{
gdouble max = 1e18;
for (std::list<SPItem *>::iterator it = list.begin(); it != list.end(); it++) {
- Geom::OptRect b = (*it)->getBboxDesktop ();
+ Geom::OptRect b = (*it)->desktopVisualBounds();
if (b) {
gdouble dim = (*b)[horizontal ? Geom::X : Geom::Y].extent();
if (dim < max) {
diff --git a/src/ui/dialog/align-and-distribute.h b/src/ui/dialog/align-and-distribute.h
index 99b96463c..22227cb60 100644
--- a/src/ui/dialog/align-and-distribute.h
+++ b/src/ui/dialog/align-and-distribute.h
@@ -120,7 +120,7 @@ struct BBoxSort
SPItem *item;
float anchor;
Geom::Rect bbox;
- BBoxSort(SPItem *pItem, Geom::Rect bounds, Geom::Dim2 orientation, double kBegin, double kEnd);
+ BBoxSort(SPItem *pItem, Geom::Rect const &bounds, Geom::Dim2 orientation, double kBegin, double kEnd);
BBoxSort(const BBoxSort &rhs);
};
bool operator< (const BBoxSort &a, const BBoxSort &b);
diff --git a/src/ui/dialog/filedialogimpl-win32.cpp b/src/ui/dialog/filedialogimpl-win32.cpp
index 4f4093a99..0d7a0c687 100644
--- a/src/ui/dialog/filedialogimpl-win32.cpp
+++ b/src/ui/dialog/filedialogimpl-win32.cpp
@@ -992,10 +992,8 @@ bool FileOpenDialogImplWin32::set_svg_preview()
NRRectL bbox = {0, 0, scaledSvgWidth, scaledSvgHeight};
// write object bbox to area
- Geom::OptRect maybeArea(area);
svgDoc->ensureUpToDate();
- svgDoc->getRoot()->invoke_bbox( maybeArea,
- svgDoc->getRoot()->i2dt_affine(), TRUE);
+ Geom::OptRect maybeArea = area | svgDoc->getRoot()->desktopVisualBounds();
NRArena *const arena = NRArena::create();
diff --git a/src/ui/dialog/tile.cpp b/src/ui/dialog/tile.cpp
index 68ad9393c..5f19a2613 100644
--- a/src/ui/dialog/tile.cpp
+++ b/src/ui/dialog/tile.cpp
@@ -47,8 +47,8 @@ sp_compare_x_position(SPItem *first, SPItem *second)
using Geom::X;
using Geom::Y;
- Geom::OptRect a = first->getBounds(first->i2doc_affine());
- Geom::OptRect b = second->getBounds(second->i2doc_affine());
+ Geom::OptRect a = first->documentVisualBounds();
+ Geom::OptRect b = second->documentVisualBounds();
if ( !a || !b ) {
// FIXME?
@@ -87,8 +87,8 @@ sp_compare_x_position(SPItem *first, SPItem *second)
int
sp_compare_y_position(SPItem *first, SPItem *second)
{
- Geom::OptRect a = first->getBounds(first->i2doc_affine());
- Geom::OptRect b = second->getBounds(second->i2doc_affine());
+ Geom::OptRect a = first->documentVisualBounds();
+ Geom::OptRect b = second->documentVisualBounds();
if ( !a || !b ) {
// FIXME?
@@ -167,7 +167,7 @@ void TileDialog::Grid_Arrange ()
cnt=0;
for (; items != NULL; items = items->next) {
SPItem *item = SP_ITEM(items->data);
- Geom::OptRect b = item->getBounds(item->i2doc_affine());
+ Geom::OptRect b = item->documentVisualBounds();
if (!b) {
continue;
}
@@ -210,7 +210,7 @@ void TileDialog::Grid_Arrange ()
const GSList *sizes = sorted;
for (; sizes != NULL; sizes = sizes->next) {
SPItem *item = SP_ITEM(sizes->data);
- Geom::OptRect b = item->getBounds(item->i2doc_affine());
+ Geom::OptRect b = item->documentVisualBounds();
if (b) {
width = b->dimensions()[Geom::X];
height = b->dimensions()[Geom::Y];
@@ -267,7 +267,7 @@ void TileDialog::Grid_Arrange ()
}
- Geom::OptRect sel_bbox = selection->bounds();
+ Geom::OptRect sel_bbox = selection->visualBounds();
// Fit to bbox, calculate padding between rows accordingly.
if ( sel_bbox && !SpaceManualRadioButton.get_active() ){
#ifdef DEBUG_GRID_ARRANGE
@@ -317,7 +317,7 @@ g_print("\n row = %f col = %f selection x= %f selection y = %f", total_row_h
for (; current_row != NULL; current_row = current_row->next) {
SPItem *item=SP_ITEM(current_row->data);
Inkscape::XML::Node *repr = item->getRepr();
- Geom::OptRect b = item->getBounds(item->i2doc_affine());
+ Geom::OptRect b = item->documentVisualBounds();
Geom::Point min;
if (b) {
width = b->dimensions()[Geom::X];
diff --git a/src/ui/dialog/transformation.cpp b/src/ui/dialog/transformation.cpp
index 92c8bd349..029a83ea5 100644
--- a/src/ui/dialog/transformation.cpp
+++ b/src/ui/dialog/transformation.cpp
@@ -467,7 +467,7 @@ Transformation::updatePageMove(Inkscape::Selection *selection)
{
if (selection && !selection->isEmpty()) {
if (!_check_move_relative.get_active()) {
- Geom::OptRect bbox = selection->bounds();
+ Geom::OptRect bbox = selection->visualBounds();
if (bbox) {
double x = bbox->min()[Geom::X];
double y = bbox->min()[Geom::Y];
@@ -489,7 +489,7 @@ void
Transformation::updatePageScale(Inkscape::Selection *selection)
{
if (selection && !selection->isEmpty()) {
- Geom::OptRect bbox = selection->bounds();
+ Geom::OptRect bbox = selection->visualBounds();
if (bbox) {
double w = bbox->dimensions()[Geom::X];
double h = bbox->dimensions()[Geom::Y];
@@ -519,7 +519,7 @@ void
Transformation::updatePageSkew(Inkscape::Selection *selection)
{
if (selection && !selection->isEmpty()) {
- Geom::OptRect bbox = selection->bounds();
+ Geom::OptRect bbox = selection->visualBounds();
if (bbox) {
double w = bbox->dimensions()[Geom::X];
double h = bbox->dimensions()[Geom::Y];
@@ -616,7 +616,7 @@ Transformation::applyPageMove(Inkscape::Selection *selection)
if (_check_move_relative.get_active()) {
sp_selection_move_relative(selection, x, y);
} else {
- Geom::OptRect bbox = selection->bounds();
+ Geom::OptRect bbox = selection->visualBounds();
if (bbox) {
sp_selection_move_relative(selection,
x - bbox->min()[Geom::X], y - bbox->min()[Geom::Y]);
@@ -637,7 +637,7 @@ Transformation::applyPageMove(Inkscape::Selection *selection)
it != selected.end();
++it)
{
- Geom::OptRect bbox = (*it)->getBboxDesktop();
+ Geom::OptRect bbox = (*it)->desktopVisualBounds();
if (bbox) {
sorted.push_back(BBoxSort(*it, *bbox, Geom::X, x > 0? 1. : 0., x > 0? 0. : 1.));
}
@@ -661,7 +661,7 @@ Transformation::applyPageMove(Inkscape::Selection *selection)
it != selected.end();
++it)
{
- Geom::OptRect bbox = (*it)->getBboxDesktop();
+ Geom::OptRect bbox = (*it)->desktopVisualBounds();
if (bbox) {
sorted.push_back(BBoxSort(*it, *bbox, Geom::Y, y > 0? 1. : 0., y > 0? 0. : 1.));
}
@@ -680,7 +680,7 @@ Transformation::applyPageMove(Inkscape::Selection *selection)
}
}
} else {
- Geom::OptRect bbox = selection->bounds();
+ Geom::OptRect bbox = selection->visualBounds();
if (bbox) {
sp_selection_move_relative(selection,
x - bbox->min()[Geom::X], y - bbox->min()[Geom::Y]);
@@ -705,7 +705,7 @@ Transformation::applyPageScale(Inkscape::Selection *selection)
Geom::Scale scale (0,0);
// the values are increments!
if (_units_scale.isAbsolute()) {
- Geom::OptRect bbox(item->getBboxDesktop());
+ Geom::OptRect bbox = item->desktopVisualBounds();
if (bbox) {
double new_width = scaleX;
if (fabs(new_width) < 1e-6) new_width = 1e-6; // not 0, as this would result in a nasty no-bbox object
@@ -723,7 +723,7 @@ Transformation::applyPageScale(Inkscape::Selection *selection)
sp_item_scale_rel (item, scale);
}
} else {
- Geom::OptRect bbox(selection->bounds());
+ Geom::OptRect bbox = selection->visualBounds();
if (bbox) {
Geom::Point center(bbox->midpoint()); // use rotation center?
Geom::Scale scale (0,0);
@@ -792,7 +792,7 @@ Transformation::applyPageSkew(Inkscape::Selection *selection)
} else { // absolute displacement
double skewX = _scalar_skew_horizontal.getValue("px");
double skewY = _scalar_skew_vertical.getValue("px");
- Geom::OptRect bbox(item->getBboxDesktop());
+ Geom::OptRect bbox = item->desktopVisualBounds();
if (bbox) {
double width = bbox->dimensions()[Geom::X];
double height = bbox->dimensions()[Geom::Y];
@@ -801,7 +801,7 @@ Transformation::applyPageSkew(Inkscape::Selection *selection)
}
}
} else { // transform whole selection
- Geom::OptRect bbox = selection->bounds();
+ Geom::OptRect bbox = selection->visualBounds();
boost::optional<Geom::Point> center = selection->center();
if ( bbox && center ) {
@@ -886,7 +886,7 @@ Transformation::onMoveRelativeToggled()
//g_message("onMoveRelativeToggled: %f, %f px\n", x, y);
- Geom::OptRect bbox = selection->bounds();
+ Geom::OptRect bbox = selection->visualBounds();
if (bbox) {
if (_check_move_relative.get_active()) {
@@ -1026,7 +1026,7 @@ Transformation::onClear()
_scalar_move_horizontal.setValue(0);
_scalar_move_vertical.setValue(0);
} else {
- Geom::OptRect bbox = selection->bounds();
+ Geom::OptRect bbox = selection->visualBounds();
if (bbox) {
_scalar_move_horizontal.setValue(bbox->min()[Geom::X], "px");
_scalar_move_vertical.setValue(bbox->min()[Geom::Y], "px");
diff --git a/src/ui/widget/style-subject.cpp b/src/ui/widget/style-subject.cpp
index f4780896b..f3a8478ea 100644
--- a/src/ui/widget/style-subject.cpp
+++ b/src/ui/widget/style-subject.cpp
@@ -147,7 +147,7 @@ StyleSubject::iterator StyleSubject::CurrentLayer::begin() {
Geom::OptRect StyleSubject::CurrentLayer::getBounds(SPItem::BBoxType type) {
SPObject *layer = _getLayer();
if (layer && SP_IS_ITEM(layer)) {
- return SP_ITEM(layer)->getBboxDesktop(type);
+ return SP_ITEM(layer)->desktopBounds(type);
} else {
return Geom::OptRect();
}
diff --git a/src/ui/widget/style-subject.h b/src/ui/widget/style-subject.h
index 6d5c96350..73f818516 100644
--- a/src/ui/widget/style-subject.h
+++ b/src/ui/widget/style-subject.h
@@ -45,7 +45,7 @@ public:
virtual iterator begin() = 0;
virtual iterator end() { return iterator(NULL); }
- virtual Geom::OptRect getBounds(SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX) = 0;
+ virtual Geom::OptRect getBounds(SPItem::BBoxType type) = 0;
virtual int queryStyle(SPStyle *query, int property) = 0;
virtual void setCSS(SPCSSAttr *css) = 0;
@@ -68,7 +68,7 @@ public:
~Selection();
virtual iterator begin();
- virtual Geom::OptRect getBounds(SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX);
+ virtual Geom::OptRect getBounds(SPItem::BBoxType type);
virtual int queryStyle(SPStyle *query, int property);
virtual void setCSS(SPCSSAttr *css);
@@ -89,7 +89,7 @@ public:
~CurrentLayer();
virtual iterator begin();
- virtual Geom::OptRect getBounds(SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX);
+ virtual Geom::OptRect getBounds(SPItem::BBoxType type);
virtual int queryStyle(SPStyle *query, int property);
virtual void setCSS(SPCSSAttr *css);