diff options
Diffstat (limited to 'src/ui')
| -rw-r--r-- | src/ui/cache/svg_preview_cache.cpp | 2 | ||||
| -rw-r--r-- | src/ui/clipboard.cpp | 12 | ||||
| -rw-r--r-- | src/ui/dialog/align-and-distribute.cpp | 34 | ||||
| -rw-r--r-- | src/ui/dialog/filedialogimpl-win32.cpp | 2 | ||||
| -rw-r--r-- | src/ui/dialog/livepatheffect-editor.cpp | 37 | ||||
| -rw-r--r-- | src/ui/dialog/livepatheffect-editor.h | 2 | ||||
| -rw-r--r-- | src/ui/dialog/transformation.cpp | 50 | ||||
| -rw-r--r-- | src/ui/view/edit-widget.cpp | 14 | ||||
| -rw-r--r-- | src/ui/widget/object-composite-settings.cpp | 8 | ||||
| -rw-r--r-- | src/ui/widget/style-subject.cpp | 8 | ||||
| -rw-r--r-- | src/ui/widget/style-subject.h | 7 |
11 files changed, 94 insertions, 82 deletions
diff --git a/src/ui/cache/svg_preview_cache.cpp b/src/ui/cache/svg_preview_cache.cpp index 20d0ea0a4..ce10de477 100644 --- a/src/ui/cache/svg_preview_cache.cpp +++ b/src/ui/cache/svg_preview_cache.cpp @@ -38,7 +38,7 @@ GdkPixbuf* render_pixbuf(NRArenaItem* root, double scale_factor, const Geom::Rec Geom::Matrix t(Geom::Scale(scale_factor, scale_factor)); nr_arena_item_set_transform(root, t); - gc.transform.set_identity(); + gc.transform.setIdentity(); nr_arena_item_invoke_update( root, NULL, &gc, NR_ARENA_ITEM_STATE_ALL, NR_ARENA_ITEM_STATE_NONE ); diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index 65cf14a95..09521008b 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -407,17 +407,17 @@ bool ClipboardManagerImpl::pasteSize(bool separately, bool apply_x, bool apply_y if (separately) { for (GSList *i = const_cast<GSList*>(selection->itemList()) ; i ; i = i->next) { SPItem *item = SP_ITEM(i->data); - boost::optional<NR::Rect> obj_size = sp_item_bbox_desktop(item); + boost::optional<Geom::Rect> obj_size = sp_item_bbox_desktop(item); if ( !obj_size || obj_size->isEmpty() ) continue; - sp_item_scale_rel(item, _getScale(min, max, to_2geom(*obj_size), apply_x, apply_y)); + sp_item_scale_rel(item, _getScale(min, max, *obj_size, apply_x, apply_y)); } } // resize the selection as a whole else { - boost::optional<NR::Rect> sel_size = selection->bounds(); + boost::optional<Geom::Rect> sel_size = selection->bounds(); if ( sel_size && !sel_size->isEmpty() ) { sp_selection_scale_relative(selection, sel_size->midpoint(), - _getScale(min, max, to_2geom(*sel_size), apply_x, apply_y)); + _getScale(min, max, *sel_size, apply_x, apply_y)); } } pasted = true; @@ -571,7 +571,7 @@ void ClipboardManagerImpl::_copySelection(Inkscape::Selection *selection) } } - boost::optional<NR::Rect> size = selection->bounds(); + boost::optional<Geom::Rect> size = selection->bounds(); if (size) { sp_repr_set_point(_clipnode, "min", size->min()); sp_repr_set_point(_clipnode, "max", size->max()); @@ -786,7 +786,7 @@ void ClipboardManagerImpl::_pasteDocument(SPDocument *clipdoc, bool in_place) selection->setReprList(pasted_objects); // Change the selection to the freshly pasted objects sp_document_ensure_up_to_date(target_document); // What does this do? - boost::optional<NR::Rect> sel_bbox = selection->bounds(); //In desktop coordinates + boost::optional<Geom::Rect> sel_bbox = selection->bounds(); //In desktop coordinates // PS: We could also have used the min/max corners calculated above, instead of selection->bounds() because // we know that after pasting the upper left corner of the selection will be aligend to the corresponding // page corner. Using the boundingbox of the selection is more foolproof though diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp index 99d3fdda3..b8b59230a 100644 --- a/src/ui/dialog/align-and-distribute.cpp +++ b/src/ui/dialog/align-and-distribute.cpp @@ -160,7 +160,7 @@ private : selected.erase(master); /*}*/ //Compute the anchor point - boost::optional<NR::Rect> b = sp_item_bbox_desktop (thing); + boost::optional<Geom::Rect> b = sp_item_bbox_desktop (thing); 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]); @@ -177,7 +177,7 @@ private : case AlignAndDistribute::DRAWING: { - boost::optional<NR::Rect> b = sp_item_bbox_desktop + boost::optional<Geom::Rect> b = sp_item_bbox_desktop ( (SPItem *) sp_document_root (sp_desktop_document (desktop)) ); if (b) { mp = Geom::Point(a.mx0 * b->min()[Geom::X] + a.mx1 * b->max()[Geom::X], @@ -190,7 +190,7 @@ private : case AlignAndDistribute::SELECTION: { - boost::optional<NR::Rect> b = selection->bounds(); + boost::optional<Geom::Rect> b = selection->bounds(); 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]); @@ -215,7 +215,7 @@ private : prefs_set_int_attribute("options.clonecompensation", "value", SP_CLONE_COMPENSATION_UNMOVED); bool changed = false; - boost::optional<NR::Rect> b; + boost::optional<Geom::Rect> b; if (sel_as_group) b = selection->bounds(); @@ -330,9 +330,9 @@ private : it != selected.end(); ++it) { - boost::optional<NR::Rect> bbox = sp_item_bbox_desktop(*it); + boost::optional<Geom::Rect> bbox = sp_item_bbox_desktop(*it); if (bbox) { - sorted.push_back(BBoxSort(*it, to_2geom(*bbox), _orientation, _kBegin, _kEnd)); + sorted.push_back(BBoxSort(*it, *bbox, _orientation, _kBegin, _kEnd)); } } //sort bbox by anchors @@ -602,7 +602,7 @@ private : //Check 2 or more selected objects if (selected.size() < 2) return; - boost::optional<NR::Rect> sel_bbox = selection->bounds(); + boost::optional<Geom::Rect> sel_bbox = selection->bounds(); if (!sel_bbox) { return; } @@ -611,7 +611,7 @@ private : // nor drift on sequential randomizations. Discard cache on global (or better active // desktop's) selection_change signal. if (!_dialog.randomize_bbox) { - _dialog.randomize_bbox = to_2geom(*sel_bbox); + _dialog.randomize_bbox = *sel_bbox; } // see comment in ActionAlign above @@ -623,13 +623,13 @@ private : ++it) { sp_document_ensure_up_to_date(sp_desktop_document (desktop)); - boost::optional<NR::Rect> item_box = sp_item_bbox_desktop (*it); + boost::optional<Geom::Rect> item_box = sp_item_bbox_desktop (*it); if (item_box) { // find new center, staying within bbox - double x = _dialog.randomize_bbox->min()[Geom::X] + (*item_box).extent(Geom::X)/2 + - g_random_double_range (0, (*_dialog.randomize_bbox)[Geom::X].extent() - (*item_box).extent(Geom::X)); - double y = _dialog.randomize_bbox->min()[Geom::Y] + (*item_box).extent(Geom::Y)/2 + - g_random_double_range (0, (*_dialog.randomize_bbox)[Geom::Y].extent() - (*item_box).extent(Geom::Y)); + double x = _dialog.randomize_bbox->min()[Geom::X] + (*item_box)[Geom::X].extent() /2 + + g_random_double_range (0, (*_dialog.randomize_bbox)[Geom::X].extent() - (*item_box)[Geom::X].extent()); + double y = _dialog.randomize_bbox->min()[Geom::Y] + (*item_box)[Geom::Y].extent()/2 + + g_random_double_range (0, (*_dialog.randomize_bbox)[Geom::Y].extent() - (*item_box)[Geom::Y].extent()); // displacement is the new center minus old: NR::Point t = NR::Point (x, y) - 0.5*(item_box->max() + item_box->min()); sp_item_move_rel(*it, Geom::Translate(t)); @@ -1099,9 +1099,9 @@ 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++) { - boost::optional<NR::Rect> b = sp_item_bbox_desktop (*it); + boost::optional<Geom::Rect> b = sp_item_bbox_desktop (*it); if (b) { - gdouble dim = (*b).extent(horizontal ? Geom::X : Geom::Y); + gdouble dim = (*b)[horizontal ? Geom::X : Geom::Y].extent(); if (dim > max) { max = dim; master = it; @@ -1116,9 +1116,9 @@ 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++) { - boost::optional<NR::Rect> b = sp_item_bbox_desktop (*it); + boost::optional<Geom::Rect> b = sp_item_bbox_desktop (*it); if (b) { - gdouble dim = (*b).extent(horizontal ? Geom::X : Geom::Y); + gdouble dim = (*b)[horizontal ? Geom::X : Geom::Y].extent(); if (dim < max) { max = dim; master = it; diff --git a/src/ui/dialog/filedialogimpl-win32.cpp b/src/ui/dialog/filedialogimpl-win32.cpp index e2d044908..e1479d3b4 100644 --- a/src/ui/dialog/filedialogimpl-win32.cpp +++ b/src/ui/dialog/filedialogimpl-win32.cpp @@ -866,7 +866,7 @@ bool FileOpenDialogImplWin32::set_svg_preview() NRRectL bbox = {0, 0, scaledSvgWidth, scaledSvgHeight}; // write object bbox to area - boost::optional<NR::Rect> maybeArea(from_2geom(area)); + boost::optional<Geom::Rect> maybeArea(area); sp_document_ensure_up_to_date (svgDoc); sp_item_invoke_bbox((SPItem *) svgDoc->root, maybeArea, sp_item_i2r_affine((SPItem *)(svgDoc->root)), TRUE); diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp index 44f37083b..73d26b67e 100644 --- a/src/ui/dialog/livepatheffect-editor.cpp +++ b/src/ui/dialog/livepatheffect-editor.cpp @@ -176,7 +176,7 @@ LivePathEffectEditor::~LivePathEffectEditor() } void -LivePathEffectEditor::showParams(LivePathEffect::Effect* effect) +LivePathEffectEditor::showParams(LivePathEffect::Effect& effect) { if (effectwidget) { effectcontrol_vbox.remove(*effectwidget); @@ -184,8 +184,8 @@ LivePathEffectEditor::showParams(LivePathEffect::Effect* effect) effectwidget = NULL; } - explain_label.set_markup("<b>" + effect->getName() + "</b>"); - effectwidget = effect->newWidget(&tooltips); + explain_label.set_markup("<b>" + effect.getName() + "</b>"); + effectwidget = effect.newWidget(&tooltips); if (effectwidget) { effectcontrol_vbox.pack_start(*effectwidget, true, true); } @@ -200,7 +200,7 @@ LivePathEffectEditor::selectInList(LivePathEffect::Effect* effect) { Gtk::TreeNodeChildren chi = effectlist_view.get_model()->children(); for (Gtk::TreeIter ci = chi.begin() ; ci != chi.end(); ci++) { - if (ci->get_value(columns.lperef)->lpeobject->lpe == effect) + if (ci->get_value(columns.lperef)->lpeobject->get_lpe() == effect) effectlist_view.get_selection()->select(ci); } } @@ -259,7 +259,7 @@ LivePathEffectEditor::onSelectionChanged(Inkscape::Selection *sel) if ( sp_lpe_item_has_path_effect(lpeitem) ) { Inkscape::LivePathEffect::Effect *lpe = sp_lpe_item_get_current_lpe(lpeitem); if (lpe) { - showParams(lpe); + showParams(*lpe); lpe_list_locked = true; selectInList(lpe); } else { @@ -295,10 +295,17 @@ LivePathEffectEditor::effect_list_reload(SPLPEItem *lpeitem) PathEffectList::iterator it; for( it = effectlist.begin() ; it!=effectlist.end(); it++ ) { - Gtk::TreeModel::Row row = *(effectlist_store->append()); - row[columns.col_name] = (*it)->lpeobject->lpe->getName(); - row[columns.lperef] = *it; - row[columns.col_visible] = (*it)->lpeobject->lpe->isVisible(); + if ((*it)->lpeobject->get_lpe()) { + Gtk::TreeModel::Row row = *(effectlist_store->append()); + row[columns.col_name] = (*it)->lpeobject->get_lpe()->getName(); + row[columns.lperef] = *it; + row[columns.col_visible] = (*it)->lpeobject->get_lpe()->isVisible(); + } else { + Gtk::TreeModel::Row row = *(effectlist_store->append()); + row[columns.col_name] = "Unknown effect!"; + row[columns.lperef] = *it; + row[columns.col_visible] = false; + } } } @@ -427,9 +434,11 @@ void LivePathEffectEditor::on_effect_selection_changed() LivePathEffect::LPEObjectReference * lperef = (*it)[columns.lperef]; if (lperef && current_lpeitem) { - lpe_list_locked = true; // prevent reload of the list which would lose selection - sp_lpe_item_set_current_path_effect(current_lpeitem, lperef); - showParams(lperef->lpeobject->lpe); + if (lperef->lpeobject->get_lpe()) { + lpe_list_locked = true; // prevent reload of the list which would lose selection + sp_lpe_item_set_current_path_effect(current_lpeitem, lperef); + showParams(*lperef->lpeobject->get_lpe()); + } } } @@ -440,12 +449,12 @@ void LivePathEffectEditor::on_visibility_toggled( Glib::ustring const& str ) LivePathEffect::LPEObjectReference * lpeobjref = row[columns.lperef]; - if ( lpeobjref ) { + if ( lpeobjref && lpeobjref->lpeobject->get_lpe() ) { bool newValue = !row[columns.col_visible]; row[columns.col_visible] = newValue; /* FIXME: this explicit writing to SVG is wrong. The lpe_item should have a method to disable/enable an effect within its stack. * So one can call: lpe_item->setActive(lpeobjref->lpeobject); */ - lpeobjref->lpeobject->lpe->getRepr()->setAttribute("is_visible", newValue ? "true" : "false"); + lpeobjref->lpeobject->get_lpe()->getRepr()->setAttribute("is_visible", newValue ? "true" : "false"); sp_document_done( sp_desktop_document(current_desktop), SP_VERB_DIALOG_LIVE_PATH_EFFECT, newValue ? _("Activate path effect") : _("Deactivate path effect")); } diff --git a/src/ui/dialog/livepatheffect-editor.h b/src/ui/dialog/livepatheffect-editor.h index a924ed6e9..49db74fca 100644 --- a/src/ui/dialog/livepatheffect-editor.h +++ b/src/ui/dialog/livepatheffect-editor.h @@ -53,7 +53,7 @@ private: void set_sensitize_all(bool sensitive); - void showParams(LivePathEffect::Effect* effect); + void showParams(LivePathEffect::Effect& effect); void showText(Glib::ustring const &str); void selectInList(LivePathEffect::Effect* effect); diff --git a/src/ui/dialog/transformation.cpp b/src/ui/dialog/transformation.cpp index 0334b8541..5927dc740 100644 --- a/src/ui/dialog/transformation.cpp +++ b/src/ui/dialog/transformation.cpp @@ -457,7 +457,7 @@ Transformation::updatePageMove(Inkscape::Selection *selection) { if (selection && !selection->isEmpty()) { if (!_check_move_relative.get_active()) { - boost::optional<NR::Rect> bbox = selection->bounds(); + boost::optional<Geom::Rect> bbox = selection->bounds(); if (bbox) { double x = bbox->min()[Geom::X]; double y = bbox->min()[Geom::Y]; @@ -478,10 +478,10 @@ void Transformation::updatePageScale(Inkscape::Selection *selection) { if (selection && !selection->isEmpty()) { - boost::optional<NR::Rect> bbox = selection->bounds(); + boost::optional<Geom::Rect> bbox = selection->bounds(); if (bbox) { - double w = bbox->extent(Geom::X); - double h = bbox->extent(Geom::Y); + double w = bbox->dimensions()[Geom::X]; + double h = bbox->dimensions()[Geom::Y]; _scalar_scale_horizontal.setHundredPercent(w); _scalar_scale_vertical.setHundredPercent(h); onScaleXValueChanged(); // to update x/y proportionality if switch is on @@ -508,10 +508,10 @@ void Transformation::updatePageSkew(Inkscape::Selection *selection) { if (selection && !selection->isEmpty()) { - boost::optional<NR::Rect> bbox = selection->bounds(); + boost::optional<Geom::Rect> bbox = selection->bounds(); if (bbox) { - double w = bbox->extent(Geom::X); - double h = bbox->extent(Geom::Y); + double w = bbox->dimensions()[Geom::X]; + double h = bbox->dimensions()[Geom::Y]; _scalar_skew_vertical.setHundredPercent(w); _scalar_skew_horizontal.setHundredPercent(h); _page_skew.set_sensitive(true); @@ -604,7 +604,7 @@ Transformation::applyPageMove(Inkscape::Selection *selection) if (_check_move_relative.get_active()) { sp_selection_move_relative(selection, x, y); } else { - boost::optional<NR::Rect> bbox = selection->bounds(); + boost::optional<Geom::Rect> bbox = selection->bounds(); if (bbox) { sp_selection_move_relative(selection, x - bbox->min()[Geom::X], y - bbox->min()[Geom::Y]); @@ -625,9 +625,9 @@ Transformation::applyPageMove(Inkscape::Selection *selection) it != selected.end(); ++it) { - boost::optional<NR::Rect> bbox = sp_item_bbox_desktop(*it); + boost::optional<Geom::Rect> bbox = sp_item_bbox_desktop(*it); if (bbox) { - sorted.push_back(BBoxSort(*it, to_2geom(*bbox), Geom::X, x > 0? 1. : 0., x > 0? 0. : 1.)); + sorted.push_back(BBoxSort(*it, *bbox, Geom::X, x > 0? 1. : 0., x > 0? 0. : 1.)); } } //sort bbox by anchors @@ -649,9 +649,9 @@ Transformation::applyPageMove(Inkscape::Selection *selection) it != selected.end(); ++it) { - boost::optional<NR::Rect> bbox = sp_item_bbox_desktop(*it); + boost::optional<Geom::Rect> bbox = sp_item_bbox_desktop(*it); if (bbox) { - sorted.push_back(BBoxSort(*it, to_2geom(*bbox), Geom::Y, y > 0? 1. : 0., y > 0? 0. : 1.)); + sorted.push_back(BBoxSort(*it, *bbox, Geom::Y, y > 0? 1. : 0., y > 0? 0. : 1.)); } } //sort bbox by anchors @@ -668,7 +668,7 @@ Transformation::applyPageMove(Inkscape::Selection *selection) } } } else { - boost::optional<NR::Rect> bbox = selection->bounds(); + boost::optional<Geom::Rect> bbox = selection->bounds(); if (bbox) { sp_selection_move_relative(selection, x - bbox->min()[Geom::X], y - bbox->min()[Geom::Y]); @@ -692,13 +692,13 @@ Transformation::applyPageScale(Inkscape::Selection *selection) Geom::Scale scale (0,0); // the values are increments! if (_units_scale.isAbsolute()) { - boost::optional<NR::Rect> bbox(sp_item_bbox_desktop(item)); + boost::optional<Geom::Rect> bbox(sp_item_bbox_desktop(item)); 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 double new_height = scaleY; if (fabs(new_height) < 1e-6) new_height = 1e-6; - scale = Geom::Scale(new_width / bbox->extent(Geom::X), new_height / bbox->extent(Geom::Y)); + scale = Geom::Scale(new_width / bbox->dimensions()[Geom::X], new_height / bbox->dimensions()[Geom::Y]); } } else { double new_width = scaleX; @@ -710,7 +710,7 @@ Transformation::applyPageScale(Inkscape::Selection *selection) sp_item_scale_rel (item, scale); } } else { - boost::optional<NR::Rect> bbox(selection->bounds()); + boost::optional<Geom::Rect> bbox(selection->bounds()); if (bbox) { Geom::Point center(bbox->midpoint()); // use rotation center? Geom::Scale scale (0,0); @@ -720,7 +720,7 @@ Transformation::applyPageScale(Inkscape::Selection *selection) if (fabs(new_width) < 1e-6) new_width = 1e-6; double new_height = scaleY; if (fabs(new_height) < 1e-6) new_height = 1e-6; - scale = Geom::Scale(new_width / bbox->extent(Geom::X), new_height / bbox->extent(Geom::Y)); + scale = Geom::Scale(new_width / bbox->dimensions()[Geom::X], new_height / bbox->dimensions()[Geom::Y]); } else { double new_width = scaleX; if (fabs(new_width) < 1e-6) new_width = 1e-6; @@ -777,21 +777,21 @@ Transformation::applyPageSkew(Inkscape::Selection *selection) } else { // absolute displacement double skewX = _scalar_skew_horizontal.getValue("px"); double skewY = _scalar_skew_vertical.getValue("px"); - boost::optional<NR::Rect> bbox(sp_item_bbox_desktop(item)); + boost::optional<Geom::Rect> bbox(sp_item_bbox_desktop(item)); if (bbox) { - double width = bbox->extent(Geom::X); - double height = bbox->extent(Geom::Y); + double width = bbox->dimensions()[Geom::X]; + double height = bbox->dimensions()[Geom::Y]; sp_item_skew_rel (item, skewX/height, skewY/width); } } } } else { // transform whole selection - boost::optional<NR::Rect> bbox = selection->bounds(); + boost::optional<Geom::Rect> bbox = selection->bounds(); boost::optional<Geom::Point> center = selection->center(); if ( bbox && center ) { - double width = bbox->extent(Geom::X); - double height = bbox->extent(Geom::Y); + double width = bbox->dimensions()[Geom::X]; + double height = bbox->dimensions()[Geom::Y]; if (!_units_skew.isAbsolute()) { // percentage double skewX = _scalar_skew_horizontal.getValue("%"); @@ -869,7 +869,7 @@ Transformation::onMoveRelativeToggled() //g_message("onMoveRelativeToggled: %f, %f px\n", x, y); - boost::optional<NR::Rect> bbox = selection->bounds(); + boost::optional<Geom::Rect> bbox = selection->bounds(); if (bbox) { if (_check_move_relative.get_active()) { @@ -1009,7 +1009,7 @@ Transformation::onClear() _scalar_move_horizontal.setValue(0); _scalar_move_vertical.setValue(0); } else { - boost::optional<NR::Rect> bbox = selection->bounds(); + boost::optional<Geom::Rect> bbox = selection->bounds(); 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/view/edit-widget.cpp b/src/ui/view/edit-widget.cpp index bd6c5032c..67091fc40 100644 --- a/src/ui/view/edit-widget.cpp +++ b/src/ui/view/edit-widget.cpp @@ -1097,7 +1097,7 @@ EditWidget::initStatusbar() _select_status.property_xalign() = 0.0; _select_status.property_yalign() = 0.5; - _select_status.set_markup (_("<b>Welcome to Inkscape!</b> Use shape or freehand tools to create objects; use selector (arrow) to move or transform them.")); + _select_status.set_markup (_("<b>Welcome to Inkscape!</b> Use shape or drawing tools to create objects; use selector (arrow) to move or transform them.")); // include this again with Gtk+-2.6 #if GTK_VERSION_GE(2,6) gtk_label_set_ellipsize (GTK_LABEL(_select_status.gobj()), PANGO_ELLIPSIZE_END); @@ -1400,18 +1400,20 @@ EditWidget::updateScrollbars (double scale) /* The desktop region we always show unconditionally */ SPDocument *doc = _desktop->doc(); - NR::Rect darea ( Geom::Point(-sp_document_width(doc), -sp_document_height(doc)), + Geom::Rect darea ( Geom::Point(-sp_document_width(doc), -sp_document_height(doc)), Geom::Point(2 * sp_document_width(doc), 2 * sp_document_height(doc)) ); - darea = NR::union_bounds(darea, sp_item_bbox_desktop(SP_ITEM(SP_DOCUMENT_ROOT(doc)))); + SPObject* root = doc->root; + SPItem* item = SP_ITEM(root); + boost::optional<Geom::Rect> deskarea = Geom::unify(darea, sp_item_bbox_desktop(item)); /* Canvas region we always show unconditionally */ - NR::Rect carea( Geom::Point(darea.min()[Geom::X] * scale - 64, darea.max()[Geom::Y] * -scale - 64), - Geom::Point(darea.max()[Geom::X] * scale + 64, darea.min()[Geom::Y] * -scale + 64) ); + Geom::Rect carea( Geom::Point(deskarea->min()[Geom::X] * scale - 64, deskarea->max()[Geom::Y] * -scale - 64), + Geom::Point(deskarea->max()[Geom::X] * scale + 64, deskarea->min()[Geom::Y] * -scale + 64) ); Geom::Rect const viewbox = _svg_canvas.spobj()->getViewbox(); /* Viewbox is always included into scrollable region */ - carea = NR::union_bounds(carea, from_2geom(viewbox)); + carea = Geom::unify(carea, viewbox); Gtk::Adjustment *adj = _bottom_scrollbar.get_adjustment(); adj->set_value(viewbox.min()[Geom::X]); diff --git a/src/ui/widget/object-composite-settings.cpp b/src/ui/widget/object-composite-settings.cpp index d4c1bb705..f2fa9bcd3 100644 --- a/src/ui/widget/object-composite-settings.cpp +++ b/src/ui/widget/object-composite-settings.cpp @@ -114,10 +114,10 @@ ObjectCompositeSettings::_blendBlurValueChanged() // FIXME: fix for GTK breakage, see comment in SelectedStyle::on_opacity_changed; here it results in crash 1580903 sp_canvas_force_full_redraw_after_interruptions(sp_desktop_canvas(desktop), 0); - boost::optional<NR::Rect> bbox = _subject->getBounds(SPItem::GEOMETRIC_BBOX); + boost::optional<Geom::Rect> bbox = _subject->getBounds(SPItem::GEOMETRIC_BBOX); double radius; if (bbox) { - double perimeter = bbox->extent(Geom::X) + bbox->extent(Geom::Y); + double perimeter = bbox->dimensions()[Geom::X] + bbox->dimensions()[Geom::Y]; // fixme: this is only half the perimeter, is that correct? radius = _fe_cb.get_blur_value() * perimeter / 400; } else { radius = 0; @@ -260,9 +260,9 @@ ObjectCompositeSettings::_subjectChanged() { case QUERY_STYLE_SINGLE: case QUERY_STYLE_MULTIPLE_AVERAGED: case QUERY_STYLE_MULTIPLE_SAME: - boost::optional<NR::Rect> bbox = _subject->getBounds(SPItem::GEOMETRIC_BBOX); + boost::optional<Geom::Rect> bbox = _subject->getBounds(SPItem::GEOMETRIC_BBOX); if (bbox) { - double perimeter = bbox->extent(Geom::X) + bbox->extent(Geom::Y); + double perimeter = bbox->dimensions()[Geom::X] + bbox->dimensions()[Geom::Y]; // fixme: this is only half the perimeter, is that correct? _fe_cb.set_blur_sensitive(true); //update blur widget value float radius = query->filter_gaussianBlur_deviation.value; diff --git a/src/ui/widget/style-subject.cpp b/src/ui/widget/style-subject.cpp index 39081b005..a2e8a2547 100644 --- a/src/ui/widget/style-subject.cpp +++ b/src/ui/widget/style-subject.cpp @@ -65,12 +65,12 @@ StyleSubject::iterator StyleSubject::Selection::begin() { } } -boost::optional<NR::Rect> StyleSubject::Selection::getBounds(SPItem::BBoxType type) { +boost::optional<Geom::Rect> StyleSubject::Selection::getBounds(SPItem::BBoxType type) { Inkscape::Selection *selection = _getSelection(); if (selection) { return selection->bounds(type); } else { - return boost::optional<NR::Rect>(); + return boost::optional<Geom::Rect>(); } } @@ -143,12 +143,12 @@ StyleSubject::iterator StyleSubject::CurrentLayer::begin() { return iterator(_getLayerSList()); } -boost::optional<NR::Rect> StyleSubject::CurrentLayer::getBounds(SPItem::BBoxType type) { +boost::optional<Geom::Rect> StyleSubject::CurrentLayer::getBounds(SPItem::BBoxType type) { SPObject *layer = _getLayer(); if (layer && SP_IS_ITEM(layer)) { return sp_item_bbox_desktop(SP_ITEM(layer), type); } else { - return boost::optional<NR::Rect>(); + return boost::optional<Geom::Rect>(); } } diff --git a/src/ui/widget/style-subject.h b/src/ui/widget/style-subject.h index 9204a8163..231a88728 100644 --- a/src/ui/widget/style-subject.h +++ b/src/ui/widget/style-subject.h @@ -12,6 +12,7 @@ #include "util/glib-list-iterators.h" #include <boost/optional.hpp> #include "libnr/nr-rect.h" +#include <2geom/rect.h> #include "sp-item.h" #include <sigc++/sigc++.h> @@ -43,7 +44,7 @@ public: virtual iterator begin() = 0; virtual iterator end() { return iterator(NULL); } - virtual boost::optional<NR::Rect> getBounds(SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX) = 0; + virtual boost::optional<Geom::Rect> getBounds(SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX) = 0; virtual int queryStyle(SPStyle *query, int property) = 0; virtual void setCSS(SPCSSAttr *css) = 0; @@ -66,7 +67,7 @@ public: ~Selection(); virtual iterator begin(); - virtual boost::optional<NR::Rect> getBounds(SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX); + virtual boost::optional<Geom::Rect> getBounds(SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX); virtual int queryStyle(SPStyle *query, int property); virtual void setCSS(SPCSSAttr *css); @@ -87,7 +88,7 @@ public: ~CurrentLayer(); virtual iterator begin(); - virtual boost::optional<NR::Rect> getBounds(SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX); + virtual boost::optional<Geom::Rect> getBounds(SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX); virtual int queryStyle(SPStyle *query, int property); virtual void setCSS(SPCSSAttr *css); |
