summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3410996)
raw | patch | inline | side by side (parent: 3410996)
author | johanengelen <johanengelen@users.sourceforge.net> | |
Tue, 5 Aug 2008 22:40:31 +0000 (22:40 +0000) | ||
committer | johanengelen <johanengelen@users.sourceforge.net> | |
Tue, 5 Aug 2008 22:40:31 +0000 (22:40 +0000) |
95 files changed:
diff --git a/src/conn-avoid-ref.cpp b/src/conn-avoid-ref.cpp
index 7e764788d231ede5b16d6794dc6149a79e060751..2eb1f441e015978b6f6f4de45c89e80c853a1b92 100644 (file)
--- a/src/conn-avoid-ref.cpp
+++ b/src/conn-avoid-ref.cpp
// by the sp_*_update functions, e.g., text.
sp_document_ensure_up_to_date(item->document);
- NR::Maybe<NR::Rect> rHull = item->getBounds(from_2geom(sp_item_i2doc_affine(item)));
+ boost::optional<NR::Rect> rHull = item->getBounds(from_2geom(sp_item_i2doc_affine(item)));
if (!rHull) {
return Avoid::newPoly(0);
}
index 1a77008f1cb2ab7236d2fa7f5a0540b5fdcd5ae3..5e2cdc2b80612d7dbd36a44a684f76c2f50e210a 100644 (file)
}
- NR::Maybe<NR::Rect> bbox = sp_item_bbox_desktop(cc->active_shape);
+ boost::optional<NR::Rect> bbox = sp_item_bbox_desktop(cc->active_shape);
if (bbox) {
NR::Point center = bbox->midpoint();
sp_knot_set_position(cc->connpthandle, center, 0);
diff --git a/src/desktop.cpp b/src/desktop.cpp
index b8d9ef0b036543f9b929af206ff3dce7bc1a0b4c..54285c083c1cb7064f35f930b5914b4af8c17c7c 100644 (file)
--- a/src/desktop.cpp
+++ b/src/desktop.cpp
bool SPDesktop::isWithinViewport (SPItem *item) const
{
NR::Rect const viewport = get_display_area();
- NR::Maybe<NR::Rect> const bbox = sp_item_bbox_desktop(item);
+ boost::optional<NR::Rect> const bbox = sp_item_bbox_desktop(item);
if (bbox) {
return viewport.contains(*bbox);
} else {
void
SPDesktop::zoom_selection()
{
- NR::Maybe<NR::Rect> const d = selection->bounds();
+ boost::optional<NR::Rect> const d = selection->bounds();
if ( !d || d->isEmpty(0.1) ) {
return;
SPItem *docitem = SP_ITEM (sp_document_root (doc()));
g_return_if_fail (docitem != NULL);
- NR::Maybe<NR::Rect> d = sp_item_bbox_desktop(docitem);
+ boost::optional<NR::Rect> d = sp_item_bbox_desktop(docitem);
/* Note that the second condition here indicates that
** there are no items in the drawing.
index 65c8fba02e274b32d020ae880159d73335658506..07b146fca23e7c84c99faa3b7185ca1d81c0f511 100644 (file)
int prefs_bbox = prefs_get_int_attribute("tools", "bounding_box", 0);
SPItem::BBoxType bbox_type = (prefs_bbox ==0)?
SPItem::APPROXIMATE_BBOX : SPItem::GEOMETRIC_BBOX;
- NR::Maybe<NR::Rect> r = SP_ITEM(obj)->getBounds(from_2geom(sp_item_i2doc_affine(SP_ITEM(obj))),
+ boost::optional<NR::Rect> r = SP_ITEM(obj)->getBounds(from_2geom(sp_item_i2doc_affine(SP_ITEM(obj))),
bbox_type);
if (r) {
w = r->dimensions()[NR::X];
diff --git a/src/dialogs/export.cpp b/src/dialogs/export.cpp
index 0e2a08eb4c4442f3ae08ab55c1fedc54489d1e0d..bd4493eaeddb14445b0475ddbee16c2ecb79c7a3 100644 (file)
--- a/src/dialogs/export.cpp
+++ b/src/dialogs/export.cpp
if ( SP_ACTIVE_DESKTOP ) {
SPDocument *doc;
doc = sp_desktop_document (SP_ACTIVE_DESKTOP);
- NR::Maybe<NR::Rect> bbox = sp_item_bbox_desktop (SP_ITEM (SP_DOCUMENT_ROOT (doc)));
+ boost::optional<NR::Rect> bbox = sp_item_bbox_desktop (SP_ITEM (SP_DOCUMENT_ROOT (doc)));
if (bbox) {
sp_export_set_area (base, bbox->min()[NR::X],
bbox->min()[NR::Y],
if ( SP_ACTIVE_DESKTOP )
{
SPDocument *doc;
- NR::Maybe<NR::Rect> bbox;
+ boost::optional<NR::Rect> bbox;
doc = sp_desktop_document (SP_ACTIVE_DESKTOP);
/* Notice how the switch is used to 'fall through' here to get
switch (this_test[i]) {
case SELECTION_SELECTION:
if ((sp_desktop_selection(SP_ACTIVE_DESKTOP))->isEmpty() == false) {
- NR::Maybe<NR::Rect> bbox = (sp_desktop_selection (SP_ACTIVE_DESKTOP))->bounds();
+ boost::optional<NR::Rect> bbox = (sp_desktop_selection (SP_ACTIVE_DESKTOP))->bounds();
//std::cout << "Selection " << bbox;
if ( bbox && sp_export_bbox_equal(*bbox,current_bbox)) {
case SELECTION_DRAWING: {
SPDocument *doc = sp_desktop_document (SP_ACTIVE_DESKTOP);
- NR::Maybe<NR::Rect> bbox = sp_item_bbox_desktop (SP_ITEM (SP_DOCUMENT_ROOT (doc)));
+ boost::optional<NR::Rect> bbox = sp_item_bbox_desktop (SP_ITEM (SP_DOCUMENT_ROOT (doc)));
// std::cout << "Drawing " << bbox2;
if ( bbox && sp_export_bbox_equal(*bbox,current_bbox) ) {
index 7d9aa84a6559d5312b03bfab0811d193a0a2360a..ae387e5f84e6a2f004cf08813f3c7daca3a5e91c 100644 (file)
// Find object's bbox in document
Geom::Matrix const i2doc(sp_item_i2doc_affine(SP_ITEM(object)));
- NR::Maybe<NR::Rect> dbox = SP_ITEM(object)->getBounds(from_2geom(i2doc));
+ boost::optional<NR::Rect> dbox = SP_ITEM(object)->getBounds(from_2geom(i2doc));
if (!dbox) {
return NULL;
index 0c37e5ac0dc6587d2f61c64c8750e6703fb91d46..f9bde3c0b18bf5cabd4aa5f9fe6e26ee489f0a75 100644 (file)
using NR::X;
using NR::Y;
- NR::Maybe<NR::Rect> a = first->getBounds(from_2geom(sp_item_i2doc_affine(first)));
- NR::Maybe<NR::Rect> b = second->getBounds(from_2geom(sp_item_i2doc_affine(second)));
+ boost::optional<NR::Rect> a = first->getBounds(from_2geom(sp_item_i2doc_affine(first)));
+ boost::optional<NR::Rect> b = second->getBounds(from_2geom(sp_item_i2doc_affine(second)));
if ( !a || !b ) {
// FIXME?
int
sp_compare_y_position(SPItem *first, SPItem *second)
{
- NR::Maybe<NR::Rect> a = first->getBounds(from_2geom(sp_item_i2doc_affine(first)));
- NR::Maybe<NR::Rect> b = second->getBounds(from_2geom(sp_item_i2doc_affine(second)));
+ boost::optional<NR::Rect> a = first->getBounds(from_2geom(sp_item_i2doc_affine(first)));
+ boost::optional<NR::Rect> b = second->getBounds(from_2geom(sp_item_i2doc_affine(second)));
if ( !a || !b ) {
// FIXME?
cnt=0;
for (; items != NULL; items = items->next) {
SPItem *item = SP_ITEM(items->data);
- NR::Maybe<NR::Rect> b = item->getBounds(from_2geom(sp_item_i2doc_affine(item)));
+ boost::optional<NR::Rect> b = item->getBounds(from_2geom(sp_item_i2doc_affine(item)));
if (!b) {
continue;
}
const GSList *sizes = sorted;
for (; sizes != NULL; sizes = sizes->next) {
SPItem *item = SP_ITEM(sizes->data);
- NR::Maybe<NR::Rect> b = item->getBounds(from_2geom(sp_item_i2doc_affine(item)));
+ boost::optional<NR::Rect> b = item->getBounds(from_2geom(sp_item_i2doc_affine(item)));
if (b) {
width = b->dimensions()[NR::X];
height = b->dimensions()[NR::Y];
}
- NR::Maybe<NR::Rect> sel_bbox = selection->bounds();
+ boost::optional<NR::Rect> sel_bbox = selection->bounds();
// Fit to bbox, calculate padding between rows accordingly.
if ( sel_bbox && !SpaceManualRadioButton.get_active() ){
#ifdef DEBUG_GRID_ARRANGE
for (; current_row != NULL; current_row = current_row->next) {
SPItem *item=SP_ITEM(current_row->data);
Inkscape::XML::Node *repr = SP_OBJECT_REPR(item);
- NR::Maybe<NR::Rect> b = item->getBounds(from_2geom(sp_item_i2doc_affine(item)));
+ boost::optional<NR::Rect> b = item->getBounds(from_2geom(sp_item_i2doc_affine(item)));
NR::Point min;
if (b) {
width = b->dimensions()[NR::X];
index 73131384fa4608ac0254ba459b256ff0bf521899..923c44addcb49a5c82038ecfc4b7865f358bfc4a 100644 (file)
--- a/src/dialogs/unclump.cpp
+++ b/src/dialogs/unclump.cpp
return i->second;
}
- NR::Maybe<NR::Rect> r = item->getBounds(from_2geom(sp_item_i2d_affine(item)));
+ boost::optional<NR::Rect> r = item->getBounds(from_2geom(sp_item_i2d_affine(item)));
if (r) {
NR::Point const c = r->midpoint();
c_cache[SP_OBJECT_ID(item)] = c;
if ( i != wh_cache.end() ) {
wh = i->second;
} else {
- NR::Maybe<NR::Rect> r = item->getBounds(from_2geom(sp_item_i2d_affine(item)));
+ boost::optional<NR::Rect> r = item->getBounds(from_2geom(sp_item_i2d_affine(item)));
if (r) {
wh = r->dimensions();
wh_cache[SP_OBJECT_ID(item)] = wh;
index 8bc9eade2815fa61100229d68741289dd219a675..33a84d5086edff59e678f11a0ce1cba51c90c2a6 100644 (file)
/** Feeds path-creating calls to the cairo context translating them from the Path, with the given transform and shift */
static void
-feed_path_to_cairo (cairo_t *ct, Geom::Path const &path, Geom::Matrix trans, NR::Maybe<NR::Rect> area, bool optimize_stroke, double stroke_width)
+feed_path_to_cairo (cairo_t *ct, Geom::Path const &path, Geom::Matrix trans, boost::optional<NR::Rect> area, bool optimize_stroke, double stroke_width)
{
if (!area || area->isEmpty())
return;
@@ -206,7 +206,7 @@ feed_path_to_cairo (cairo_t *ct, Geom::Path const &path, Geom::Matrix trans, NR:
/** Feeds path-creating calls to the cairo context translating them from the PathVector, with the given transform and shift
* One must have done cairo_new_path(ct); before calling this function. */
void
-feed_pathvector_to_cairo (cairo_t *ct, Geom::PathVector const &pathv, Geom::Matrix trans, NR::Maybe<NR::Rect> area, bool optimize_stroke, double stroke_width)
+feed_pathvector_to_cairo (cairo_t *ct, Geom::PathVector const &pathv, Geom::Matrix trans, boost::optional<NR::Rect> area, bool optimize_stroke, double stroke_width)
{
if (!area || area->isEmpty())
return;
index 03bf50cb57deb4d0dfb7c44212e69d42c0170688..f3be94464acaddc331aa6ebd1eb5da4d74ea3e6a 100644 (file)
#include <2geom/forward.h>
#include <cairo/cairo.h>
-#include "libnr/nr-maybe.h"
+#include <boost/optional.hpp>
#include "libnr/nr-rect.h"
struct NRPixBlock;
cairo_t *nr_create_cairo_context_canvasbuf (NRRectL *area, SPCanvasBuf *b);
cairo_t *nr_create_cairo_context (NRRectL *area, NRPixBlock *pb);
-void feed_pathvector_to_cairo (cairo_t *ct, Geom::PathVector const &pathv, Geom::Matrix trans, NR::Maybe<NR::Rect> area, bool optimize_stroke, double stroke_width);
+void feed_pathvector_to_cairo (cairo_t *ct, Geom::PathVector const &pathv, Geom::Matrix trans, boost::optional<NR::Rect> area, bool optimize_stroke, double stroke_width);
void feed_pathvector_to_cairo (cairo_t *ct, Geom::PathVector const &pathv);
#endif
index a6a04bb8b2c42993477e24ee754246b6c8ee8de2..a236b866bbfb17bc43d3b306cd70091630d22deb 100644 (file)
}
void
-nr_arena_item_set_item_bbox (NRArenaItem *item, NR::Maybe<NR::Rect> &bbox)
+nr_arena_item_set_item_bbox (NRArenaItem *item, boost::optional<NR::Rect> &bbox)
{
nr_return_if_fail(item != NULL);
nr_return_if_fail(NR_IS_ARENA_ITEM(item));
index c62c9a6ca5403d8b27f411f026e17c5558ece442..b95fc5e72081610a25a9abedf85dfa6e9afff6d1 100644 (file)
NRRectL bbox;
/* BBox in item coordinates - this should be a bounding box as
* specified in SVG standard. Required by filters. */
- NR::Maybe<NR::Rect> item_bbox;
+ boost::optional<NR::Rect> item_bbox;
/* Our affine */
NR::Matrix *transform;
/* Clip item */
void nr_arena_item_set_clip (NRArenaItem *item, NRArenaItem *clip);
void nr_arena_item_set_mask (NRArenaItem *item, NRArenaItem *mask);
void nr_arena_item_set_order (NRArenaItem *item, int order);
-void nr_arena_item_set_item_bbox (NRArenaItem *item, NR::Maybe<NR::Rect> &bbox);
+void nr_arena_item_set_item_bbox (NRArenaItem *item, boost::optional<NR::Rect> &bbox);
NRPixBlock *nr_arena_item_get_background (NRArenaItem const *item, int depth = 0);
index 840f5044a8ad7189776d25fb05d957fa3e61778f..60795becf7f2b42350161e65b23683eaa20c5b32 100644 (file)
// cairo outline rendering:
static unsigned int
-cairo_arena_shape_render_outline(cairo_t *ct, NRArenaItem *item, NR::Maybe<NR::Rect> area)
+cairo_arena_shape_render_outline(cairo_t *ct, NRArenaItem *item, boost::optional<NR::Rect> area)
{
NRArenaShape *shape = NR_ARENA_SHAPE(item);
index 086e4114d288b3bdfc3d4364e219567991a773cd..65958f0d216c5b08c5e1d1f897bbc5018148e1bf 100644 (file)
Matrix identity(1.0, 0.0,
0.0, 1.0,
0.0, 0.0);
- NR::Maybe<NR::Rect> area = SVGElem->getBounds(identity);
+ boost::optional<NR::Rect> area = SVGElem->getBounds(identity);
NRRectL rect;
rect.x0=area->min()[NR::X];
index 592085bcd9ccb0f69f1eccc8851586c7b32bd135..a558774c451dd35933405a22f40da46d439e5cea 100644 (file)
@@ -792,7 +792,7 @@ sp_canvas_group_update (SPCanvasItem *item, NR::Matrix const &affine, unsigned i
}
}
- NR::Maybe<NR::Rect> const bounds = corners.bounds();
+ boost::optional<NR::Rect> const bounds = corners.bounds();
if (bounds) {
item->x1 = bounds->min()[NR::X];
item->y1 = bounds->min()[NR::Y];
diff --git a/src/document.cpp b/src/document.cpp
index 356fba577055c7cab0d165401117f68c68fcadc6..24b6edd20bff95e9766a4fc60002873a5f7c5a93 100644 (file)
--- a/src/document.cpp
+++ b/src/document.cpp
s = find_items_in_area(s, SP_GROUP(o), dkey, area, test);
} else {
SPItem *child = SP_ITEM(o);
- NR::Maybe<NR::Rect> box = sp_item_bbox_desktop(child);
+ boost::optional<NR::Rect> box = sp_item_bbox_desktop(child);
if ( box && test(area, *box) && (take_insensitive || child->isVisibleAndUnlocked(dkey))) {
s = g_slist_append(s, child);
}
index 35e220a4965b5afbf1e795b3469c52f5b0e66b1e..abe4d7dcec36cbf19ec5bf8cc959e394a62a7282 100644 (file)
pointer = motion_dt * motion_to_curve;
// calculate the nearest point on the guide path
- NR::Maybe<Path::cut_position> position = get_nearest_position_on_Path(dc->hatch_livarot_path, pointer);
+ boost::optional<Path::cut_position> position = get_nearest_position_on_Path(dc->hatch_livarot_path, pointer);
nearest = get_point_on_Path(dc->hatch_livarot_path, position->piece, position->t);
diff --git a/src/eraser-context.cpp b/src/eraser-context.cpp
index 81025d2b2e3a06311f3e1a22dcaeddb918fdfda0..7f662f5265791234bff9af0c21cde9d2ae572779 100644 (file)
--- a/src/eraser-context.cpp
+++ b/src/eraser-context.cpp
if (dc->dragging && event->button.button == 1 && !event_context->space_panning) {
dc->dragging = FALSE;
- NR::Maybe<NR::Rect> const b = Inkscape::Rubberband::get()->getRectangle();
+ boost::optional<NR::Rect> const b = Inkscape::Rubberband::get()->getRectangle();
sp_eraser_apply(dc, motion_dt);
Inkscape::XML::Document *xml_doc = sp_document_repr_doc(desktop->doc());
SPItem* acid = SP_ITEM(desktop->doc()->getObjectByRepr(dc->repr));
- NR::Maybe<NR::Rect> eraserBbox = acid->getBounds(NR::identity());
+ boost::optional<NR::Rect> eraserBbox = acid->getBounds(NR::identity());
NR::Rect bounds = (*eraserBbox) * desktop->doc2dt();
std::vector<SPItem*> remainingItems;
GSList* toWorkOn = 0;
for (GSList *i = toWorkOn ; i ; i = i->next ) {
SPItem *item = SP_ITEM(i->data);
if ( eraserMode ) {
- NR::Maybe<NR::Rect> bbox = item->getBounds(NR::identity());
+ boost::optional<NR::Rect> bbox = item->getBounds(NR::identity());
if (bbox && bbox->intersects(*eraserBbox)) {
Inkscape::XML::Node* dup = dc->repr->duplicate(xml_doc);
dc->repr->parent()->appendChild(dup);
diff --git a/src/event-context.cpp b/src/event-context.cpp
index e7c5ac88aeee1034e2d26a75e4d52e5858e74da8..22c91e4505c8f66f508b090406fd5fcc5ac8ce9f 100644 (file)
--- a/src/event-context.cpp
+++ b/src/event-context.cpp
@@ -497,7 +497,7 @@ static gint sp_event_context_private_root_handler(SPEventContext *event_context,
ret = TRUE;
} else if (zoom_rb == event->button.button) {
zoom_rb = 0;
- NR::Maybe<NR::Rect> const b = Inkscape::Rubberband::get()->getRectangle();
+ boost::optional<NR::Rect> const b = Inkscape::Rubberband::get()->getRectangle();
Inkscape::Rubberband::get()->stop();
if (b && !within_tolerance) {
desktop->set_display_area(*b, 10);
index e7620f3195c17bd1fc6a1dfef61c23c9a07df2cc..48fe3bec2afaa020dc95f81d2f7e56947a83fdab 100644 (file)
Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document);
// Get the bounding box of the selection
- //NR::Maybe<NR::Rect> _bbox = item->getBounds(from_2geom(sp_item_i2d_affine(item)));
+ //boost::optional<NR::Rect> _bbox = item->getBounds(from_2geom(sp_item_i2d_affine(item)));
// NRRect bbox = item->getBounds(from_2geom(sp_item_i2d_affine(item)));
NRRect bbox(item->getBounds(from_2geom(sp_item_i2d_affine(item))));
index 534d4bcda632f96d7dbdd618bb29620c39454b95..e206b2a68dddf9bee4adcb121e4873c2fb5f910c 100644 (file)
NR::Point(sp_document_width(doc),
sp_document_height(doc)));
} else {
- NR::Maybe<NR::Rect> bounds = selection->bounds();
+ boost::optional<NR::Rect> bounds = selection->bounds();
if (bounds) {
bounding_area = *bounds;
}
index 02c3626bf9ba9f2255e0b3ee60810cac0f178e23..959070b50948f58adb6fdfef9f7d6e200e5060ef 100644 (file)
* Get the bounding box of an item, as mapped onto
* an ODF document, in cm.
*/
-static NR::Maybe<NR::Rect> getODFBoundingBox(const SPItem *item)
+static boost::optional<NR::Rect> getODFBoundingBox(const SPItem *item)
{
- NR::Maybe<NR::Rect> bbox = sp_item_bbox_desktop((SPItem *)item);
+ boost::optional<NR::Rect> bbox = sp_item_bbox_desktop((SPItem *)item);
if (bbox) {
double doc_height = sp_document_height(SP_ACTIVE_DOCUMENT);
NR::Matrix doc2dt_tf = NR::Matrix(NR::scale(1.0, -1.0));
NR::Matrix tf = getODFTransform(item);
//### Get ODF bounding box params for item
- NR::Maybe<NR::Rect> bbox = getODFBoundingBox(item);
+ boost::optional<NR::Rect> bbox = getODFBoundingBox(item);
if (!bbox) {
return true;
}
diff --git a/src/file.cpp b/src/file.cpp
index 633dc08ceea7f38dfc887d29696a7a23124bb439..b620e9c9e745c60272069c7f6274b47c8952da6d 100644 (file)
--- a/src/file.cpp
+++ b/src/file.cpp
int const saved_pref = prefs_get_int_attribute("options.transform", "pattern", 1);
prefs_set_int_attribute("options.transform", "pattern", 1);
sp_document_ensure_up_to_date(sp_desktop_document(desktop));
- NR::Maybe<NR::Rect> sel_bbox = selection->bounds();
+ boost::optional<NR::Rect> sel_bbox = selection->bounds();
if (sel_bbox) {
NR::Point m( desktop->point() - sel_bbox->midpoint() );
sp_selection_move_relative(selection, m);
index cefb3227dd29cf82583511d21903e3ffb0230c2a..af8cfbfa1df0f6c674e06364bb8c1e06dc1a8adc 100644 (file)
--- a/src/filter-chemistry.cpp
+++ b/src/filter-chemistry.cpp
@@ -319,7 +319,7 @@ new_filter_blend_gaussian_blur (SPDocument *document, const char *blendmode, gdo
SPFilter *
new_filter_simple_from_item (SPDocument *document, SPItem *item, const char *mode, gdouble radius)
{
- NR::Maybe<NR::Rect> const r = sp_item_bbox_desktop(item, SPItem::GEOMETRIC_BBOX);
+ boost::optional<NR::Rect> const r = sp_item_bbox_desktop(item, SPItem::GEOMETRIC_BBOX);
double width;
double height;
stdDeviation /= expansion;
// Get the object size
- NR::Maybe<NR::Rect> const r = sp_item_bbox_desktop(item, SPItem::GEOMETRIC_BBOX);
+ boost::optional<NR::Rect> const r = sp_item_bbox_desktop(item, SPItem::GEOMETRIC_BBOX);
double width;
double height;
if (r) {
diff --git a/src/flood-context.cpp b/src/flood-context.cpp
index b11d32f8a1d9b0ab2e89ddac684fb397be782443..0c284db68537b7428968a5303097e82efc72c1af 100644 (file)
--- a/src/flood-context.cpp
+++ b/src/flood-context.cpp
@@ -801,7 +801,7 @@ static void sp_flood_do_flood_fill(SPEventContext *event_context, GdkEvent *even
sp_document_ensure_up_to_date (document);
SPItem *document_root = SP_ITEM(SP_DOCUMENT_ROOT(document));
- NR::Maybe<NR::Rect> bbox = document_root->getBounds(NR::identity());
+ boost::optional<NR::Rect> bbox = document_root->getBounds(NR::identity());
if (!bbox) {
desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("<b>Area is not bounded</b>, cannot fill."));
index 9fade37ecdcb042f5b430aad95b9989a6ccfc84d..c6dd26712c10a17eb6e782dcf9358ac1852f76a9 100644 (file)
// calculate the bbox of the item
sp_document_ensure_up_to_date(SP_OBJECT_DOCUMENT(item));
- NR::Maybe<NR::Rect> bbox = item->getBounds(NR::identity()); // we need "true" bbox without item_i2d_affine
+ boost::optional<NR::Rect> bbox = item->getBounds(NR::identity()); // we need "true" bbox without item_i2d_affine
if ( !bbox || bbox->isEmpty() )
return gr;
@@ -342,7 +342,7 @@ sp_gradient_convert_to_userspace(SPGradient *gr, SPItem *item, gchar const *prop
// calculate the bbox of the item
sp_document_ensure_up_to_date(SP_OBJECT_DOCUMENT(item));
NR::Matrix bbox2user;
- NR::Maybe<NR::Rect> bbox = item->getBounds(NR::identity()); // we need "true" bbox without item_i2d_affine
+ boost::optional<NR::Rect> bbox = item->getBounds(NR::identity()); // we need "true" bbox without item_i2d_affine
if ( bbox && !bbox->isEmpty() ) {
bbox2user = NR::Matrix(bbox->dimensions()[NR::X], 0,
0, bbox->dimensions()[NR::Y],
@@ -1094,7 +1094,7 @@ sp_item_gradient_get_coords (SPItem *item, guint point_type, guint point_i, bool
if (SP_GRADIENT(gradient)->units == SP_GRADIENT_UNITS_OBJECTBOUNDINGBOX) {
sp_document_ensure_up_to_date(SP_OBJECT_DOCUMENT(item));
- NR::Maybe<NR::Rect> bbox = item->getBounds(NR::identity()); // we need "true" bbox without item_i2d_affine
+ boost::optional<NR::Rect> bbox = item->getBounds(NR::identity()); // we need "true" bbox without item_i2d_affine
if (bbox) {
p *= NR::Matrix(bbox->dimensions()[NR::X], 0,
0, bbox->dimensions()[NR::Y],
index 01964b8e7794444c7967ed3d017eab37db17633d..9101fcee10a9187487c0b6bda774ba45f67ab56e 100644 (file)
--- a/src/gradient-context.cpp
+++ b/src/gradient-context.cpp
@@ -641,7 +641,7 @@ sp_gradient_context_root_handler(SPEventContext *event_context, GdkEvent *event)
if (r->is_started() && !event_context->within_tolerance) {
// this was a rubberband drag
if (r->getMode() == RUBBERBAND_MODE_RECT) {
- NR::Maybe<NR::Rect> const b = r->getRectangle();
+ boost::optional<NR::Rect> const b = r->getRectangle();
drag->selectRect(*b);
}
}
diff --git a/src/gradient-drag.cpp b/src/gradient-drag.cpp
index 71b71b1c3c0fda3daa08def877b2b8fe14817532..1657288cced11b8990666a2b38e301b52e22363d 100644 (file)
--- a/src/gradient-drag.cpp
+++ b/src/gradient-drag.cpp
for (GSList const* i = this->selection->itemList(); i != NULL; i = i->next) {
SPItem *item = SP_ITEM(i->data);
- NR::Maybe<NR::Rect> rect = sp_item_bbox_desktop (item);
+ boost::optional<NR::Rect> rect = sp_item_bbox_desktop (item);
if (rect) {
// Remember the edges of the bbox and the center axis
hor_levels.push_back(rect->min()[NR::Y]);
index 9285e9618cc510350104cb8f3d758c2852cf9bd9..60cdab8146c6490e07e810a1ca915e8385a0a243 100644 (file)
++i)
{
SPItem *u=*i;
- NR::Maybe<NR::Rect> const item_box(sp_item_bbox_desktop(u));
+ boost::optional<NR::Rect> const item_box(sp_item_bbox_desktop(u));
if(item_box) {
NR::Point ll(item_box->min());
NR::Point ur(item_box->max());
map<string,unsigned>::iterator i=nodelookup.find(u->id);
if(i!=nodelookup.end()) {
Rectangle* r=rs[i->second];
- NR::Maybe<NR::Rect> item_box(sp_item_bbox_desktop(u));
+ boost::optional<NR::Rect> item_box(sp_item_bbox_desktop(u));
if(item_box) {
NR::Point const curr(item_box->midpoint());
NR::Point const dest(r->getCentreX(),r->getCentreY());
diff --git a/src/interface.cpp b/src/interface.cpp
index dc583a645fe373e2c7fea4777b0372fdea776cc5..0ec73d81bbcb735a39ae502bd5acfa22ee6d03ed 100644 (file)
--- a/src/interface.cpp
+++ b/src/interface.cpp
Path *livarot_path = Path_for_item(item, true, true);
livarot_path->ConvertWithBackData(0.04);
- NR::Maybe<Path::cut_position> position = get_nearest_position_on_Path(livarot_path, button_doc);
+ boost::optional<Path::cut_position> position = get_nearest_position_on_Path(livarot_path, button_doc);
if (position) {
NR::Point nearest = get_point_on_Path(livarot_path, position->piece, position->t);
NR::Point delta = nearest - button_doc;
int const saved_pref = prefs_get_int_attribute("options.transform", "pattern", 1);
prefs_set_int_attribute("options.transform", "pattern", 1);
sp_document_ensure_up_to_date(sp_desktop_document(desktop));
- NR::Maybe<NR::Rect> sel_bbox = selection->bounds();
+ boost::optional<NR::Rect> sel_bbox = selection->bounds();
if (sel_bbox) {
NR::Point m( desktop->point() - sel_bbox->midpoint() );
sp_selection_move_relative(selection, m);
index 51dabcf07f1300a8c91bf336d9156eddbc94e7ff..dafdd8840bb69c7e7cf4b23ec652ff2f938888c6 100644 (file)
ConvexHull() : _bounds() {}
explicit ConvexHull(Point const &p) : _bounds(Rect(p, p)) {}
- Maybe<Point> midpoint() const {
+ boost::optional<Point> midpoint() const {
if (_bounds) {
return _bounds->midpoint();
} else {
- return Nothing();
+ return boost::optional<Point>();
}
}
}
}
- Maybe<Rect> const &bounds() const {
+ boost::optional<Rect> const &bounds() const {
return _bounds;
}
private:
- Maybe<Rect> _bounds;
+ boost::optional<Rect> _bounds;
};
} /* namespace NR */
index fa3c687c539d534ffba8093f00d1aa61f90873bc..4f6c5c866814b2659bb137385866b064721bd7fc 100644 (file)
--- a/src/libnr/nr-rect-l.cpp
+++ b/src/libnr/nr-rect-l.cpp
#include <libnr/nr-rect-l.h>
-NR::Maybe<NR::Rect> NRRectL::upgrade() const {
+boost::optional<NR::Rect> NRRectL::upgrade() const {
if (nr_rect_l_test_empty_ptr(this)) {
- return NR::Nothing();
+ return boost::optional<NR::Rect>();
} else {
return NR::Rect(NR::Point(x0, y0), NR::Point(x1, y1));
}
diff --git a/src/libnr/nr-rect-l.h b/src/libnr/nr-rect-l.h
index 18065d1d7aa627ac2ebb395f604ce2c80d49e17d..f21ba8fc6295d5847ab4f5c64a5c2176bf9b9020 100644 (file)
--- a/src/libnr/nr-rect-l.h
+++ b/src/libnr/nr-rect-l.h
#define SEEN_NR_RECT_L_H
#include <libnr/nr-i-coord.h>
-#include <libnr/nr-maybe.h>
+#include <boost/optional.hpp>
#include <libnr/nr-rect.h>
#include <libnr/nr-point-l.h>
struct NRRectL {
- NR::Maybe<NR::Rect> upgrade() const;
+ boost::optional<NR::Rect> upgrade() const;
NR::ICoord x0, y0, x1, y1;
};
void expandTo(const IRect &r);
/** Returns the set of points shared by both rectangles. */
- static Maybe<IRect> intersection(const IRect &a, const IRect &b);
+ static boost::optional<IRect> intersection(const IRect &a, const IRect &b);
/** Returns the smallest rectangle that encloses both rectangles. */
static IRect union_bounds(const IRect &a, const IRect &b);
diff --git a/src/libnr/nr-rect.cpp b/src/libnr/nr-rect.cpp
index 04d93ae043f08d26c7a1c6f411d69af69198cca1..77af27417517d6b9dadfce6a35b7d600f74a2a10 100644 (file)
--- a/src/libnr/nr-rect.cpp
+++ b/src/libnr/nr-rect.cpp
x1(rect.max()[NR::X]), y1(rect.max()[NR::Y])
{}
-NRRect::NRRect(NR::Maybe<NR::Rect> const &rect) {
+NRRect::NRRect(boost::optional<NR::Rect> const &rect) {
if (rect) {
x0 = rect->min()[NR::X];
y0 = rect->min()[NR::Y];
}
}
-NR::Maybe<NR::Rect> NRRect::upgrade() const {
+boost::optional<NR::Rect> NRRect::upgrade() const {
if (nr_rect_d_test_empty_ptr(this)) {
- return NR::Nothing();
+ return boost::optional<NR::Rect>();
} else {
return NR::Rect(NR::Point(x0, y0), NR::Point(x1, y1));
}
}
/** Returns the set of points shared by both rectangles. */
-Maybe<Rect> intersection(Maybe<Rect> const & a, Maybe<Rect> const & b) {
+boost::optional<Rect> intersection(boost::optional<Rect> const & a, boost::optional<Rect> const & b) {
if ( !a || !b ) {
- return Nothing();
+ return boost::optional<Rect>();
} else {
Rect r;
for ( int i=0 ; i < 2 ; i++ ) {
r._min[i] = std::max(a->_min[i], b->_min[i]);
r._max[i] = std::min(a->_max[i], b->_max[i]);
if ( r._min[i] > r._max[i] ) {
- return Nothing();
- }
+ return boost::optional<Rect>();
+ }
}
return r;
}
diff --git a/src/libnr/nr-rect.h b/src/libnr/nr-rect.h
index da1299b2bba61ad406262d3207b8498484f57e6e..7d130fd183f2586157631b5c81eed67704ed741d 100644 (file)
--- a/src/libnr/nr-rect.h
+++ b/src/libnr/nr-rect.h
#include <libnr/nr-i-coord.h>
#include <libnr/nr-dim2.h>
#include <libnr/nr-point.h>
-#include <libnr/nr-maybe.h>
+#include <boost/optional.hpp>
#include <libnr/nr-point-matrix-ops.h>
#include <libnr/nr-forward.h>
friend inline std::ostream &operator<<(std::ostream &out_file, NR::Rect const &in_rect);
private:
- Rect(Nothing) : _min(1, 1), _max(-1, -1) {}
+// Rect(Nothing) : _min(1, 1), _max(-1, -1) {}
static double _inf() {
return std::numeric_limits<double>::infinity();
Point _min, _max;
- friend class MaybeStorage<Rect>;
- friend Maybe<Rect> intersection(Maybe<Rect> const &, Maybe<Rect> const &);
+ friend boost::optional<Rect> intersection(boost::optional<Rect> const &, boost::optional<Rect> const &);
friend Rect union_bounds(Rect const &, Rect const &);
};
-template <>
-class MaybeStorage<Rect> {
-public:
- MaybeStorage() : _rect(Nothing()) {}
- MaybeStorage(Rect const &rect) : _rect(rect) {}
-
- bool is_nothing() const {
- return _rect._min[X] > _rect._max[X];
- }
- Rect const &value() const { return _rect; }
- Rect &value() { return _rect; }
-
-private:
- Rect _rect;
-};
-
/** Returns the set of points shared by both rectangles. */
-Maybe<Rect> intersection(Maybe<Rect> const & a, Maybe<Rect> const & b);
+boost::optional<Rect> intersection(boost::optional<Rect> const & a, boost::optional<Rect> const & b);
/** Returns the smallest rectangle that encloses both rectangles. */
Rect union_bounds(Rect const &a, Rect const &b);
-inline Rect union_bounds(Maybe<Rect> const & a, Rect const &b) {
+inline Rect union_bounds(boost::optional<Rect> const & a, Rect const &b) {
if (a) {
return union_bounds(*a, b);
} else {
return b;
}
}
-inline Rect union_bounds(Rect const &a, Maybe<Rect> const & b) {
+inline Rect union_bounds(Rect const &a, boost::optional<Rect> const & b) {
if (b) {
return union_bounds(a, *b);
} else {
return a;
}
}
-inline Maybe<Rect> union_bounds(Maybe<Rect> const & a, Maybe<Rect> const & b)
+inline boost::optional<Rect> union_bounds(boost::optional<Rect> const & a, boost::optional<Rect> const & b)
{
if (!a) {
return b;
: x0(xmin), y0(ymin), x1(xmax), y1(ymax)
{}
explicit NRRect(NR::Rect const &rect);
- explicit NRRect(NR::Maybe<NR::Rect> const &rect);
- operator NR::Maybe<NR::Rect>() const { return upgrade(); }
- NR::Maybe<NR::Rect> upgrade() const;
+ explicit NRRect(boost::optional<NR::Rect> const &rect);
+ operator boost::optional<NR::Rect>() const { return upgrade(); }
+ boost::optional<NR::Rect> upgrade() const;
NR::Coord x0, y0, x1, y1;
};
index 5058e8e229b7428f06ff45b67849102cb4a7e722..4f745c0f946d85859d2829555e86e30f16c80a48 100644 (file)
return true;
}
-NR::Maybe<NR::Rect> font_instance::BBox(int glyph_id)
+boost::optional<NR::Rect> font_instance::BBox(int glyph_id)
{
int no=-1;
if ( id_to_no.find(glyph_id) == id_to_no.end() ) {
no=id_to_no[glyph_id];
}
if ( no < 0 ) {
- return NR::Nothing();
+ return boost::optional<NR::Rect>();
} else {
NR::Point rmin(glyphs[no].bbox[0],glyphs[no].bbox[1]);
NR::Point rmax(glyphs[no].bbox[2],glyphs[no].bbox[3]);
index 2471da3dd181078ee201e034a9e60b3799e24b4b..84307c9cea2ceb1522c4f1878a3b4f4b690d9771 100644 (file)
return sourceToIterator(source_cookie, Glib::ustring::const_iterator(std::string::const_iterator(NULL)));
}
-NR::Maybe<NR::Rect> Layout::glyphBoundingBox(iterator const &it, double *rotation) const
+boost::optional<NR::Rect> Layout::glyphBoundingBox(iterator const &it, double *rotation) const
{
if (rotation) *rotation = _glyphs[it._glyph_index].rotation;
return _glyphs[it._glyph_index].span(this).font->BBox(_glyphs[it._glyph_index].glyph);
index 3ad979ccadc52e98cc6170a1d6efe891ad32035a..36c882d446d3a0b1b530b1d25dbb49c19fcf5c43 100644 (file)
@@ -116,7 +116,7 @@ void Layout::getBoundingBox(NRRect *bounding_box, NR::Matrix const &transform, i
_getGlyphTransformMatrix(glyph_index, &glyph_matrix);
NR::Matrix total_transform = glyph_matrix;
total_transform *= transform;
- NR::Maybe<NR::Rect> glyph_rect = _glyphs[glyph_index].span(this).font->BBox(_glyphs[glyph_index].glyph);
+ boost::optional<NR::Rect> glyph_rect = _glyphs[glyph_index].span(this).font->BBox(_glyphs[glyph_index].glyph);
if (glyph_rect) {
NR::Point bmi = glyph_rect->min(), bma = glyph_rect->max();
NR::Point tlp(bmi[0],bmi[1]), trp(bma[0],bmi[1]), blp(bmi[0],bma[1]), brp(bma[0],bma[1]);
index 36e7be0a5fe1b61dc95824e0720af9845f94cb81..cea97ff2a9b05549dc2595c398ab8f99ca586264 100644 (file)
#ifndef __LAYOUT_TNG_H__
#define __LAYOUT_TNG_H__
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
#include "libnr/nr-rect.h"
#include "libnr/nr-matrix.h"
#include "libnr/nr-matrix-ops.h"
#include <pango/pango-break.h>
#include <algorithm>
#include <vector>
+#include <boost/optional.hpp>
#ifdef HAVE_CAIRO_PDF
namespace Inkscape {
/** Returns the bounding box of the given glyph, and its rotation.
The centre of rotation is the horizontal centre of the box at the
text baseline. */
- NR::Maybe<NR::Rect> glyphBoundingBox(iterator const &it, double *rotation) const;
+ boost::optional<NR::Rect> glyphBoundingBox(iterator const &it, double *rotation) const;
/** Returns the zero-based line number of the character pointed to by
\a it. */
index 61ef1720b4056dd05d89114228b0fc582b73cc13..10e65366470a61aec66727aae904da6ec9df7f3e 100644 (file)
{
area->x0=area->y0=area->x1=area->y1=0;
if ( daddy == NULL ) return;
- NR::Maybe<NR::Rect> res=daddy->BBox(glyph_id);
+ boost::optional<NR::Rect> res=daddy->BBox(glyph_id);
if (res) {
NR::Point bmi=res->min(),bma=res->max();
NR::Point tlp(bmi[0],bmi[1]),trp(bma[0],bmi[1]),blp(bmi[0],bma[1]),brp(bma[0],bma[1]);
index e204f5df1ee2462382618562153d6be6935fff9e..f2e3438f1b2084c07bc43465c34873ceb7bff9b2 100644 (file)
bool FontMetrics(double &ascent, double &descent, double &leading);
bool FontSlope(double &run, double &rise);
// for generating slanted cursors for oblique fonts
- NR::Maybe<NR::Rect> BBox(int glyph_id);
+ boost::optional<NR::Rect> BBox(int glyph_id);
// creates a rasterfont for the given style
raster_font* RasterFont(NR::Matrix const &trs, double stroke_width,
diff --git a/src/line-geometry.cpp b/src/line-geometry.cpp
index d050ec458c266605d4142a65e09e4593080508f5..056bfb71a964db081c7bfac0b2c409f9dbea4da5 100644 (file)
--- a/src/line-geometry.cpp
+++ b/src/line-geometry.cpp
return *this;
}
-NR::Maybe<NR::Point> Line::intersect(Line const &line) {
+boost::optional<NR::Point> Line::intersect(Line const &line) {
NR::Coord denom = NR::dot(v_dir, line.normal);
- NR::Maybe<NR::Point> no_point = NR::Nothing();
+ boost::optional<NR::Point> no_point;
if (fabs(denom) < 1e-6)
return no_point;
NR::Point Line::closest_to(NR::Point const &pt)
{
/* return the intersection of this line with a perpendicular line passing through pt */
- NR::Maybe<NR::Point> result = this->intersect(Line(pt, (this->v_dir).ccw(), false));
+ boost::optional<NR::Point> result = this->intersect(Line(pt, (this->v_dir).ccw(), false));
g_return_val_if_fail (result, NR::Point (0.0, 0.0));
return *result;
}
@@ -178,7 +178,7 @@ side_of_intersection (NR::Point const &A, NR::Point const &B, NR::Point const &C
}
}
-NR::Maybe<NR::Point> Line::intersection_with_viewbox (SPDesktop *desktop)
+boost::optional<NR::Point> Line::intersection_with_viewbox (SPDesktop *desktop)
{
NR::Rect vb = desktop->get_display_area();
/* remaining viewbox corners */
std::pair <NR::Point, NR::Point> e = side_of_intersection (vb.min(), lr, vb.max(), ul, this->pt, this->v_dir);
if (e.first == e.second) {
// perspective line lies outside the canvas
- return NR::Nothing();
+ return boost::optional<NR::Point>();
}
Line line (e.first, e.second);
diff --git a/src/line-geometry.h b/src/line-geometry.h
index 5e3152c03c97e44e9f4be6b32cdf559af56db5d6..86ed9ee8aa1c3f8ef7a2489c413ee55074b26390 100644 (file)
--- a/src/line-geometry.h
+++ b/src/line-geometry.h
#include "libnr/nr-point.h"
#include "libnr/nr-point-fns.h"
-#include "libnr/nr-maybe.h"
+#include <boost/optional.hpp>
#include "glib.h"
#include "display/sp-ctrlline.h"
#include "axis-manip.h" // FIXME: This is only for Box3D::epsilon; move that to a better location
Line(Line const &line);
virtual ~Line() {}
Line &operator=(Line const &line);
- virtual NR::Maybe<NR::Point> intersect(Line const &line);
+ virtual boost::optional<NR::Point> intersect(Line const &line);
inline NR::Point direction () { return v_dir; }
NR::Point closest_to(NR::Point const &pt); // returns the point on the line closest to pt
friend inline std::ostream &operator<< (std::ostream &out_file, const Line &in_line);
- NR::Maybe<NR::Point> intersection_with_viewbox (SPDesktop *desktop);
+ boost::optional<NR::Point> intersection_with_viewbox (SPDesktop *desktop);
inline bool lie_on_same_side (NR::Point const &A, NR::Point const &B) {
/* If A is a point in the plane and n is the normal vector of the line then
the sign of dot(A, n) specifies the half-plane in which A lies.
diff --git a/src/line-snapper.cpp b/src/line-snapper.cpp
index ee902d5fc08ba6e07b279f584937be637b82cfde..d06d027e314c8b3d94f931e597d0981d2bf55e7d 100644 (file)
--- a/src/line-snapper.cpp
+++ b/src/line-snapper.cpp
Inkscape::Snapper::PointType const &t,
NR::Point const &p,
bool const &/*f*/,
- NR::Maybe<NR::Rect> const &/*bbox_to_snap*/,
+ boost::optional<NR::Rect> const &/*bbox_to_snap*/,
std::vector<SPItem const *> const */*it*/,
std::vector<NR::Point> */*unselected_nodes*/) const
{
Inkscape::Snapper::PointType const &t,
NR::Point const &p,
bool const &/*f*/,
- NR::Maybe<NR::Rect> const &/*bbox_to_snap*/,
+ boost::optional<NR::Rect> const &/*bbox_to_snap*/,
ConstraintLine const &c,
std::vector<SPItem const *> const */*it*/) const
diff --git a/src/line-snapper.h b/src/line-snapper.h
index e5fc95dcba82c4950744dbd9832fd915bc54b021..e0adf38454f6479968fc7be2d04cc7c779fddeeb 100644 (file)
--- a/src/line-snapper.h
+++ b/src/line-snapper.h
Inkscape::Snapper::PointType const &t,
NR::Point const &p,
bool const &first_point,
- NR::Maybe<NR::Rect> const &bbox_to_snap,
+ boost::optional<NR::Rect> const &bbox_to_snap,
std::vector<SPItem const *> const *it,
std::vector<NR::Point> *unselected_nodes) const;
Inkscape::Snapper::PointType const &t,
NR::Point const &p,
bool const &first_point,
- NR::Maybe<NR::Rect> const &bbox_to_snap,
+ boost::optional<NR::Rect> const &bbox_to_snap,
ConstraintLine const &c,
std::vector<SPItem const *> const *it) const;
diff --git a/src/main.cpp b/src/main.cpp
index 6ec0ca6b405df1bea3eaccd8411d254bc1a658be..d6f0ae9e827a49c93d7257673ed8db6da96061dd 100644 (file)
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -920,7 +920,7 @@ do_query_dimension (SPDocument *doc, bool extent, NR::Dim2 const axis, const gch
SPItem *item = ((SPItem *) o);
// "true" SVG bbox for scripting
- NR::Maybe<NR::Rect> area = item->getBounds(from_2geom(sp_item_i2doc_affine(item)));
+ boost::optional<NR::Rect> area = item->getBounds(from_2geom(sp_item_i2doc_affine(item)));
if (area) {
Inkscape::SVGOStringStream os;
if (extent) {
{
SPItem *item = ((SPItem *) o);
if (o->id && SP_IS_ITEM(item)) {
- NR::Maybe<NR::Rect> area = item->getBounds(from_2geom(sp_item_i2doc_affine(item)));
+ boost::optional<NR::Rect> area = item->getBounds(from_2geom(sp_item_i2doc_affine(item)));
if (area) {
Inkscape::SVGOStringStream os;
os << o->id;
diff --git a/src/node-context.cpp b/src/node-context.cpp
index bff972408c8910055f80c846d4f99f5c3489141b..d8a1ec1d7deb953f20517561dfd35d78ff8b5d2b 100644 (file)
--- a/src/node-context.cpp
+++ b/src/node-context.cpp
if (event->type == GDK_BUTTON_RELEASE) {
event_context->xp = event_context->yp = 0;
if (event->button.button == 1) {
- NR::Maybe<NR::Rect> b = Inkscape::Rubberband::get()->getRectangle();
+ boost::optional<NR::Rect> b = Inkscape::Rubberband::get()->getRectangle();
if (nc->shape_editor->hits_curve() && !event_context->within_tolerance) { //drag curve
nc->shape_editor->finish_drag();
break;
case GDK_Escape:
{
- NR::Maybe<NR::Rect> const b = Inkscape::Rubberband::get()->getRectangle();
+ boost::optional<NR::Rect> const b = Inkscape::Rubberband::get()->getRectangle();
if (b) {
Inkscape::Rubberband::get()->stop();
nc->current_state = SP_NODE_CONTEXT_INACTIVE;
diff --git a/src/nodepath.cpp b/src/nodepath.cpp
index c5a653bf0ee1d152110f1762550543ac29affdf2..017544901a7717f6e51cc4d213aaa352afb0a28a 100644 (file)
--- a/src/nodepath.cpp
+++ b/src/nodepath.cpp
@@ -1616,9 +1616,9 @@ void sp_node_selected_move_absolute(Inkscape::NodePath::Path *nodepath, Geom::Co
/**
* If the coordinates of all selected nodes coincide, return the common coordinate; otherwise return NR::Nothing
*/
-NR::Maybe<Geom::Coord> sp_node_selected_common_coord (Inkscape::NodePath::Path *nodepath, Geom::Dim2 axis)
+boost::optional<Geom::Coord> sp_node_selected_common_coord (Inkscape::NodePath::Path *nodepath, Geom::Dim2 axis)
{
- NR::Maybe<Geom::Coord> no_coord = NR::Nothing();
+ boost::optional<Geom::Coord> no_coord;
g_return_val_if_fail(nodepath->selected, no_coord);
// determine coordinate of first selected node
@@ -4271,7 +4271,7 @@ void sp_nodepath_selected_nodes_scale_screen(Inkscape::NodePath::Path *nodepath,
/**
* Flip selected nodes horizontally/vertically.
*/
-void sp_nodepath_flip (Inkscape::NodePath::Path *nodepath, NR::Dim2 axis, NR::Maybe<NR::Point> center)
+void sp_nodepath_flip (Inkscape::NodePath::Path *nodepath, NR::Dim2 axis, boost::optional<NR::Point> center)
{
if (!nodepath || !nodepath->selected) return;
diff --git a/src/nodepath.h b/src/nodepath.h
index ac0c400d41fd8d05ee5c9380d09e496a7d4636bb..b330ff96415b9ca8a75f8b2f9e7e324e77ed24df 100644 (file)
--- a/src/nodepath.h
+++ b/src/nodepath.h
@@ -313,7 +313,7 @@ void sp_node_selected_move (Inkscape::NodePath::Path *nodepath, gdouble dx, gdou
void sp_node_selected_move_screen (Inkscape::NodePath::Path *nodepath, gdouble dx, gdouble dy);
void sp_node_selected_move_absolute (Inkscape::NodePath::Path *nodepath, Geom::Coord val, Geom::Dim2 axis);
Geom::Rect sp_node_selected_bbox (Inkscape::NodePath::Path *nodepath);
-NR::Maybe<Geom::Coord> sp_node_selected_common_coord (Inkscape::NodePath::Path *nodepath, Geom::Dim2 axis);
+boost::optional<Geom::Coord> sp_node_selected_common_coord (Inkscape::NodePath::Path *nodepath, Geom::Dim2 axis);
void sp_nodepath_show_handles(Inkscape::NodePath::Path *nodepath, bool show);
//SPCanvasItem *sp_nodepath_generate_helperpath(SPDesktop *desktop, SPCurve *curve, const SPItem *item, guint32 color);
@@ -328,6 +328,6 @@ void sp_nodepath_selected_nodes_rotate (Inkscape::NodePath::Path * nodepath, gdo
void sp_nodepath_selected_nodes_scale (Inkscape::NodePath::Path * nodepath, gdouble grow, int which);
void sp_nodepath_selected_nodes_scale_screen (Inkscape::NodePath::Path * nodepath, gdouble grow, int which);
-void sp_nodepath_flip (Inkscape::NodePath::Path *nodepath, NR::Dim2 axis, NR::Maybe<NR::Point> center);
+void sp_nodepath_flip (Inkscape::NodePath::Path *nodepath, NR::Dim2 axis, boost::optional<NR::Point> center);
#endif
diff --git a/src/object-snapper.cpp b/src/object-snapper.cpp
index 5f65e3ff91f26b93e688d17490a5e8a4121b4456..020a4793d81f232524716ecaa52d2a4c73305880 100644 (file)
--- a/src/object-snapper.cpp
+++ b/src/object-snapper.cpp
_candidates->clear();
}
- NR::Maybe<NR::Rect> bbox_of_item = NR::Rect(); // a default NR::Rect is infinitely large
+ boost::optional<NR::Rect> bbox_of_item = NR::Rect(); // a default NR::Rect is infinitely large
NR::Rect bbox_to_snap_incl = bbox_to_snap; // _incl means: will include the snapper tolerance
bbox_to_snap_incl.growBy(getSnapperTolerance()); // see?
@@ -217,7 +217,7 @@ void Inkscape::ObjectSnapper::_collectNodes(Inkscape::Snapper::PointType const &
// Discard the bbox of a clipped path / mask, because we don't want to snap to both the bbox
// of the item AND the bbox of the clipping path at the same time
if (!(*i).clip_or_mask) {
- NR::Maybe<NR::Rect> b = sp_item_bbox_desktop(root_item, bbox_type);
+ boost::optional<NR::Rect> b = sp_item_bbox_desktop(root_item, bbox_type);
if (b) {
for ( unsigned k = 0 ; k < 4 ; k++ ) {
_points_to_snap_to->push_back(b->corner(k));
Inkscape::Snapper::PointType const &t,
NR::Point const &p,
bool const &first_point,
- NR::Maybe<NR::Rect> const &bbox_to_snap,
+ boost::optional<NR::Rect> const &bbox_to_snap,
std::vector<SPItem const *> const *it,
std::vector<NR::Point> *unselected_nodes) const
{
Inkscape::Snapper::PointType const &t,
NR::Point const &p,
bool const &first_point,
- NR::Maybe<NR::Rect> const &bbox_to_snap,
+ boost::optional<NR::Rect> const &bbox_to_snap,
ConstraintLine const &c,
std::vector<SPItem const *> const *it) const
{
diff --git a/src/object-snapper.h b/src/object-snapper.h
index 6034660002c58fd7336d0bb421c41ca8b73a2c87..3784c43d0e169bd3e498cc02f5915c9e66f15f5a 100644 (file)
--- a/src/object-snapper.h
+++ b/src/object-snapper.h
Inkscape::Snapper::PointType const &t,
NR::Point const &p,
bool const &first_point,
- NR::Maybe<NR::Rect> const &bbox_to_snap,
+ boost::optional<NR::Rect> const &bbox_to_snap,
std::vector<SPItem const *> const *it,
std::vector<NR::Point> *unselected_nodes) const;
Inkscape::Snapper::PointType const &t,
NR::Point const &p,
bool const &first_point,
- NR::Maybe<NR::Rect> const &bbox_to_snap,
+ boost::optional<NR::Rect> const &bbox_to_snap,
ConstraintLine const &c,
std::vector<SPItem const *> const *it) const;
index 395d4fe0e78ffb4c5a87f4933749b2a27ed1c1b0..0562123dee7595ddc667ea91a9cdfa5abd9a535e 100644 (file)
++it)
{
using NR::X; using NR::Y;
- NR::Maybe<NR::Rect> item_box(sp_item_bbox_desktop(*it));
+ boost::optional<NR::Rect> item_box(sp_item_bbox_desktop(*it));
if (item_box) {
NR::Point min(item_box->min() - .5*gap);
NR::Point max(item_box->max() + .5*gap);
diff --git a/src/rubberband.cpp b/src/rubberband.cpp
index 58f88bbfbf90ac75c8ea9c6f662b93767e4673b8..73333a555278f76a182104790bd6219f2c331d34 100644 (file)
--- a/src/rubberband.cpp
+++ b/src/rubberband.cpp
_mode = mode;
}
-NR::Maybe<NR::Rect> Inkscape::Rubberband::getRectangle() const
+boost::optional<NR::Rect> Inkscape::Rubberband::getRectangle() const
{
if (!_started) {
- return NR::Nothing();
+ return boost::optional<NR::Rect>();
}
return NR::Rect(_start, _end);
diff --git a/src/rubberband.h b/src/rubberband.h
index b6ef1984eec6a32fb5efe9d8a1211fb02d3e51aa..7734a65fa98d2c309d620189f57269f79437ca6c 100644 (file)
--- a/src/rubberband.h
+++ b/src/rubberband.h
#include "forward.h"
#include "libnr/nr-forward.h"
#include "libnr/nr-point.h"
-#include "libnr/nr-maybe.h"
+#include <boost/optional.hpp>
#include <vector>
/* fixme: do multidocument safe */
void start(SPDesktop *desktop, NR::Point const &p);
void move(NR::Point const &p);
- NR::Maybe<NR::Rect> getRectangle() const;
+ boost::optional<NR::Rect> getRectangle() const;
void stop();
bool is_started();
diff --git a/src/selcue.cpp b/src/selcue.cpp
index bac12fe802f6ec25391ba30070c1b589239043a0..2ce9a8b50222a029b7df74cac301215e4ebc8c16 100644 (file)
--- a/src/selcue.cpp
+++ b/src/selcue.cpp
for (GSList const *l = _selection->itemList(); l != NULL; l = l->next) {
SPItem *item = (SPItem *) l->data;
- NR::Maybe<NR::Rect> const b = sp_item_bbox_desktop(item, bbox_type);
+ boost::optional<NR::Rect> const b = sp_item_bbox_desktop(item, bbox_type);
SPCanvasItem* box = NULL;
diff --git a/src/select-context.cpp b/src/select-context.cpp
index 010382376e9f7b8e3d50c6256eaaf075e6659da4..0957b8432233000c74c91fc837e741becf0bf94f 100644 (file)
--- a/src/select-context.cpp
+++ b/src/select-context.cpp
// this was a rubberband drag
GSList *items = NULL;
if (r->getMode() == RUBBERBAND_MODE_RECT) {
- NR::Maybe<NR::Rect> const b = r->getRectangle();
+ boost::optional<NR::Rect> const b = r->getRectangle();
items = sp_document_items_in_box(sp_desktop_document(desktop), desktop->dkey, *b);
} else if (r->getMode() == RUBBERBAND_MODE_TOUCHPATH) {
items = sp_document_items_at_points(sp_desktop_document(desktop), desktop->dkey, r->getPoints());
index a5f27038965c5962ed962473cebc3f9bc28ab7ba..114ed9c645a67470811fe9d9502201820303eab0 100644 (file)
}
/** Finds out the minimum common bbox of the selected items. */
-static NR::Maybe<NR::Rect>
+static boost::optional<NR::Rect>
enclose_items(GSList const *items)
{
g_assert(items != NULL);
- NR::Maybe<NR::Rect> r = NR::Nothing();
+ boost::optional<NR::Rect> r;
for (GSList const *i = items; i; i = i->next) {
r = NR::union_bounds(r, sp_item_bbox_desktop((SPItem *) i->data));
}
rev = g_slist_sort(rev, (GCompareFunc) sp_item_repr_compare_position);
// Determine the common bbox of the selected items.
- NR::Maybe<NR::Rect> selected = enclose_items(items);
+ boost::optional<NR::Rect> selected = enclose_items(items);
// Iterate over all objects in the selection (starting from top).
if (selected) {
for (SPObject *newref = child->next; newref; newref = newref->next) {
// if the sibling is an item AND overlaps our selection,
if (SP_IS_ITEM(newref)) {
- NR::Maybe<NR::Rect> newref_bbox = sp_item_bbox_desktop(SP_ITEM(newref));
+ boost::optional<NR::Rect> newref_bbox = sp_item_bbox_desktop(SP_ITEM(newref));
if ( newref_bbox && selected->intersects(*newref_bbox) ) {
// AND if it's not one of our selected objects,
if (!g_slist_find((GSList *) items, newref)) {
Inkscape::XML::Node *grepr = SP_OBJECT_REPR(group);
// Determine the common bbox of the selected items.
- NR::Maybe<NR::Rect> selected = enclose_items(items);
+ boost::optional<NR::Rect> selected = enclose_items(items);
/* Construct direct-ordered list of selected children. */
GSList *rev = g_slist_copy((GSList *) items);
for (SPObject *newref = prev_sibling(child); newref; newref = prev_sibling(newref)) {
// if the sibling is an item AND overlaps our selection,
if (SP_IS_ITEM(newref)) {
- NR::Maybe<NR::Rect> ref_bbox = sp_item_bbox_desktop(SP_ITEM(newref));
+ boost::optional<NR::Rect> ref_bbox = sp_item_bbox_desktop(SP_ITEM(newref));
if ( ref_bbox && selected->intersects(*ref_bbox) ) {
// AND if it's not one of our selected objects,
if (!g_slist_find((GSList *) items, newref)) {
if (selection->isEmpty())
return;
- NR::Maybe<NR::Rect> const bbox(selection->bounds());
+ boost::optional<NR::Rect> const bbox(selection->bounds());
if ( !bbox || bbox->isEmpty() ) {
return;
}
@@ -1270,7 +1270,7 @@ void sp_selection_scale_relative(Inkscape::Selection *selection, NR::Point const
if (selection->isEmpty())
return;
- NR::Maybe<NR::Rect> const bbox(selection->bounds());
+ boost::optional<NR::Rect> const bbox(selection->bounds());
if ( !bbox || bbox->isEmpty() ) {
return;
@@ -1379,7 +1379,7 @@ sp_selection_rotate(Inkscape::Selection *selection, gdouble const angle_degrees)
if (selection->isEmpty())
return;
- NR::Maybe<NR::Point> center = selection->center();
+ boost::optional<NR::Point> center = selection->center();
if (!center) {
return;
}
if (selection->isEmpty())
return;
- NR::Maybe<NR::Rect> const bbox(selection->bounds());
- NR::Maybe<NR::Point> center = selection->center();
+ boost::optional<NR::Rect> const bbox(selection->bounds());
+ boost::optional<NR::Point> center = selection->center();
if ( !bbox || !center ) {
return;
if (selection->isEmpty())
return;
- NR::Maybe<NR::Rect> const bbox(selection->bounds());
+ boost::optional<NR::Rect> const bbox(selection->bounds());
if (!bbox) {
return;
}
if (selection->isEmpty())
return;
- NR::Maybe<NR::Rect> sel_bbox = selection->bounds();
+ boost::optional<NR::Rect> sel_bbox = selection->bounds();
if (!sel_bbox) {
return;
void scroll_to_show_item(SPDesktop *desktop, SPItem *item)
{
NR::Rect dbox = desktop->get_display_area();
- NR::Maybe<NR::Rect> sbox = sp_item_bbox_desktop(item);
+ boost::optional<NR::Rect> sbox = sp_item_bbox_desktop(item);
if ( sbox && dbox.contains(*sbox) == false ) {
NR::Point const s_dt = sbox->midpoint();
}
sp_document_ensure_up_to_date(doc);
- NR::Maybe<NR::Rect> r = selection->bounds();
- NR::Maybe<NR::Point> c = selection->center();
+ boost::optional<NR::Rect> r = selection->bounds();
+ boost::optional<NR::Point> c = selection->center();
if ( !r || !c || r->isEmpty() ) {
return;
}
}
sp_document_ensure_up_to_date(doc);
- NR::Maybe<NR::Rect> r = selection->bounds();
+ boost::optional<NR::Rect> r = selection->bounds();
if ( !r || r->isEmpty() ) {
return;
}
desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>object(s)</b> to fit canvas to."));
return false;
}
- NR::Maybe<NR::Rect> const bbox(desktop->selection->bounds());
+ boost::optional<NR::Rect> const bbox(desktop->selection->bounds());
if (bbox && !bbox->isEmpty()) {
doc->fitToRect(*bbox);
return true;
sp_document_ensure_up_to_date(doc);
SPItem const *const root = SP_ITEM(doc->root);
- NR::Maybe<NR::Rect> const bbox(root->getBounds(from_2geom(sp_item_i2r_affine(root))));
+ boost::optional<NR::Rect> const bbox(root->getBounds(from_2geom(sp_item_i2r_affine(root))));
if (bbox && !bbox->isEmpty()) {
doc->fitToRect(*bbox);
return true;
diff --git a/src/selection.cpp b/src/selection.cpp
index acab9396c86bb29b758a951e8b06d9dfb888373f..b71f27815214e527d8059792c352bdf5d21b5e4c 100644 (file)
--- a/src/selection.cpp
+++ b/src/selection.cpp
return bbox;
}
-NR::Maybe<NR::Rect> Selection::bounds(SPItem::BBoxType type) const
+boost::optional<NR::Rect> Selection::bounds(SPItem::BBoxType type) const
{
GSList const *items = const_cast<Selection *>(this)->itemList();
- NR::Maybe<NR::Rect> bbox = NR::Nothing();
+ boost::optional<NR::Rect> bbox;
for ( GSList const *i = items ; i != NULL ; i = i->next ) {
bbox = NR::union_bounds(bbox, sp_item_bbox_desktop(SP_ITEM(i->data), type));
}
@@ -414,13 +414,13 @@ NRRect *Selection::boundsInDocument(NRRect *bbox, SPItem::BBoxType type) const {
return bbox;
}
-NR::Maybe<NR::Rect> Selection::boundsInDocument(SPItem::BBoxType type) const {
+boost::optional<NR::Rect> Selection::boundsInDocument(SPItem::BBoxType type) const {
NRRect r;
return boundsInDocument(&r, type)->upgrade();
}
/** Extract the position of the center from the first selected object */
-NR::Maybe<NR::Point> Selection::center() const {
+boost::optional<NR::Point> Selection::center() const {
GSList *items = (GSList *) const_cast<Selection *>(this)->itemList();
NR::Point center;
if (items) {
return first->getCenter();
}
}
- NR::Maybe<NR::Rect> bbox = bounds();
+ boost::optional<NR::Rect> bbox = bounds();
if (bbox) {
return bounds()->midpoint();
} else {
- return NR::Nothing();
+ return boost::optional<NR::Point>();
}
}
cvh.add(*i);
}
- NR::Maybe<NR::Rect> rHull = cvh.bounds();
+ boost::optional<NR::Rect> rHull = cvh.bounds();
if (rHull) {
for ( unsigned i = 0 ; i < 4 ; ++i ) {
pHull.push_back(rHull->corner(i));
diff --git a/src/selection.h b/src/selection.h
index 3d45c171d95021093c98eba4aef4c098a1f61777..f02aeb456725e951382625b077d9e6d8b14b8f42 100644 (file)
--- a/src/selection.h
+++ b/src/selection.h
/** @brief Returns the bounding rectangle of the selection */
NRRect *bounds(NRRect *dest, SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX) const;
/** @brief Returns the bounding rectangle of the selection */
- NR::Maybe<NR::Rect> bounds(SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX) const;
+ boost::optional<NR::Rect> bounds(SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX) const;
/**
* @brief Returns the bounding rectangle of the selection
*
* \todo how is this different from bounds()?
*/
- NR::Maybe<NR::Rect> boundsInDocument(SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX) const;
+ boost::optional<NR::Rect> boundsInDocument(SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX) const;
/**
* @brief Returns the rotation/skew center of the selection
*/
- NR::Maybe<NR::Point> center() const;
+ boost::optional<NR::Point> center() const;
/**
* @brief Gets the selection's snap points.
diff --git a/src/seltrans.cpp b/src/seltrans.cpp
index c478036c7eccbdbb1097a7b7b58077fa6d9c4ae4..0b297318d613d3805cfd5382be5cd787bc5f3505 100644 (file)
--- a/src/seltrans.cpp
+++ b/src/seltrans.cpp
_show(SHOW_CONTENT),
_grabbed(false),
_show_handles(true),
- _bbox(NR::Nothing()),
- _approximate_bbox(NR::Nothing()),
+ _bbox(),
+ _approximate_bbox(),
_absolute_affine(NR::scale(1,1)),
_opposite(NR::Point(0,0)),
_opposite_for_specpoints(NR::Point(0,0)),
diff --git a/src/seltrans.h b/src/seltrans.h
index d06e0527626c7629ae65dc227ead958ffead6c73..3a7f6f4b2e60d35f9ccb58d04158a3908e1703ba 100644 (file)
--- a/src/seltrans.h
+++ b/src/seltrans.h
SPItem::BBoxType _snap_bbox_type;
- NR::Maybe<NR::Rect> _bbox;
- NR::Maybe<NR::Rect> _approximate_bbox;
- NR::Maybe<NR::Rect> _geometric_bbox;
+ boost::optional<NR::Rect> _bbox;
+ boost::optional<NR::Rect> _approximate_bbox;
+ boost::optional<NR::Rect> _geometric_bbox;
gdouble _strokewidth;
NR::Matrix _current_relative_affine;
gdouble _handle_x;
gdouble _handle_y;
- NR::Maybe<NR::Point> _center;
+ boost::optional<NR::Point> _center;
bool _center_is_set; ///< we've already set _center, no need to reread it from items
SPKnot *_shandle[8];
diff --git a/src/shape-editor.cpp b/src/shape-editor.cpp
index c88b5eb3f453baa938ecc8ed6ea595fdfa8c9102..2b7ec4c3d64e1a24e57df6801643533092e7bdfd 100644 (file)
--- a/src/shape-editor.cpp
+++ b/src/shape-editor.cpp
sp_nodepath_show_helperpath (this->nodepath, show);
}
-void ShapeEditor::flip (NR::Dim2 axis, NR::Maybe<NR::Point> center) {
+void ShapeEditor::flip (NR::Dim2 axis, boost::optional<NR::Point> center) {
if (this->nodepath)
sp_nodepath_flip (this->nodepath, axis, center);
}
diff --git a/src/shape-editor.h b/src/shape-editor.h
index 2a6da68c3b6f9f72622a6c6649fd9e4e1db54f51..fe95aca8fd85ad7686c4ba9c6cf807429780205b 100644 (file)
--- a/src/shape-editor.h
+++ b/src/shape-editor.h
#include "libnr/nr-path-code.h"
#include "libnr/nr-point.h"
-#include "libnr/nr-maybe.h"
+#include <boost/optional.hpp>
#include <vector>
class KnotHolder;
void show_handles (bool show);
void show_helperpath (bool show);
- void flip (NR::Dim2 axis, NR::Maybe<NR::Point> center = NR::Nothing());
+ void flip (NR::Dim2 axis, boost::optional<NR::Point> center = boost::optional<NR::Point>());
void distribute (NR::Dim2 axis);
void align (NR::Dim2 axis);
diff --git a/src/snap.cpp b/src/snap.cpp
index 09cdbbaba9571933b5af33eea4d3a352e8bd64f0..68f4c8465acb1c6592909a9e707d9c19c67734cf 100644 (file)
--- a/src/snap.cpp
+++ b/src/snap.cpp
void SnapManager::freeSnapReturnByRef(Inkscape::Snapper::PointType point_type,
NR::Point &p,
bool first_point,
- NR::Maybe<NR::Rect> const &bbox_to_snap) const
+ boost::optional<NR::Rect> const &bbox_to_snap) const
{
Inkscape::SnappedPoint const s = freeSnap(point_type, p, first_point, bbox_to_snap);
s.getPoint(p);
Inkscape::SnappedPoint SnapManager::freeSnap(Inkscape::Snapper::PointType point_type,
NR::Point const &p,
bool first_point,
- NR::Maybe<NR::Rect> const &bbox_to_snap) const
+ boost::optional<NR::Rect> const &bbox_to_snap) const
{
if (!SomeSnapperMightSnap()) {
return Inkscape::SnappedPoint(p, Inkscape::SNAPTARGET_UNDEFINED, NR_HUGE, 0, false);
@@ -248,7 +248,7 @@ void SnapManager::constrainedSnapReturnByRef(Inkscape::Snapper::PointType point_
NR::Point &p,
Inkscape::Snapper::ConstraintLine const &constraint,
bool first_point,
- NR::Maybe<NR::Rect> const &bbox_to_snap) const
+ boost::optional<NR::Rect> const &bbox_to_snap) const
{
Inkscape::SnappedPoint const s = constrainedSnap(point_type, p, constraint, first_point, bbox_to_snap);
s.getPoint(p);
@@ -270,7 +270,7 @@ Inkscape::SnappedPoint SnapManager::constrainedSnap(Inkscape::Snapper::PointType
NR::Point const &p,
Inkscape::Snapper::ConstraintLine const &constraint,
bool first_point,
- NR::Maybe<NR::Rect> const &bbox_to_snap) const
+ boost::optional<NR::Rect> const &bbox_to_snap) const
{
if (!SomeSnapperMightSnap()) {
return Inkscape::SnappedPoint(p, Inkscape::SNAPTARGET_UNDEFINED, NR_HUGE, 0, false);
diff --git a/src/snap.h b/src/snap.h
index 4c5e57b73c2987a6372d38ebf3e90c93cb6924e9..966d2a5431127968a7de6089d16ed1d3bdf79024 100644 (file)
--- a/src/snap.h
+++ b/src/snap.h
void freeSnapReturnByRef(Inkscape::Snapper::PointType point_type,
NR::Point &p,
bool first_point = true,
- NR::Maybe<NR::Rect> const &bbox_to_snap = NR::Nothing()) const;
+ boost::optional<NR::Rect> const &bbox_to_snap = boost::optional<NR::Rect>()) const;
Inkscape::SnappedPoint freeSnap(Inkscape::Snapper::PointType point_type,
NR::Point const &p,
bool first_point = true,
- NR::Maybe<NR::Rect> const &bbox_to_snap = NR::Nothing()) const;
+ boost::optional<NR::Rect> const &bbox_to_snap = boost::optional<NR::Rect>() ) const;
// constrainedSnapReturnByRef() is preferred over constrainedSnap(), because it only returns a
// point, by overwriting p, if snapping has occured; otherwise p is untouched
NR::Point &p,
Inkscape::Snapper::ConstraintLine const &constraint,
bool first_point = true,
- NR::Maybe<NR::Rect> const &bbox_to_snap = NR::Nothing()) const;
+ boost::optional<NR::Rect> const &bbox_to_snap = boost::optional<NR::Rect>()) const;
Inkscape::SnappedPoint constrainedSnap(Inkscape::Snapper::PointType point_type,
NR::Point const &p,
Inkscape::Snapper::ConstraintLine const &constraint,
bool first_point = true,
- NR::Maybe<NR::Rect> const &bbox_to_snap = NR::Nothing()) const;
+ boost::optional<NR::Rect> const &bbox_to_snap = boost::optional<NR::Rect>()) const;
void guideSnap(NR::Point &p, NR::Point const &guide_normal) const;
diff --git a/src/snapper.h b/src/snapper.h
index f79573990c285381b2593d84eee445099541ef68..cf2732b2426c2f58c8246c35c58e5b4f61f937d7 100644 (file)
--- a/src/snapper.h
+++ b/src/snapper.h
#include <list>
#include "libnr/nr-coord.h"
#include "libnr/nr-point.h"
-#include "libnr/nr-maybe.h"
+#include <boost/optional.hpp>
#include "snapped-point.h"
#include "snapped-line.h"
PointType const &/*t*/,
NR::Point const &/*p*/,
bool const &/*first_point*/,
- NR::Maybe<NR::Rect> const &/*bbox_to_snap*/,
+ boost::optional<NR::Rect> const &/*bbox_to_snap*/,
std::vector<SPItem const *> const */*it*/,
std::vector<NR::Point> */*unselected_nodes*/) const {};
PointType const &/*t*/,
NR::Point const &/*p*/,
bool const &/*first_point*/,
- NR::Maybe<NR::Rect> const &/*bbox_to_snap*/,
+ boost::optional<NR::Rect> const &/*bbox_to_snap*/,
ConstraintLine const &/*c*/,
std::vector<SPItem const *> const */*it*/) const {};
index 786209fdae0a4a859286a85aed84c59f45e55529..6ef3746845d650d96ee1a9da9103f6e4a06a1c6b 100644 (file)
--- a/src/sp-conn-end-pair.cpp
+++ b/src/sp-conn-end-pair.cpp
for (unsigned h = 0; h < 2; ++h) {
if ( h2attItem[h] ) {
- NR::Maybe<NR::Rect> bbox = h2attItem[h]->getBounds(from_2geom(sp_item_i2doc_affine(h2attItem[h])));
+ boost::optional<NR::Rect> bbox = h2attItem[h]->getBounds(from_2geom(sp_item_i2doc_affine(h2attItem[h])));
if (bbox) {
endPts[h] = bbox->midpoint();
} else {
diff --git a/src/sp-conn-end.cpp b/src/sp-conn-end.cpp
index a4ecf1f65917fd34560998908f5b91ad06954c8d..127262540185d6abb8b2110234a333d3992cca76 100644 (file)
--- a/src/sp-conn-end.cpp
+++ b/src/sp-conn-end.cpp
path->curve->penultimate_point()
};
for (unsigned h = 0; h < 2; ++h) {
- NR::Maybe<NR::Rect> bbox = h2attItem[h]->getBounds(NR::identity());
+ boost::optional<NR::Rect> bbox = h2attItem[h]->getBounds(NR::identity());
if (!bbox) {
if (updatePathRepr) {
path->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
NR::Rect otherpt_rect = NR::Rect(other_endpt, other_endpt);
NR::Rect h2bbox_icoordsys[2] = { otherpt_rect, otherpt_rect };
- NR::Maybe<NR::Rect> bbox = h2attItem[ind]->getBounds(NR::identity());
+ boost::optional<NR::Rect> bbox = h2attItem[ind]->getBounds(NR::identity());
if (!bbox) {
if (updatePathRepr) {
path->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
diff --git a/src/sp-flowtext.cpp b/src/sp-flowtext.cpp
index 8621a27b576005338c343d468184c13c52213426..f6ba68911c636ee27e5dc96905dd3e1d8a2a6877 100644 (file)
--- a/src/sp-flowtext.cpp
+++ b/src/sp-flowtext.cpp
NRRect pbox;
sp_item_invoke_bbox(item, &pbox, NR::identity(), TRUE);
NRRect bbox;
- NR::Maybe<NR::Rect> bbox_maybe = sp_item_bbox_desktop(item);
+ boost::optional<NR::Rect> bbox_maybe = sp_item_bbox_desktop(item);
if (!bbox_maybe) {
return;
}
diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp
index 80089df35d3be643fdb5b8b4d80df64c9546ab36..186b766635f1115ee63e0817401f4fd83af249c5 100644 (file)
--- a/src/sp-item-group.cpp
+++ b/src/sp-item-group.cpp
void CGroup::calculateBBox(NRRect *bbox, NR::Matrix const &transform, unsigned const flags) {
- NR::Maybe<NR::Rect> dummy_bbox = NR::Nothing();
+ boost::optional<NR::Rect> dummy_bbox;
GSList *l = _group->childList(false, SPObject::ActionBBox);
while (l) {
index 4caf155bfdad7ec4cb771e4e418dfbfb39264306..6a6ab4fc40a77034b1d674e7232c5b56d3684e8d 100644 (file)
void
sp_item_scale_rel (SPItem *item, NR::scale const &scale)
{
- NR::Maybe<NR::Rect> bbox = sp_item_bbox_desktop(item);
+ boost::optional<NR::Rect> bbox = sp_item_bbox_desktop(item);
if (bbox) {
NR::translate const s(bbox->midpoint()); // use getCenter?
sp_item_set_i2d_affine(item, sp_item_i2d_affine(item) * to_2geom(NR::Matrix(inverse(s)) * scale * s));
@@ -166,7 +166,7 @@ get_scale_transform_with_stroke (NR::Rect &bbox_param, gdouble strokewidth, bool
}
NR::Rect
-get_visual_bbox (NR::Maybe<NR::Rect> const &initial_geom_bbox, NR::Matrix const &abs_affine, gdouble const initial_strokewidth, bool const transform_stroke)
+get_visual_bbox (boost::optional<NR::Rect> const &initial_geom_bbox, NR::Matrix const &abs_affine, gdouble const initial_strokewidth, bool const transform_stroke)
{
g_assert(initial_geom_bbox);
index 8f6cdc24d930c694f88acb593db742f2cac1f9ff..26258a1fe7567bd55f88c6984633b15ceede71b6 100644 (file)
--- a/src/sp-item-transform.h
+++ b/src/sp-item-transform.h
void sp_item_move_rel(SPItem *item, NR::translate const &tr);
NR::Matrix get_scale_transform_with_stroke (NR::Rect &bbox, gdouble strokewidth, bool transform_stroke, gdouble x0, gdouble y0, gdouble x1, gdouble y1);
-NR::Rect get_visual_bbox (NR::Maybe<NR::Rect> const &initial_geom_bbox, NR::Matrix const &abs_affine, gdouble const initial_strokewidth, bool const transform_stroke);
+NR::Rect get_visual_bbox (boost::optional<NR::Rect> const &initial_geom_bbox, NR::Matrix const &abs_affine, gdouble const initial_strokewidth, bool const transform_stroke);
#endif /* !SP_ITEM_TRANSFORM_H */
diff --git a/src/sp-item.cpp b/src/sp-item.cpp
index 5d717725310bd16c97408d013e58b1e500901500..b0b6d8137f4cb9ba9109b7168886c6c09bc7f4ad 100644 (file)
--- a/src/sp-item.cpp
+++ b/src/sp-item.cpp
*/
void
SPItem::setCenter(NR::Point object_centre) {
- NR::Maybe<NR::Rect> bbox = getBounds(from_2geom(sp_item_i2d_affine(this)));
+ boost::optional<NR::Rect> bbox = getBounds(from_2geom(sp_item_i2d_affine(this)));
if (bbox) {
transform_center_x = object_centre[NR::X] - bbox->midpoint()[NR::X];
if (fabs(transform_center_x) < 1e-5) // rounding error
}
NR::Point SPItem::getCenter() const {
- NR::Maybe<NR::Rect> bbox = getBounds(from_2geom(sp_item_i2d_affine(this)));
+ boost::optional<NR::Rect> bbox = getBounds(from_2geom(sp_item_i2d_affine(this)));
if (bbox) {
return bbox->midpoint() + NR::Point (this->transform_center_x, this->transform_center_y);
} else {
if (item->style->filter.set && item->display) {
NRRect item_bbox;
sp_item_invoke_bbox(item, &item_bbox, NR::identity(), TRUE, SPItem::GEOMETRIC_BBOX);
- NR::Maybe<NR::Rect> i_bbox = item_bbox;
+ boost::optional<NR::Rect> i_bbox = item_bbox;
SPItemView *itemview = item->display;
do {
@@ -693,11 +693,11 @@ sp_item_write(SPObject *const object, Inkscape::XML::Document *xml_doc, Inkscape
return repr;
}
-NR::Maybe<NR::Rect> SPItem::getBounds(NR::Matrix const &transform,
+boost::optional<NR::Rect> SPItem::getBounds(NR::Matrix const &transform,
SPItem::BBoxType type,
unsigned int /*dkey*/) const
{
- NR::Maybe<NR::Rect> r = NR::Nothing();
+ boost::optional<NR::Rect> r;
sp_item_invoke_bbox_full(this, &r, transform, type, TRUE);
return r;
}
SPItem::getBounds(Geom::Matrix const &transform, SPItem::BBoxType type, unsigned int /*dkey*/)
const
{
- NR::Maybe<NR::Rect> r = NR::Nothing();
+ boost::optional<NR::Rect> r;
sp_item_invoke_bbox_full(this, &r, from_2geom(transform), type, TRUE);
if (r)
return to_2geom(*r);
}
void
-sp_item_invoke_bbox(SPItem const *item, NR::Maybe<NR::Rect> *bbox, NR::Matrix const &transform, unsigned const clear, SPItem::BBoxType type)
+sp_item_invoke_bbox(SPItem const *item, boost::optional<NR::Rect> *bbox, NR::Matrix const &transform, unsigned const clear, SPItem::BBoxType type)
{
sp_item_invoke_bbox_full(item, bbox, transform, type, clear);
}
-// DEPRECATED to phase out the use of NRRect in favor of NR::Maybe<NR::Rect>
+// DEPRECATED to phase out the use of NRRect in favor of boost::optional<NR::Rect>
void
sp_item_invoke_bbox(SPItem const *item, NRRect *bbox, NR::Matrix const &transform, unsigned const clear, SPItem::BBoxType type)
{
@@ -736,14 +736,14 @@ sp_item_invoke_bbox(SPItem const *item, NRRect *bbox, NR::Matrix const &transfor
* transform and the flags to the actual bbox methods. Note that many of subclasses (e.g. groups,
* clones), in turn, call this function in their bbox methods. */
void
-sp_item_invoke_bbox_full(SPItem const *item, NR::Maybe<NR::Rect> *bbox, NR::Matrix const &transform, unsigned const flags, unsigned const clear)
+sp_item_invoke_bbox_full(SPItem const *item, boost::optional<NR::Rect> *bbox, NR::Matrix const &transform, unsigned const flags, unsigned const clear)
{
g_assert(item != NULL);
g_assert(SP_IS_ITEM(item));
g_assert(bbox != NULL);
if (clear) {
- *bbox = NR::Nothing();
+ *bbox = boost::optional<NR::Rect>();
}
// TODO: replace NRRect by NR::Rect, for all SPItemClasses, and for SP_CLIPPATH
@@ -826,20 +826,20 @@ sp_item_invoke_bbox_full(SPItem const *item, NR::Maybe<NR::Rect> *bbox, NR::Matr
// or it has explicitely been set to be like this (e.g. in sp_shape_bbox)
// When x0 > x1 or y0 > y1, the bbox is considered to be "nothing", although it has not been
- // explicitely defined this way for NRRects (as opposed to NR::Maybe<NR::Rect>)
+ // explicitely defined this way for NRRects (as opposed to boost::optional<NR::Rect>)
// So union bbox with nothing = do nothing, just return
return;
}
- // Do not use temp_bbox.upgrade() here, because it uses a test that returns NR::Nothing
+ // Do not use temp_bbox.upgrade() here, because it uses a test that returns an empty boost::optional<NR::Rect>()
// for any rectangle with zero area. The geometrical bbox of for example a vertical line
- // would therefore be translated into NR::Nothing (see bug https://bugs.launchpad.net/inkscape/+bug/168684)
- NR::Maybe<NR::Rect> temp_bbox_new = NR::Rect(NR::Point(temp_bbox.x0, temp_bbox.y0), NR::Point(temp_bbox.x1, temp_bbox.y1));
+ // would therefore be translated into empty boost::optional<NR::Rect>() (see bug https://bugs.launchpad.net/inkscape/+bug/168684)
+ boost::optional<NR::Rect> temp_bbox_new = NR::Rect(NR::Point(temp_bbox.x0, temp_bbox.y0), NR::Point(temp_bbox.x1, temp_bbox.y1));
*bbox = NR::union_bounds(*bbox, temp_bbox_new);
}
-// DEPRECATED to phase out the use of NRRect in favor of NR::Maybe<NR::Rect>
+// DEPRECATED to phase out the use of NRRect in favor of boost::optional<NR::Rect>
/** Calls \a item's subclass' bounding box method; clips it by the bbox of clippath, if any; and
* unions the resulting bbox with \a bbox. If \a clear is true, empties \a bbox first. Passes the
* transform and the flags to the actual bbox methods. Note that many of subclasses (e.g. groups,
sp_item_invoke_bbox(item, bbox, from_2geom(sp_item_i2d_affine(item)), TRUE, type);
}
-NR::Maybe<NR::Rect> sp_item_bbox_desktop(SPItem *item, SPItem::BBoxType type)
+boost::optional<NR::Rect> sp_item_bbox_desktop(SPItem *item, SPItem::BBoxType type)
{
- NR::Maybe<NR::Rect> rect = NR::Nothing();
+ boost::optional<NR::Rect> rect = boost::optional<NR::Rect>();
sp_item_invoke_bbox(item, &rect, from_2geom(sp_item_i2d_affine(item)), TRUE, type);
return rect;
}
static void sp_item_private_snappoints(SPItem const *item, SnapPointsIter p)
{
- NR::Maybe<NR::Rect> bbox = item->getBounds(from_2geom(sp_item_i2d_affine(item)));
+ boost::optional<NR::Rect> bbox = item->getBounds(from_2geom(sp_item_i2d_affine(item)));
/* Just the corners of the bounding box suffices given that we don't yet
support angled guide lines. */
@@ -1114,7 +1114,7 @@ sp_item_invoke_show(SPItem *item, NRArena *arena, unsigned key, unsigned flags)
NR_ARENA_ITEM_SET_DATA(ai, item);
NRRect item_bbox;
sp_item_invoke_bbox(item, &item_bbox, NR::identity(), TRUE, SPItem::GEOMETRIC_BBOX);
- NR::Maybe<NR::Rect> i_bbox = item_bbox;
+ boost::optional<NR::Rect> i_bbox = item_bbox;
nr_arena_item_set_item_bbox(ai, i_bbox);
}
SPItem::BBoxType bbox_type = (prefs_bbox ==0)?
SPItem::APPROXIMATE_BBOX : SPItem::GEOMETRIC_BBOX;
- NR::Maybe<NR::Rect> bbox = sp_item_bbox_desktop(item, bbox_type);
+ boost::optional<NR::Rect> bbox = sp_item_bbox_desktop(item, bbox_type);
if (!bbox) {
g_warning ("Cannot determine item's bounding box during conversion to guides.\n");
return;
diff --git a/src/sp-item.h b/src/sp-item.h
index 39907999fd5a56392df298e7f5694b53ca5a1978..581b6acdd255ac04684488e79961bdfccbd508b3 100644 (file)
--- a/src/sp-item.h
+++ b/src/sp-item.h
void raiseToTop();
void lowerToBottom();
- NR::Maybe<NR::Rect> getBounds(NR::Matrix const &transform, BBoxType type=APPROXIMATE_BBOX, unsigned int dkey=0) const;
+ boost::optional<NR::Rect> getBounds(NR::Matrix const &transform, BBoxType type=APPROXIMATE_BBOX, unsigned int dkey=0) const;
Geom::Rect getBounds(Geom::Matrix const &transform, BBoxType type=APPROXIMATE_BBOX, unsigned int dkey=0) const;
sigc::connection _clip_ref_connection;
/* Methods */
-void sp_item_invoke_bbox(SPItem const *item, NR::Maybe<NR::Rect> *bbox, NR::Matrix const &transform, unsigned const clear, SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX);
+void sp_item_invoke_bbox(SPItem const *item, boost::optional<NR::Rect> *bbox, NR::Matrix const &transform, unsigned const clear, SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX);
void sp_item_invoke_bbox(SPItem const *item, NRRect *bbox, NR::Matrix const &transform, unsigned const clear, SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX) __attribute__ ((deprecated));
-void sp_item_invoke_bbox_full(SPItem const *item, NR::Maybe<NR::Rect> *bbox, NR::Matrix const &transform, unsigned const flags, unsigned const clear);
+void sp_item_invoke_bbox_full(SPItem const *item, boost::optional<NR::Rect> *bbox, NR::Matrix const &transform, unsigned const flags, unsigned const clear);
void sp_item_invoke_bbox_full(SPItem const *item, NRRect *bbox, NR::Matrix const &transform, unsigned const flags, unsigned const clear) __attribute__ ((deprecated));
unsigned sp_item_pos_in_parent(SPItem *item);
NRArenaItem *sp_item_get_arenaitem(SPItem *item, unsigned int key);
void sp_item_bbox_desktop(SPItem *item, NRRect *bbox, SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX) __attribute__ ((deprecated));
-NR::Maybe<NR::Rect> sp_item_bbox_desktop(SPItem *item, SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX);
+boost::optional<NR::Rect> sp_item_bbox_desktop(SPItem *item, SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX);
Geom::Matrix i2anc_affine(SPObject const *item, SPObject const *ancestor);
Geom::Matrix i2i_affine(SPObject const *src, SPObject const *dest);
diff --git a/src/sp-offset.cpp b/src/sp-offset.cpp
index 2f8dc7c50413af972a2e6de3d6538273d34950b1..37ea2e5f5fa04dbea6534e05cb866993295b6a77 100644 (file)
--- a/src/sp-offset.cpp
+++ b/src/sp-offset.cpp
theRes->ConvertToForme (orig, 1, originaux);
SPItem *item = shape;
- NR::Maybe<NR::Rect> bbox = sp_item_bbox_desktop (item);
+ boost::optional<NR::Rect> bbox = sp_item_bbox_desktop (item);
if ( bbox && !bbox->isEmpty() ) {
gdouble size = L2(bbox->dimensions());
gdouble const exp = NR::expansion(item->transform);
diff --git a/src/sp-shape.cpp b/src/sp-shape.cpp
index 5509b7c77ed33d9a72ec9057aaf13bc3c0a14a07..054310472e5820ae5393ea40006aeadafa54eed1 100644 (file)
--- a/src/sp-shape.cpp
+++ b/src/sp-shape.cpp
if (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_PARENT_MODIFIED_FLAG)) {
/* This is suboptimal, because changing parent style schedules recalculation */
/* But on the other hand - how can we know that parent does not tie style and transform */
- NR::Maybe<NR::Rect> paintbox = SP_ITEM(object)->getBounds(NR::identity());
+ boost::optional<NR::Rect> paintbox = SP_ITEM(object)->getBounds(NR::identity());
for (SPItemView *v = SP_ITEM (shape)->display; v != NULL; v = v->next) {
NRArenaShape * const s = NR_ARENA_SHAPE(v->arenaitem);
if (flags & SP_OBJECT_MODIFIED_FLAG) {
NRArenaShape * const s = NR_ARENA_SHAPE(arenaitem);
nr_arena_shape_set_style(s, object->style);
nr_arena_shape_set_path(s, shape->curve, false);
- NR::Maybe<NR::Rect> paintbox = item->getBounds(NR::identity());
+ boost::optional<NR::Rect> paintbox = item->getBounds(NR::identity());
if (paintbox) {
s->setPaintBox(*paintbox);
}
diff --git a/src/splivarot.cpp b/src/splivarot.cpp
index 11044ec1aa506567606a4564e5bdfbac7294c86c..06ae89ba035ef7cee7bfe182e0d101033f90b16b 100644 (file)
--- a/src/splivarot.cpp
+++ b/src/splivarot.cpp
bool didSomething = false;
- NR::Maybe<NR::Rect> selectionBbox = selection->bounds();
+ boost::optional<NR::Rect> selectionBbox = selection->bounds();
if (!selectionBbox) {
return false;
}
continue;
if (simplifyIndividualPaths) {
- NR::Maybe<NR::Rect> itemBbox = item->getBounds(from_2geom(sp_item_i2d_affine(item)));
+ boost::optional<NR::Rect> itemBbox = item->getBounds(from_2geom(sp_item_i2d_affine(item)));
if (itemBbox) {
simplifySize = L2(itemBbox->dimensions());
} else {
return dest;
}
-NR::Maybe<Path::cut_position> get_nearest_position_on_Path(Path *path, NR::Point p, unsigned seg)
+boost::optional<Path::cut_position> get_nearest_position_on_Path(Path *path, NR::Point p, unsigned seg)
{
//get nearest position on path
Path::cut_position pos = path->PointToCurvilignPosition(p, seg);
diff --git a/src/splivarot.h b/src/splivarot.h
index 69e985ffae1a0545645365c73cffc19c5a3f9e19..ad4d9c6e0907372891547d803082333fad4fb5fe 100644 (file)
--- a/src/splivarot.h
+++ b/src/splivarot.h
Path *Path_for_item(SPItem *item, bool doTransformation, bool transformFull = true);
Geom::PathVector* pathvector_for_curve(SPItem *item, SPCurve *curve, bool doTransformation, bool transformFull, Geom::Matrix extraPreAffine, Geom::Matrix extraPostAffine);
SPCurve *curve_for_item(SPItem *item);
-NR::Maybe<Path::cut_position> get_nearest_position_on_Path(Path *path, NR::Point p, unsigned seg = 0);
+boost::optional<Path::cut_position> get_nearest_position_on_Path(Path *path, NR::Point p, unsigned seg = 0);
NR::Point get_point_on_Path(Path *path, int piece, double t);
Path *bpath_to_Path(NArtBpath const *bpath);
diff --git a/src/text-context.cpp b/src/text-context.cpp
index da69277f8e7f7c0b94d15abc0721aa0d749ae70c..0865e06cb628fe630412aa7c2c5332550ec706ad 100644 (file)
--- a/src/text-context.cpp
+++ b/src/text-context.cpp
@@ -437,7 +437,7 @@ sp_text_context_item_handler(SPEventContext *event_context, SPItem *item, GdkEve
item_ungrouped = desktop->item_at_point(NR::Point(event->button.x, event->button.y), TRUE);
if (SP_IS_TEXT(item_ungrouped) || SP_IS_FLOWTEXT(item_ungrouped)) {
sp_canvas_item_show(tc->indicator);
- NR::Maybe<NR::Rect> ibbox = sp_item_bbox_desktop(item_ungrouped);
+ boost::optional<NR::Rect> ibbox = sp_item_bbox_desktop(item_ungrouped);
if (ibbox) {
SP_CTRLRECT(tc->indicator)->setRectangle(*ibbox);
}
SPItem *frame = SP_FLOWTEXT(tc->text)->get_frame (NULL); // first frame only
if (frame) {
sp_canvas_item_show(tc->frame);
- NR::Maybe<NR::Rect> frame_bbox = sp_item_bbox_desktop(frame);
+ boost::optional<NR::Rect> frame_bbox = sp_item_bbox_desktop(frame);
if (frame_bbox) {
SP_CTRLRECT(tc->frame)->setRectangle(*frame_bbox);
}
diff --git a/src/tweak-context.cpp b/src/tweak-context.cpp
index 70cd49c81e1ebf6f96e2da8c19ce598f7518c6b8..e670a2db4fe3d62a47331a7dd3bf68f6ec5fc35d 100644 (file)
--- a/src/tweak-context.cpp
+++ b/src/tweak-context.cpp
#include "pixmaps/cursor-push.xpm"
#include "pixmaps/cursor-roughen.xpm"
#include "pixmaps/cursor-color.xpm"
-#include "libnr/nr-maybe.h"
+#include <boost/optional.hpp>
#include "libnr/nr-matrix-ops.h"
#include "libnr/nr-scale-translate-ops.h"
#include "xml/repr.h"
@@ -366,7 +366,7 @@ sp_tweak_dilate_recursive (Inkscape::Selection *selection, SPItem *item, NR::Poi
// skip those paths whose bboxes are entirely out of reach with our radius
- NR::Maybe<NR::Rect> bbox = item->getBounds(from_2geom(sp_item_i2doc_affine(item)));
+ boost::optional<NR::Rect> bbox = item->getBounds(from_2geom(sp_item_i2doc_affine(item)));
if (bbox) {
bbox->growBy(radius);
if (!bbox->contains(p)) {
if (!style) {
return false;
}
- NR::Maybe<NR::Rect> bbox = item->getBounds(from_2geom(sp_item_i2doc_affine(item)),
+ boost::optional<NR::Rect> bbox = item->getBounds(from_2geom(sp_item_i2doc_affine(item)),
SPItem::GEOMETRIC_BBOX);
if (!bbox) {
return false;
diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp
index 537277afc774b4a1a64bd1eb31b6193d6dd170d6..0138823277bafebc4540c00b34d6d079cf9c3aaf 100644 (file)
--- a/src/ui/clipboard.cpp
+++ b/src/ui/clipboard.cpp
@@ -405,14 +405,14 @@ 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);
- NR::Maybe<NR::Rect> obj_size = sp_item_bbox_desktop(item);
+ boost::optional<NR::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));
}
}
// resize the selection as a whole
else {
- NR::Maybe<NR::Rect> sel_size = selection->bounds();
+ boost::optional<NR::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));
}
}
- NR::Maybe<NR::Rect> size = selection->bounds();
+ boost::optional<NR::Rect> size = selection->bounds();
if (size) {
sp_repr_set_point(_clipnode, "min", size->min());
sp_repr_set_point(_clipnode, "max", size->max());
// copied from former sp_selection_paste in selection-chemistry.cpp
else {
sp_document_ensure_up_to_date(target_document);
- NR::Maybe<NR::Rect> sel_size = selection->bounds();
+ boost::optional<NR::Rect> sel_size = selection->bounds();
Geom::Point m( desktop->point() );
if (sel_size) {
index 7d4820663b319e47bc1631218a1f1d5631601e75..e83907f492cb5b2e8ccb91ab132ba2382cb7b380 100644 (file)
SPItem * thing = *master;
selected.erase(master);
//Compute the anchor point
- NR::Maybe<NR::Rect> b = sp_item_bbox_desktop (thing);
+ boost::optional<NR::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]);
case AlignAndDistribute::DRAWING:
{
- NR::Maybe<NR::Rect> b = sp_item_bbox_desktop
+ boost::optional<NR::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],
case AlignAndDistribute::SELECTION:
{
- NR::Maybe<NR::Rect> b = selection->bounds();
+ boost::optional<NR::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]);
it++)
{
sp_document_ensure_up_to_date(sp_desktop_document (desktop));
- NR::Maybe<NR::Rect> b = sp_item_bbox_desktop (*it);
+ boost::optional<NR::Rect> b = sp_item_bbox_desktop (*it);
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]);
it != selected.end();
++it)
{
- NR::Maybe<NR::Rect> bbox = sp_item_bbox_desktop(*it);
+ boost::optional<NR::Rect> bbox = sp_item_bbox_desktop(*it);
if (bbox) {
sorted.push_back(BBoxSort(*it, to_2geom(*bbox), _orientation, _kBegin, _kEnd));
}
//Check 2 or more selected objects
if (selected.size() < 2) return;
- NR::Maybe<NR::Rect> sel_bbox = selection->bounds();
+ boost::optional<NR::Rect> sel_bbox = selection->bounds();
if (!sel_bbox) {
return;
}
++it)
{
sp_document_ensure_up_to_date(sp_desktop_document (desktop));
- NR::Maybe<NR::Rect> item_box = sp_item_bbox_desktop (*it);
+ boost::optional<NR::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 +
@@ -762,7 +762,7 @@ void on_tool_changed(Inkscape::Application */*inkscape*/, SPEventContext */*cont
void on_selection_changed(Inkscape::Application */*inkscape*/, Inkscape::Selection */*selection*/, AlignAndDistribute *daad)
{
- daad->randomize_bbox = NR::Nothing();
+ daad->randomize_bbox = boost::optional<Geom::Rect>();
}
/////////////////////////////////////////////////////////
@@ -772,7 +772,7 @@ void on_selection_changed(Inkscape::Application */*inkscape*/, Inkscape::Selecti
AlignAndDistribute::AlignAndDistribute()
: UI::Widget::Panel ("", "dialogs.align", SP_VERB_DIALOG_ALIGN_DISTRIBUTE),
- randomize_bbox(NR::Nothing()),
+ randomize_bbox(),
_alignFrame(_("Align")),
_distributeFrame(_("Distribute")),
_removeOverlapFrame(_("Remove overlaps")),
// Connect to the global selection change, to invalidate cached randomize_bbox
g_signal_connect (G_OBJECT (INKSCAPE), "change_selection", G_CALLBACK (on_selection_changed), this);
- randomize_bbox = NR::Nothing();
+ randomize_bbox = boost::optional<Geom::Rect>();
show_all_children();
@@ -1073,7 +1073,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++) {
- NR::Maybe<NR::Rect> b = sp_item_bbox_desktop (*it);
+ boost::optional<NR::Rect> b = sp_item_bbox_desktop (*it);
if (b) {
gdouble dim = (*b).extent(horizontal ? Geom::X : Geom::Y);
if (dim > max) {
@@ -1090,7 +1090,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++) {
- NR::Maybe<NR::Rect> b = sp_item_bbox_desktop (*it);
+ boost::optional<NR::Rect> b = sp_item_bbox_desktop (*it);
if (b) {
gdouble dim = (*b).extent(horizontal ? Geom::X : Geom::Y);
if (dim < max) {
index c29fd7c0d349afad99d8d4158acf424f41ccf554..e4fdf9604e0107d3636c552a24e8fff28fb2b586 100644 (file)
std::list<SPItem *>::iterator find_master(std::list <SPItem *> &list, bool horizontal);
void setMode(bool nodeEdit);
- NR::Maybe<Geom::Rect> randomize_bbox;
+ boost::optional<Geom::Rect> randomize_bbox;
protected:
index c726b04549ca714953f2c3aa0cc09ca1db98b8a8..a512f984979109d25eb02c1323cfc03282b6e24b 100644 (file)
NRRectL bbox = {0, 0, scaledSvgWidth, scaledSvgHeight};
// write object bbox to area
- NR::Maybe<NR::Rect> maybeArea(from_2geom(area));
+ boost::optional<NR::Rect> maybeArea(from_2geom(area));
sp_document_ensure_up_to_date (svgDoc);
sp_item_invoke_bbox((SPItem *) svgDoc->root, &maybeArea,
from_2geom(sp_item_i2r_affine((SPItem *)(svgDoc->root))), TRUE);
index 8c12df55849eefce08b997fbf0fc1a87d1a06f95..ed89bf6aaf0945bb7acd2085b7ff5af4d9d27098 100644 (file)
{
if (selection && !selection->isEmpty()) {
if (!_check_move_relative.get_active()) {
- NR::Maybe<NR::Rect> bbox = selection->bounds();
+ boost::optional<NR::Rect> bbox = selection->bounds();
if (bbox) {
double x = bbox->min()[Geom::X];
double y = bbox->min()[Geom::Y];
Transformation::updatePageScale(Inkscape::Selection *selection)
{
if (selection && !selection->isEmpty()) {
- NR::Maybe<NR::Rect> bbox = selection->bounds();
+ boost::optional<NR::Rect> bbox = selection->bounds();
if (bbox) {
double w = bbox->extent(Geom::X);
double h = bbox->extent(Geom::Y);
Transformation::updatePageSkew(Inkscape::Selection *selection)
{
if (selection && !selection->isEmpty()) {
- NR::Maybe<NR::Rect> bbox = selection->bounds();
+ boost::optional<NR::Rect> bbox = selection->bounds();
if (bbox) {
double w = bbox->extent(Geom::X);
double h = bbox->extent(Geom::Y);
if (_check_move_relative.get_active()) {
sp_selection_move_relative(selection, x, y);
} else {
- NR::Maybe<NR::Rect> bbox = selection->bounds();
+ boost::optional<NR::Rect> bbox = selection->bounds();
if (bbox) {
sp_selection_move_relative(selection,
x - bbox->min()[Geom::X], y - bbox->min()[Geom::Y]);
it != selected.end();
++it)
{
- NR::Maybe<NR::Rect> bbox = sp_item_bbox_desktop(*it);
+ boost::optional<NR::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.));
}
it != selected.end();
++it)
{
- NR::Maybe<NR::Rect> bbox = sp_item_bbox_desktop(*it);
+ boost::optional<NR::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.));
}
}
}
} else {
- NR::Maybe<NR::Rect> bbox = selection->bounds();
+ boost::optional<NR::Rect> bbox = selection->bounds();
if (bbox) {
sp_selection_move_relative(selection,
x - bbox->min()[Geom::X], y - bbox->min()[Geom::Y]);
NR::scale scale (0,0);
// the values are increments!
if (_units_scale.isAbsolute()) {
- NR::Maybe<NR::Rect> bbox(sp_item_bbox_desktop(item));
+ boost::optional<NR::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
sp_item_scale_rel (item, scale);
}
} else {
- NR::Maybe<NR::Rect> bbox(selection->bounds());
+ boost::optional<NR::Rect> bbox(selection->bounds());
if (bbox) {
Geom::Point center(bbox->midpoint()); // use rotation center?
NR::scale scale (0,0);
sp_item_rotate_rel(item, NR::rotate (angle*M_PI/180.0));
}
} else {
- NR::Maybe<NR::Point> center = selection->center();
+ boost::optional<NR::Point> center = selection->center();
if (center) {
sp_selection_rotate_relative(selection, *center, angle);
}
} else { // absolute displacement
double skewX = _scalar_skew_horizontal.getValue("px");
double skewY = _scalar_skew_vertical.getValue("px");
- NR::Maybe<NR::Rect> bbox(sp_item_bbox_desktop(item));
+ boost::optional<NR::Rect> bbox(sp_item_bbox_desktop(item));
if (bbox) {
double width = bbox->extent(Geom::X);
double height = bbox->extent(Geom::Y);
}
}
} else { // transform whole selection
- NR::Maybe<NR::Rect> bbox = selection->bounds();
- NR::Maybe<NR::Point> center = selection->center();
+ boost::optional<NR::Rect> bbox = selection->bounds();
+ boost::optional<NR::Point> center = selection->center();
if ( bbox && center ) {
double width = bbox->extent(Geom::X);
//g_message("onMoveRelativeToggled: %f, %f px\n", x, y);
- NR::Maybe<NR::Rect> bbox = selection->bounds();
+ boost::optional<NR::Rect> bbox = selection->bounds();
if (bbox) {
if (_check_move_relative.get_active()) {
_scalar_move_horizontal.setValue(0);
_scalar_move_vertical.setValue(0);
} else {
- NR::Maybe<NR::Rect> bbox = selection->bounds();
+ boost::optional<NR::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/widget/object-composite-settings.cpp b/src/ui/widget/object-composite-settings.cpp
index 638f1a70c5b3f03449214ad7c420304914a1cbc7..d4c1bb7053d7038910d1c49c32e77036947f6f04 100644 (file)
// 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);
- NR::Maybe<NR::Rect> bbox = _subject->getBounds(SPItem::GEOMETRIC_BBOX);
+ boost::optional<NR::Rect> bbox = _subject->getBounds(SPItem::GEOMETRIC_BBOX);
double radius;
if (bbox) {
double perimeter = bbox->extent(Geom::X) + bbox->extent(Geom::Y);
case QUERY_STYLE_SINGLE:
case QUERY_STYLE_MULTIPLE_AVERAGED:
case QUERY_STYLE_MULTIPLE_SAME:
- NR::Maybe<NR::Rect> bbox = _subject->getBounds(SPItem::GEOMETRIC_BBOX);
+ boost::optional<NR::Rect> bbox = _subject->getBounds(SPItem::GEOMETRIC_BBOX);
if (bbox) {
double perimeter = bbox->extent(Geom::X) + bbox->extent(Geom::Y);
_fe_cb.set_blur_sensitive(true);
index 46d33abb7f1ac2b81207ab7d14ab4e5d8d36a7ac..39081b0057b36fc4c2c8d606b1e8da92724437cd 100644 (file)
}
}
-NR::Maybe<NR::Rect> StyleSubject::Selection::getBounds(SPItem::BBoxType type) {
+boost::optional<NR::Rect> StyleSubject::Selection::getBounds(SPItem::BBoxType type) {
Inkscape::Selection *selection = _getSelection();
if (selection) {
return selection->bounds(type);
} else {
- return NR::Nothing();
+ return boost::optional<NR::Rect>();
}
}
return iterator(_getLayerSList());
}
-NR::Maybe<NR::Rect> StyleSubject::CurrentLayer::getBounds(SPItem::BBoxType type) {
+boost::optional<NR::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 NR::Nothing();
+ return boost::optional<NR::Rect>();
}
}
index f9c54497603b4b2763452569ec97f55e150658c9..9204a816364189189995ea2bb2ab5efd0a4c865c 100644 (file)
#define SEEN_INKSCAPE_UI_WIDGET_STYLE_SUBJECT_H
#include "util/glib-list-iterators.h"
-#include "libnr/nr-maybe.h"
+#include <boost/optional.hpp>
#include "libnr/nr-rect.h"
#include "sp-item.h"
#include <sigc++/sigc++.h>
virtual iterator begin() = 0;
virtual iterator end() { return iterator(NULL); }
- virtual NR::Maybe<NR::Rect> getBounds(SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX) = 0;
+ virtual boost::optional<NR::Rect> getBounds(SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX) = 0;
virtual int queryStyle(SPStyle *query, int property) = 0;
virtual void setCSS(SPCSSAttr *css) = 0;
~Selection();
virtual iterator begin();
- virtual NR::Maybe<NR::Rect> getBounds(SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX);
+ virtual boost::optional<NR::Rect> getBounds(SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX);
virtual int queryStyle(SPStyle *query, int property);
virtual void setCSS(SPCSSAttr *css);
~CurrentLayer();
virtual iterator begin();
- virtual NR::Maybe<NR::Rect> getBounds(SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX);
+ virtual boost::optional<NR::Rect> getBounds(SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX);
virtual int queryStyle(SPStyle *query, int property);
virtual void setCSS(SPCSSAttr *css);
index dcf8d6e71ee0f99bf95671c4f2c7d663da0f8660..ac123792db6c595975fb53bca033f16ab0170658 100644 (file)
--- a/src/vanishing-point.cpp
+++ b/src/vanishing-point.cpp
@@ -677,7 +677,7 @@ VPDrag::drawLinesForFace (const SPBox3D *box, Proj::Axis axis) //, guint corner1
}
} else {
// draw perspective lines for infinite VPs
- NR::Maybe<NR::Point> pt1, pt2, pt3, pt4;
+ boost::optional<NR::Point> pt1, pt2, pt3, pt4;
Persp3D *persp = box3d_get_perspective(box);
SPDesktop *desktop = inkscape_active_desktop (); // FIXME: Store the desktop in VPDrag
Box3D::PerspectiveLine pl (corner1, axis, persp);
diff --git a/src/verbs.cpp b/src/verbs.cpp
index e40ffe1d69b3cc0e61af7c37504b68ce18e4c3d0..8d7a4a2a19d57046b26037940931e13ef66a9cf4 100644 (file)
--- a/src/verbs.cpp
+++ b/src/verbs.cpp
if (sel->isEmpty())
return;
- NR::Maybe<NR::Rect> bbox = sel->bounds();
+ boost::optional<NR::Rect> bbox = sel->bounds();
if (!bbox) {
return;
}
index 1faf7005f128f2a346fa9d83b505d0da20787b7c..20b1056143a2604fcfd42528aa0b1c50859e2d80 100644 (file)
hpos[len] = base_pt[0];
len++;
if ( curF ) {
- NR::Maybe<NR::Rect> nbbox = curF->BBox(str_text->glyph_text[i].gl);
+ boost::optional<NR::Rect> nbbox = curF->BBox(str_text->glyph_text[i].gl);
if (nbbox) {
bbox.x0 = MIN(bbox.x0, base_pt[Geom::X] + theSize * (nbbox->min())[0]);
bbox.y0 = MIN(bbox.y0, base_pt[Geom::Y] - theSize * (nbbox->max())[1]);
diff --git a/src/widgets/icon.cpp b/src/widgets/icon.cpp
index d89a85eaa58a36c0e3b8a252f5f786ee0e42453f..b460258edb78d5ee0f9e5912d3691aaf3cf7a78d 100644 (file)
--- a/src/widgets/icon.cpp
+++ b/src/widgets/icon.cpp
if (object && SP_IS_ITEM(object)) {
/* Find bbox in document */
Geom::Matrix const i2doc(sp_item_i2doc_affine(SP_ITEM(object)));
- NR::Maybe<Geom::Rect> dbox = SP_ITEM(object)->getBounds(i2doc);
+ boost::optional<Geom::Rect> dbox = SP_ITEM(object)->getBounds(i2doc);
if ( SP_OBJECT_PARENT(object) == NULL )
{
index 5a2adc8d20d3056e9d09c150c596c66979f51dec..e413aa39e04f4b0879a92c95d6046566aedbfa39 100644 (file)
int prefs_bbox = prefs_get_int_attribute("tools", "bounding_box", 0);
SPItem::BBoxType bbox_type = (prefs_bbox ==0)?
SPItem::APPROXIMATE_BBOX : SPItem::GEOMETRIC_BBOX;
- NR::Maybe<NR::Rect> const bbox(sel->bounds(bbox_type));
+ boost::optional<NR::Rect> const bbox(sel->bounds(bbox_type));
if ( bbox && !bbox->isEmpty() ) {
UnitTracker *tracker = reinterpret_cast<UnitTracker*>(g_object_get_data(G_OBJECT(spw), "tracker"));
SPUnit const &unit = *tracker->getActiveUnit();
int prefs_bbox = prefs_get_int_attribute("tools", "bounding_box", 0);
SPItem::BBoxType bbox_type = (prefs_bbox ==0)?
SPItem::APPROXIMATE_BBOX : SPItem::GEOMETRIC_BBOX;
- NR::Maybe<NR::Rect> bbox = selection->bounds(bbox_type);
+ boost::optional<NR::Rect> bbox = selection->bounds(bbox_type);
if ( !bbox || bbox->isEmpty() ) {
g_object_set_data(G_OBJECT(spw), "update", GINT_TO_POINTER(FALSE));
index 9ca705189d586fbc0041c2f3d30ef655bf090578..07b388d140127087fdd2283e75babdc92a200168 100644 (file)
--- a/src/widgets/toolbox.cpp
+++ b/src/widgets/toolbox.cpp
gtk_adjustment_set_value(yadj, sp_pixels_get_units(sel_node[Geom::Y], *unit));
}
} else {
- NR::Maybe<Geom::Coord> x = sp_node_selected_common_coord(nodepath, Geom::X);
- NR::Maybe<Geom::Coord> y = sp_node_selected_common_coord(nodepath, Geom::Y);
+ boost::optional<Geom::Coord> x = sp_node_selected_common_coord(nodepath, Geom::X);
+ boost::optional<Geom::Coord> y = sp_node_selected_common_coord(nodepath, Geom::Y);
if ((x && ((*x) != oldx)) || (y && ((*y) != oldy))) {
/* Note: Currently x and y will always have a value, even if the coordinates of the
selected nodes don't coincide (in this case we use the coordinates of the center
diff --git a/src/zoom-context.cpp b/src/zoom-context.cpp
index 71dca484642ac044c8accc0ee64899b4a60450be..56eeb69cb9e93aa0644e601826a307111023e37e 100644 (file)
--- a/src/zoom-context.cpp
+++ b/src/zoom-context.cpp
@@ -174,7 +174,7 @@ static gint sp_zoom_context_root_handler(SPEventContext *event_context, GdkEvent
NR::Point const button_w(event->button.x, event->button.y);
NR::Point const button_dt(desktop->w2d(button_w));
if ( event->button.button == 1 && !event_context->space_panning) {
- NR::Maybe<NR::Rect> const b = Inkscape::Rubberband::get()->getRectangle();
+ boost::optional<NR::Rect> const b = Inkscape::Rubberband::get()->getRectangle();
if (b && !within_tolerance) {
desktop->set_display_area(*b, 10);
} else if (!escaped) {