summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2008-08-05 22:40:31 +0000
committerjohanengelen <johanengelen@users.sourceforge.net>2008-08-05 22:40:31 +0000
commit900577c7e71534ec32dcb4e0677a509a6e517b12 (patch)
tree8d5b4c6201b0728bff338e89106d1a8c5a0b7fef /src
parentcodedread's patch for bug 254850 (fixes handling of description field in Obje... (diff)
downloadinkscape-900577c7e71534ec32dcb4e0677a509a6e517b12.tar.gz
inkscape-900577c7e71534ec32dcb4e0677a509a6e517b12.zip
NR::Maybe => boost::optional
(bzr r6569)
Diffstat (limited to 'src')
-rw-r--r--src/conn-avoid-ref.cpp2
-rw-r--r--src/connector-context.cpp2
-rw-r--r--src/desktop.cpp6
-rw-r--r--src/dialogs/clonetiler.cpp2
-rw-r--r--src/dialogs/export.cpp8
-rw-r--r--src/dialogs/stroke-style.cpp2
-rw-r--r--src/dialogs/tiledialog.cpp16
-rw-r--r--src/dialogs/unclump.cpp4
-rw-r--r--src/display/inkscape-cairo.cpp4
-rw-r--r--src/display/inkscape-cairo.h4
-rw-r--r--src/display/nr-arena-item.cpp2
-rw-r--r--src/display/nr-arena-item.h4
-rw-r--r--src/display/nr-arena-shape.cpp2
-rw-r--r--src/display/nr-filter-image.cpp2
-rw-r--r--src/display/sp-canvas.cpp2
-rw-r--r--src/document.cpp2
-rw-r--r--src/dyna-draw-context.cpp2
-rw-r--r--src/eraser-context.cpp6
-rw-r--r--src/event-context.cpp2
-rw-r--r--src/extension/internal/cairo-renderer.cpp2
-rw-r--r--src/extension/internal/grid.cpp2
-rw-r--r--src/extension/internal/odf.cpp6
-rw-r--r--src/file.cpp2
-rw-r--r--src/filter-chemistry.cpp4
-rw-r--r--src/flood-context.cpp2
-rw-r--r--src/gradient-chemistry.cpp6
-rw-r--r--src/gradient-context.cpp2
-rw-r--r--src/gradient-drag.cpp2
-rw-r--r--src/graphlayout/graphlayout.cpp4
-rw-r--r--src/interface.cpp4
-rw-r--r--src/libnr/nr-convex-hull.h8
-rw-r--r--src/libnr/nr-rect-l.cpp4
-rw-r--r--src/libnr/nr-rect-l.h6
-rw-r--r--src/libnr/nr-rect.cpp14
-rw-r--r--src/libnr/nr-rect.h37
-rw-r--r--src/libnrtype/FontInstance.cpp4
-rw-r--r--src/libnrtype/Layout-TNG-OutIter.cpp2
-rw-r--r--src/libnrtype/Layout-TNG-Output.cpp2
-rw-r--r--src/libnrtype/Layout-TNG.h6
-rw-r--r--src/libnrtype/RasterFont.cpp2
-rw-r--r--src/libnrtype/font-instance.h2
-rw-r--r--src/line-geometry.cpp10
-rw-r--r--src/line-geometry.h6
-rw-r--r--src/line-snapper.cpp4
-rw-r--r--src/line-snapper.h4
-rw-r--r--src/main.cpp4
-rw-r--r--src/node-context.cpp4
-rw-r--r--src/nodepath.cpp6
-rw-r--r--src/nodepath.h4
-rw-r--r--src/object-snapper.cpp8
-rw-r--r--src/object-snapper.h4
-rw-r--r--src/removeoverlap/removeoverlap.cpp2
-rw-r--r--src/rubberband.cpp4
-rw-r--r--src/rubberband.h4
-rw-r--r--src/selcue.cpp2
-rw-r--r--src/select-context.cpp2
-rw-r--r--src/selection-chemistry.cpp38
-rw-r--r--src/selection.cpp14
-rw-r--r--src/selection.h6
-rw-r--r--src/seltrans.cpp4
-rw-r--r--src/seltrans.h8
-rw-r--r--src/shape-editor.cpp2
-rw-r--r--src/shape-editor.h4
-rw-r--r--src/snap.cpp8
-rw-r--r--src/snap.h8
-rw-r--r--src/snapper.h6
-rw-r--r--src/sp-conn-end-pair.cpp2
-rw-r--r--src/sp-conn-end.cpp4
-rw-r--r--src/sp-flowtext.cpp2
-rw-r--r--src/sp-item-group.cpp2
-rw-r--r--src/sp-item-transform.cpp4
-rw-r--r--src/sp-item-transform.h2
-rw-r--r--src/sp-item.cpp40
-rw-r--r--src/sp-item.h8
-rw-r--r--src/sp-offset.cpp2
-rw-r--r--src/sp-shape.cpp4
-rw-r--r--src/splivarot.cpp6
-rw-r--r--src/splivarot.h2
-rw-r--r--src/text-context.cpp4
-rw-r--r--src/tweak-context.cpp6
-rw-r--r--src/ui/clipboard.cpp8
-rw-r--r--src/ui/dialog/align-and-distribute.cpp24
-rw-r--r--src/ui/dialog/align-and-distribute.h2
-rw-r--r--src/ui/dialog/filedialogimpl-win32.cpp2
-rw-r--r--src/ui/dialog/transformation.cpp30
-rw-r--r--src/ui/widget/object-composite-settings.cpp4
-rw-r--r--src/ui/widget/style-subject.cpp8
-rw-r--r--src/ui/widget/style-subject.h8
-rw-r--r--src/vanishing-point.cpp2
-rw-r--r--src/verbs.cpp2
-rw-r--r--src/widgets/font-selector.cpp2
-rw-r--r--src/widgets/icon.cpp2
-rw-r--r--src/widgets/select-toolbar.cpp4
-rw-r--r--src/widgets/toolbox.cpp4
-rw-r--r--src/zoom-context.cpp2
95 files changed, 271 insertions, 284 deletions
diff --git a/src/conn-avoid-ref.cpp b/src/conn-avoid-ref.cpp
index 7e764788d..2eb1f441e 100644
--- a/src/conn-avoid-ref.cpp
+++ b/src/conn-avoid-ref.cpp
@@ -193,7 +193,7 @@ static Avoid::Polygn avoid_item_poly(SPItem const *item)
// 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);
}
diff --git a/src/connector-context.cpp b/src/connector-context.cpp
index 1a77008f1..5e2cdc2b8 100644
--- a/src/connector-context.cpp
+++ b/src/connector-context.cpp
@@ -1148,7 +1148,7 @@ static void cc_set_active_shape(SPConnectorContext *cc, SPItem *item)
}
- 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 b8d9ef0b0..54285c083 100644
--- a/src/desktop.cpp
+++ b/src/desktop.cpp
@@ -529,7 +529,7 @@ bool SPDesktop::isLayer(SPObject *object) const {
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 {
@@ -968,7 +968,7 @@ SPDesktop::zoom_page_width()
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;
@@ -996,7 +996,7 @@ SPDesktop::zoom_drawing()
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.
diff --git a/src/dialogs/clonetiler.cpp b/src/dialogs/clonetiler.cpp
index 65c8fba02..07b146fca 100644
--- a/src/dialogs/clonetiler.cpp
+++ b/src/dialogs/clonetiler.cpp
@@ -1242,7 +1242,7 @@ clonetiler_apply( GtkWidget */*widget*/, void * )
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 0e2a08eb4..bd4493eae 100644
--- a/src/dialogs/export.cpp
+++ b/src/dialogs/export.cpp
@@ -780,7 +780,7 @@ sp_export_selection_modified ( Inkscape::Application */*inkscape*/,
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],
@@ -839,7 +839,7 @@ sp_export_area_toggled (GtkToggleButton *tb, GtkObject *base)
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
@@ -1410,7 +1410,7 @@ sp_export_detect_size(GtkObject * base) {
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)) {
@@ -1421,7 +1421,7 @@ sp_export_detect_size(GtkObject * base) {
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) ) {
diff --git a/src/dialogs/stroke-style.cpp b/src/dialogs/stroke-style.cpp
index 7d9aa84a6..ae387e5f8 100644
--- a/src/dialogs/stroke-style.cpp
+++ b/src/dialogs/stroke-style.cpp
@@ -615,7 +615,7 @@ sp_marker_prev_new(unsigned psize, gchar const *mname,
// 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;
diff --git a/src/dialogs/tiledialog.cpp b/src/dialogs/tiledialog.cpp
index 0c37e5ac0..f9bde3c0b 100644
--- a/src/dialogs/tiledialog.cpp
+++ b/src/dialogs/tiledialog.cpp
@@ -49,8 +49,8 @@ sp_compare_x_position(SPItem *first, SPItem *second)
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?
@@ -89,8 +89,8 @@ sp_compare_x_position(SPItem *first, SPItem *second)
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?
@@ -169,7 +169,7 @@ void TileDialog::Grid_Arrange ()
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;
}
@@ -211,7 +211,7 @@ void TileDialog::Grid_Arrange ()
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];
@@ -268,7 +268,7 @@ void TileDialog::Grid_Arrange ()
}
- 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
@@ -318,7 +318,7 @@ g_print("\n row = %f col = %f selection x= %f selection y = %f", total_row_h
for (; current_row != NULL; current_row = current_row->next) {
SPItem *item=SP_ITEM(current_row->data);
Inkscape::XML::Node *repr = 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];
diff --git a/src/dialogs/unclump.cpp b/src/dialogs/unclump.cpp
index 73131384f..923c44add 100644
--- a/src/dialogs/unclump.cpp
+++ b/src/dialogs/unclump.cpp
@@ -35,7 +35,7 @@ unclump_center (SPItem *item)
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;
@@ -54,7 +54,7 @@ unclump_wh (SPItem *item)
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;
diff --git a/src/display/inkscape-cairo.cpp b/src/display/inkscape-cairo.cpp
index 8bc9eade2..33a84d508 100644
--- a/src/display/inkscape-cairo.cpp
+++ b/src/display/inkscape-cairo.cpp
@@ -170,7 +170,7 @@ feed_path_to_cairo (cairo_t *ct, Geom::Path const &path)
/** 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;
diff --git a/src/display/inkscape-cairo.h b/src/display/inkscape-cairo.h
index 03bf50cb5..f3be94464 100644
--- a/src/display/inkscape-cairo.h
+++ b/src/display/inkscape-cairo.h
@@ -13,7 +13,7 @@
#include <2geom/forward.h>
#include <cairo/cairo.h>
-#include "libnr/nr-maybe.h"
+#include <boost/optional.hpp>
#include "libnr/nr-rect.h"
struct NRPixBlock;
@@ -21,7 +21,7 @@ class SPCanvasBuf;
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
diff --git a/src/display/nr-arena-item.cpp b/src/display/nr-arena-item.cpp
index a6a04bb8b..a236b866b 100644
--- a/src/display/nr-arena-item.cpp
+++ b/src/display/nr-arena-item.cpp
@@ -836,7 +836,7 @@ nr_arena_item_set_order (NRArenaItem *item, int order)
}
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));
diff --git a/src/display/nr-arena-item.h b/src/display/nr-arena-item.h
index c62c9a6ca..b95fc5e72 100644
--- a/src/display/nr-arena-item.h
+++ b/src/display/nr-arena-item.h
@@ -91,7 +91,7 @@ struct NRArenaItem : public NRObject {
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 */
@@ -177,7 +177,7 @@ void nr_arena_item_set_visible (NRArenaItem *item, unsigned int visible);
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);
diff --git a/src/display/nr-arena-shape.cpp b/src/display/nr-arena-shape.cpp
index 840f5044a..60795becf 100644
--- a/src/display/nr-arena-shape.cpp
+++ b/src/display/nr-arena-shape.cpp
@@ -716,7 +716,7 @@ nr_arena_shape_add_bboxes(NRArenaShape* shape, Geom::Rect &bbox)
// 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);
diff --git a/src/display/nr-filter-image.cpp b/src/display/nr-filter-image.cpp
index 086e4114d..65958f0d2 100644
--- a/src/display/nr-filter-image.cpp
+++ b/src/display/nr-filter-image.cpp
@@ -62,7 +62,7 @@ int FilterImage::render(FilterSlot &slot, FilterUnits const &units) {
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];
diff --git a/src/display/sp-canvas.cpp b/src/display/sp-canvas.cpp
index 592085bcd..a558774c4 100644
--- a/src/display/sp-canvas.cpp
+++ b/src/display/sp-canvas.cpp
@@ -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 356fba577..24b6edd20 100644
--- a/src/document.cpp
+++ b/src/document.cpp
@@ -900,7 +900,7 @@ static GSList *find_items_in_area(GSList *s, SPGroup *group, unsigned int dkey,
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);
}
diff --git a/src/dyna-draw-context.cpp b/src/dyna-draw-context.cpp
index 35e220a49..abe4d7dce 100644
--- a/src/dyna-draw-context.cpp
+++ b/src/dyna-draw-context.cpp
@@ -607,7 +607,7 @@ sp_dyna_draw_context_root_handler(SPEventContext *event_context,
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 81025d2b2..7f662f526 100644
--- a/src/eraser-context.cpp
+++ b/src/eraser-context.cpp
@@ -557,7 +557,7 @@ sp_eraser_context_root_handler(SPEventContext *event_context,
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);
@@ -743,7 +743,7 @@ set_to_accumulated(SPEraserContext *dc)
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;
@@ -765,7 +765,7 @@ set_to_accumulated(SPEraserContext *dc)
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 e7c5ac88a..22c91e450 100644
--- 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);
diff --git a/src/extension/internal/cairo-renderer.cpp b/src/extension/internal/cairo-renderer.cpp
index e7620f319..48fe3bec2 100644
--- a/src/extension/internal/cairo-renderer.cpp
+++ b/src/extension/internal/cairo-renderer.cpp
@@ -409,7 +409,7 @@ static void sp_asbitmap_render(SPItem *item, CairoRenderContext *ctx)
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))));
diff --git a/src/extension/internal/grid.cpp b/src/extension/internal/grid.cpp
index 534d4bcda..e206b2a68 100644
--- a/src/extension/internal/grid.cpp
+++ b/src/extension/internal/grid.cpp
@@ -86,7 +86,7 @@ Grid::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View *doc
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;
}
diff --git a/src/extension/internal/odf.cpp b/src/extension/internal/odf.cpp
index 02c3626bf..959070b50 100644
--- a/src/extension/internal/odf.cpp
+++ b/src/extension/internal/odf.cpp
@@ -962,9 +962,9 @@ static NR::Matrix getODFTransform(const SPItem *item)
* 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));
@@ -1864,7 +1864,7 @@ bool OdfOutput::writeTree(Writer &couts, Writer &souts,
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 633dc08ce..b620e9c9e 100644
--- a/src/file.cpp
+++ b/src/file.cpp
@@ -978,7 +978,7 @@ file_import(SPDocument *in_doc, const Glib::ustring &uri,
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);
diff --git a/src/filter-chemistry.cpp b/src/filter-chemistry.cpp
index cefb3227d..af8cfbfa1 100644
--- 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;
@@ -374,7 +374,7 @@ modify_filter_gaussian_blur_from_item(SPDocument *document, SPItem *item,
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 b11d32f8a..0c284db68 100644
--- 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."));
diff --git a/src/gradient-chemistry.cpp b/src/gradient-chemistry.cpp
index 9fade37ec..c6dd26712 100644
--- a/src/gradient-chemistry.cpp
+++ b/src/gradient-chemistry.cpp
@@ -281,7 +281,7 @@ sp_gradient_reset_to_userspace (SPGradient *gr, SPItem *item)
// 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],
diff --git a/src/gradient-context.cpp b/src/gradient-context.cpp
index 01964b8e7..9101fcee1 100644
--- 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 71b71b1c3..1657288cc 100644
--- a/src/gradient-drag.cpp
+++ b/src/gradient-drag.cpp
@@ -1723,7 +1723,7 @@ GrDrag::updateLevels ()
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]);
diff --git a/src/graphlayout/graphlayout.cpp b/src/graphlayout/graphlayout.cpp
index 9285e9618..60cdab814 100644
--- a/src/graphlayout/graphlayout.cpp
+++ b/src/graphlayout/graphlayout.cpp
@@ -124,7 +124,7 @@ void graphlayout(GSList const *const items) {
++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());
@@ -235,7 +235,7 @@ void graphlayout(GSList const *const items) {
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 dc583a645..0ec73d81b 100644
--- a/src/interface.cpp
+++ b/src/interface.cpp
@@ -1180,7 +1180,7 @@ sp_ui_drag_data_received(GtkWidget *widget,
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;
@@ -1252,7 +1252,7 @@ sp_ui_drag_data_received(GtkWidget *widget,
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);
diff --git a/src/libnr/nr-convex-hull.h b/src/libnr/nr-convex-hull.h
index 51dabcf07..dafdd8840 100644
--- a/src/libnr/nr-convex-hull.h
+++ b/src/libnr/nr-convex-hull.h
@@ -20,11 +20,11 @@ public:
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>();
}
}
@@ -46,12 +46,12 @@ public:
}
}
- Maybe<Rect> const &bounds() const {
+ boost::optional<Rect> const &bounds() const {
return _bounds;
}
private:
- Maybe<Rect> _bounds;
+ boost::optional<Rect> _bounds;
};
} /* namespace NR */
diff --git a/src/libnr/nr-rect-l.cpp b/src/libnr/nr-rect-l.cpp
index fa3c687c5..4f6c5c866 100644
--- a/src/libnr/nr-rect-l.cpp
+++ b/src/libnr/nr-rect-l.cpp
@@ -1,8 +1,8 @@
#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 18065d1d7..f21ba8fc6 100644
--- a/src/libnr/nr-rect-l.h
+++ b/src/libnr/nr-rect-l.h
@@ -2,12 +2,12 @@
#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;
};
@@ -79,7 +79,7 @@ public:
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 04d93ae04..77af27417 100644
--- a/src/libnr/nr-rect.cpp
+++ b/src/libnr/nr-rect.cpp
@@ -17,7 +17,7 @@ NRRect::NRRect(NR::Rect const &rect)
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];
@@ -28,9 +28,9 @@ NRRect::NRRect(NR::Maybe<NR::Rect> const &rect) {
}
}
-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));
}
@@ -308,17 +308,17 @@ void Rect::growBy(double size) {
}
/** 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 da1299b2b..7d130fd18 100644
--- a/src/libnr/nr-rect.h
+++ b/src/libnr/nr-rect.h
@@ -22,7 +22,7 @@
#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>
@@ -147,7 +147,7 @@ public:
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();
@@ -180,47 +180,30 @@ private:
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;
@@ -257,9 +240,9 @@ struct NRRect {
: 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;
};
diff --git a/src/libnrtype/FontInstance.cpp b/src/libnrtype/FontInstance.cpp
index 5058e8e22..4f745c0f9 100644
--- a/src/libnrtype/FontInstance.cpp
+++ b/src/libnrtype/FontInstance.cpp
@@ -613,7 +613,7 @@ bool font_instance::FontSlope(double &run, double &rise)
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() ) {
@@ -627,7 +627,7 @@ NR::Maybe<NR::Rect> font_instance::BBox(int glyph_id)
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]);
diff --git a/src/libnrtype/Layout-TNG-OutIter.cpp b/src/libnrtype/Layout-TNG-OutIter.cpp
index 2471da3dd..84307c9ce 100644
--- a/src/libnrtype/Layout-TNG-OutIter.cpp
+++ b/src/libnrtype/Layout-TNG-OutIter.cpp
@@ -201,7 +201,7 @@ Layout::iterator Layout::sourceToIterator(void *source_cookie) const
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);
diff --git a/src/libnrtype/Layout-TNG-Output.cpp b/src/libnrtype/Layout-TNG-Output.cpp
index 3ad979cca..36c882d44 100644
--- a/src/libnrtype/Layout-TNG-Output.cpp
+++ b/src/libnrtype/Layout-TNG-Output.cpp
@@ -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]);
diff --git a/src/libnrtype/Layout-TNG.h b/src/libnrtype/Layout-TNG.h
index 36e7be0a5..cea97ff2a 100644
--- a/src/libnrtype/Layout-TNG.h
+++ b/src/libnrtype/Layout-TNG.h
@@ -11,6 +11,9 @@
#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"
@@ -19,6 +22,7 @@
#include <pango/pango-break.h>
#include <algorithm>
#include <vector>
+#include <boost/optional.hpp>
#ifdef HAVE_CAIRO_PDF
namespace Inkscape {
@@ -444,7 +448,7 @@ public:
/** 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. */
diff --git a/src/libnrtype/RasterFont.cpp b/src/libnrtype/RasterFont.cpp
index 61ef1720b..10e653664 100644
--- a/src/libnrtype/RasterFont.cpp
+++ b/src/libnrtype/RasterFont.cpp
@@ -107,7 +107,7 @@ void raster_font::BBox(int glyph_id,NRRect *area)
{
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]);
diff --git a/src/libnrtype/font-instance.h b/src/libnrtype/font-instance.h
index e204f5df1..f2e3438f1 100644
--- a/src/libnrtype/font-instance.h
+++ b/src/libnrtype/font-instance.h
@@ -77,7 +77,7 @@ public:
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 d050ec458..056bfb71a 100644
--- a/src/line-geometry.cpp
+++ b/src/line-geometry.cpp
@@ -52,9 +52,9 @@ Line &Line::operator=(Line const &line) {
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;
@@ -72,7 +72,7 @@ void Line::set_direction(NR::Point const &dir)
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 */
@@ -188,7 +188,7 @@ NR::Maybe<NR::Point> Line::intersection_with_viewbox (SPDesktop *desktop)
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 5e3152c03..86ed9ee8a 100644
--- a/src/line-geometry.h
+++ b/src/line-geometry.h
@@ -14,7 +14,7 @@
#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
@@ -30,13 +30,13 @@ public:
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 ee902d5fc..d06d027e3 100644
--- a/src/line-snapper.cpp
+++ b/src/line-snapper.cpp
@@ -27,7 +27,7 @@ void Inkscape::LineSnapper::freeSnap(SnappedConstraints &sc,
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
{
@@ -61,7 +61,7 @@ void Inkscape::LineSnapper::constrainedSnap(SnappedConstraints &sc,
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 e5fc95dcb..e0adf3845 100644
--- a/src/line-snapper.h
+++ b/src/line-snapper.h
@@ -25,7 +25,7 @@ public:
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;
@@ -33,7 +33,7 @@ public:
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 6ec0ca6b4..d6f0ae9e8 100644
--- 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) {
@@ -953,7 +953,7 @@ do_query_all_recurse (SPObject *o)
{
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 bff972408..d8a1ec1d7 100644
--- a/src/node-context.cpp
+++ b/src/node-context.cpp
@@ -437,7 +437,7 @@ sp_node_context_root_handler(SPEventContext *event_context, GdkEvent *event)
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();
@@ -620,7 +620,7 @@ sp_node_context_root_handler(SPEventContext *event_context, GdkEvent *event)
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 c5a653bf0..017544901 100644
--- 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 ac0c400d4..b330ff964 100644
--- 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 5f65e3ff9..020a4793d 100644
--- a/src/object-snapper.cpp
+++ b/src/object-snapper.cpp
@@ -96,7 +96,7 @@ void Inkscape::ObjectSnapper::_findCandidates(SPObject* parent,
_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));
@@ -588,7 +588,7 @@ void Inkscape::ObjectSnapper::freeSnap(SnappedConstraints &sc,
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
{
@@ -631,7 +631,7 @@ void Inkscape::ObjectSnapper::constrainedSnap( SnappedConstraints &sc,
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 603466000..3784c43d0 100644
--- a/src/object-snapper.h
+++ b/src/object-snapper.h
@@ -80,7 +80,7 @@ public:
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;
@@ -88,7 +88,7 @@ public:
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/removeoverlap/removeoverlap.cpp b/src/removeoverlap/removeoverlap.cpp
index 395d4fe0e..0562123de 100644
--- a/src/removeoverlap/removeoverlap.cpp
+++ b/src/removeoverlap/removeoverlap.cpp
@@ -48,7 +48,7 @@ void removeoverlap(GSList const *const items, double const xGap, double const yG
++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 58f88bbfb..73333a555 100644
--- a/src/rubberband.cpp
+++ b/src/rubberband.cpp
@@ -126,10 +126,10 @@ void Inkscape::Rubberband::setMode(int mode)
_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 b6ef1984e..7734a65fa 100644
--- a/src/rubberband.h
+++ b/src/rubberband.h
@@ -17,7 +17,7 @@
#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 */
@@ -40,7 +40,7 @@ public:
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 bac12fe80..2ce9a8b50 100644
--- a/src/selcue.cpp
+++ b/src/selcue.cpp
@@ -84,7 +84,7 @@ void Inkscape::SelCue::_updateItemBboxes()
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 010382376..0957b8432 100644
--- a/src/select-context.cpp
+++ b/src/select-context.cpp
@@ -594,7 +594,7 @@ sp_select_context_root_handler(SPEventContext *event_context, GdkEvent *event)
// 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());
diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp
index a5f270389..114ed9c64 100644
--- a/src/selection-chemistry.cpp
+++ b/src/selection-chemistry.cpp
@@ -567,12 +567,12 @@ sp_item_list_common_parent_group(GSList const *items)
}
/** 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));
}
@@ -621,7 +621,7 @@ sp_selection_raise()
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) {
@@ -631,7 +631,7 @@ sp_selection_raise()
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)) {
@@ -713,7 +713,7 @@ sp_selection_lower()
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);
@@ -728,7 +728,7 @@ sp_selection_lower()
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)) {
@@ -1248,7 +1248,7 @@ sp_selection_scale_absolute(Inkscape::Selection *selection,
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;
}
@@ -1403,8 +1403,8 @@ sp_selection_rotate_screen(Inkscape::Selection *selection, gdouble angle)
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;
@@ -1432,7 +1432,7 @@ sp_selection_scale(Inkscape::Selection *selection, gdouble grow)
if (selection->isEmpty())
return;
- NR::Maybe<NR::Rect> const bbox(selection->bounds());
+ boost::optional<NR::Rect> const bbox(selection->bounds());
if (!bbox) {
return;
}
@@ -1469,7 +1469,7 @@ sp_selection_scale_times(Inkscape::Selection *selection, gdouble times)
if (selection->isEmpty())
return;
- NR::Maybe<NR::Rect> sel_bbox = selection->bounds();
+ boost::optional<NR::Rect> sel_bbox = selection->bounds();
if (!sel_bbox) {
return;
@@ -1795,7 +1795,7 @@ SPItem *next_item(SPDesktop *desktop, GSList *path, SPObject *root,
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();
@@ -2054,8 +2054,8 @@ void sp_selection_to_marker(bool apply)
}
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;
}
@@ -2177,7 +2177,7 @@ sp_selection_tile(bool apply)
}
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;
}
@@ -2836,7 +2836,7 @@ fit_canvas_to_selection(SPDesktop *desktop)
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;
@@ -2864,7 +2864,7 @@ fit_canvas_to_drawing(SPDocument *doc)
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 acab9396c..b71f27815 100644
--- a/src/selection.cpp
+++ b/src/selection.cpp
@@ -382,11 +382,11 @@ NRRect *Selection::bounds(NRRect *bbox, SPItem::BBoxType type) const
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) {
@@ -429,11 +429,11 @@ NR::Maybe<NR::Point> Selection::center() const {
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>();
}
}
@@ -473,7 +473,7 @@ std::vector<NR::Point> Selection::getSnapPointsConvexHull() const {
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 3d45c171d..f02aeb456 100644
--- a/src/selection.h
+++ b/src/selection.h
@@ -243,7 +243,7 @@ public:
/** @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
@@ -257,12 +257,12 @@ public:
*
* \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 c478036c7..0b297318d 100644
--- a/src/seltrans.cpp
+++ b/src/seltrans.cpp
@@ -94,8 +94,8 @@ Inkscape::SelTrans::SelTrans(SPDesktop *desktop) :
_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 d06e05276..3a7f6f4b2 100644
--- a/src/seltrans.h
+++ b/src/seltrans.h
@@ -131,9 +131,9 @@ private:
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;
@@ -154,7 +154,7 @@ private:
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 c88b5eb3f..2b7ec4c3d 100644
--- a/src/shape-editor.cpp
+++ b/src/shape-editor.cpp
@@ -571,7 +571,7 @@ void ShapeEditor::show_helperpath (bool show) {
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 2a6da68c3..fe95aca8f 100644
--- a/src/shape-editor.h
+++ b/src/shape-editor.h
@@ -19,7 +19,7 @@ namespace Inkscape { namespace NodePath { class Path; } }
#include "libnr/nr-path-code.h"
#include "libnr/nr-point.h"
-#include "libnr/nr-maybe.h"
+#include <boost/optional.hpp>
#include <vector>
class KnotHolder;
@@ -114,7 +114,7 @@ public:
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 09cdbbaba..68f4c8465 100644
--- a/src/snap.cpp
+++ b/src/snap.cpp
@@ -182,7 +182,7 @@ bool SnapManager::getSnapModeGuide() const
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);
@@ -202,7 +202,7 @@ void SnapManager::freeSnapReturnByRef(Inkscape::Snapper::PointType point_type,
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 4c5e57b73..966d2a543 100644
--- a/src/snap.h
+++ b/src/snap.h
@@ -55,12 +55,12 @@ public:
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
@@ -68,13 +68,13 @@ public:
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 f79573990..cf2732b24 100644
--- a/src/snapper.h
+++ b/src/snapper.h
@@ -16,7 +16,7 @@
#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"
@@ -67,7 +67,7 @@ public:
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 {};
@@ -105,7 +105,7 @@ public:
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/sp-conn-end-pair.cpp b/src/sp-conn-end-pair.cpp
index 786209fda..6ef374684 100644
--- a/src/sp-conn-end-pair.cpp
+++ b/src/sp-conn-end-pair.cpp
@@ -167,7 +167,7 @@ SPConnEndPair::getEndpoints(NR::Point endPts[]) const {
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 a4ecf1f65..127262540 100644
--- a/src/sp-conn-end.cpp
+++ b/src/sp-conn-end.cpp
@@ -72,7 +72,7 @@ sp_conn_end_move_compensate(NR::Matrix const */*mp*/, SPItem */*moved_item*/,
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);
@@ -115,7 +115,7 @@ sp_conn_end_move_compensate(NR::Matrix const */*mp*/, SPItem */*moved_item*/,
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 8621a27b5..f6ba68911 100644
--- a/src/sp-flowtext.cpp
+++ b/src/sp-flowtext.cpp
@@ -352,7 +352,7 @@ sp_flowtext_print(SPItem *item, SPPrintContext *ctx)
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 80089df35..186b76663 100644
--- a/src/sp-item-group.cpp
+++ b/src/sp-item-group.cpp
@@ -696,7 +696,7 @@ void CGroup::onModified(guint flags) {
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) {
diff --git a/src/sp-item-transform.cpp b/src/sp-item-transform.cpp
index 4caf155bf..6a6ab4fc4 100644
--- a/src/sp-item-transform.cpp
+++ b/src/sp-item-transform.cpp
@@ -46,7 +46,7 @@ sp_item_rotate_rel(SPItem *item, NR::rotate const &rotation)
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);
diff --git a/src/sp-item-transform.h b/src/sp-item-transform.h
index 8f6cdc24d..26258a1fe 100644
--- a/src/sp-item-transform.h
+++ b/src/sp-item-transform.h
@@ -10,7 +10,7 @@ void sp_item_skew_rel (SPItem *item, double skewX, double skewY);
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 5d7177253..b0b6d8137 100644
--- a/src/sp-item.cpp
+++ b/src/sp-item.cpp
@@ -287,7 +287,7 @@ SPItem::setExplicitlyHidden(bool const val) {
*/
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
@@ -309,7 +309,7 @@ bool SPItem::isCenterSet() {
}
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 {
@@ -640,7 +640,7 @@ sp_item_update(SPObject *object, SPCtx *ctx, guint flags)
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;
}
@@ -710,7 +710,7 @@ Geom::Rect
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);
@@ -719,12 +719,12 @@ const
}
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,
@@ -913,16 +913,16 @@ sp_item_bbox_desktop(SPItem *item, NRRect *bbox, SPItem::BBoxType type)
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);
}
@@ -1716,7 +1716,7 @@ sp_item_convert_to_guides(SPItem *item) {
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 39907999f..581b6acdd 100644
--- a/src/sp-item.h
+++ b/src/sp-item.h
@@ -154,7 +154,7 @@ struct SPItem : public SPObject {
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;
@@ -214,9 +214,9 @@ struct SPItemClass {
/* 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);
@@ -252,7 +252,7 @@ gint sp_item_event (SPItem *item, SPEvent *event);
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 2f8dc7c50..37ea2e5f5 100644
--- a/src/sp-offset.cpp
+++ b/src/sp-offset.cpp
@@ -510,7 +510,7 @@ sp_offset_set_shape(SPShape *shape)
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 5509b7c77..054310472 100644
--- a/src/sp-shape.cpp
+++ b/src/sp-shape.cpp
@@ -272,7 +272,7 @@ sp_shape_update (SPObject *object, SPCtx *ctx, unsigned int flags)
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) {
@@ -711,7 +711,7 @@ sp_shape_show (SPItem *item, NRArena *arena, unsigned int /*key*/, unsigned int
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 11044ec1a..06ae89ba0 100644
--- a/src/splivarot.cpp
+++ b/src/splivarot.cpp
@@ -1610,7 +1610,7 @@ sp_selected_path_simplify_items(SPDesktop *desktop,
bool didSomething = false;
- NR::Maybe<NR::Rect> selectionBbox = selection->bounds();
+ boost::optional<NR::Rect> selectionBbox = selection->bounds();
if (!selectionBbox) {
return false;
}
@@ -1631,7 +1631,7 @@ sp_selected_path_simplify_items(SPDesktop *desktop,
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 {
@@ -1871,7 +1871,7 @@ Path *bpath_to_Path(NArtBpath const *bpath)
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 69e985ffa..ad4d9c6e0 100644
--- a/src/splivarot.h
+++ b/src/splivarot.h
@@ -50,7 +50,7 @@ void sp_selected_path_simplify ();
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 da69277f8..0865e06cb 100644
--- 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);
}
@@ -1573,7 +1573,7 @@ sp_text_context_update_cursor(SPTextContext *tc, bool scroll_to_see)
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 70cd49c81..e670a2db4 100644
--- a/src/tweak-context.cpp
+++ b/src/tweak-context.cpp
@@ -40,7 +40,7 @@
#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)) {
@@ -736,7 +736,7 @@ sp_tweak_color_recursive (guint mode, SPItem *item, SPItem *item_at_point,
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 537277afc..013882327 100644
--- 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));
@@ -569,7 +569,7 @@ void ClipboardManagerImpl::_copySelection(Inkscape::Selection *selection)
}
}
- 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());
@@ -774,7 +774,7 @@ void ClipboardManagerImpl::_pasteDocument(SPDocument *clipdoc, bool in_place)
// 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) {
diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp
index 7d4820663..e83907f49 100644
--- a/src/ui/dialog/align-and-distribute.cpp
+++ b/src/ui/dialog/align-and-distribute.cpp
@@ -153,7 +153,7 @@ private :
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]);
@@ -170,7 +170,7 @@ private :
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],
@@ -183,7 +183,7 @@ private :
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]);
@@ -214,7 +214,7 @@ private :
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]);
@@ -318,7 +318,7 @@ private :
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));
}
@@ -590,7 +590,7 @@ private :
//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;
}
@@ -611,7 +611,7 @@ private :
++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")),
@@ -935,7 +935,7 @@ AlignAndDistribute::AlignAndDistribute()
// 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) {
diff --git a/src/ui/dialog/align-and-distribute.h b/src/ui/dialog/align-and-distribute.h
index c29fd7c0d..e4fdf9604 100644
--- a/src/ui/dialog/align-and-distribute.h
+++ b/src/ui/dialog/align-and-distribute.h
@@ -65,7 +65,7 @@ public:
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:
diff --git a/src/ui/dialog/filedialogimpl-win32.cpp b/src/ui/dialog/filedialogimpl-win32.cpp
index c726b0454..a512f9849 100644
--- a/src/ui/dialog/filedialogimpl-win32.cpp
+++ b/src/ui/dialog/filedialogimpl-win32.cpp
@@ -866,7 +866,7 @@ bool FileOpenDialogImplWin32::set_svg_preview()
NRRectL bbox = {0, 0, scaledSvgWidth, scaledSvgHeight};
// write object bbox to area
- 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);
diff --git a/src/ui/dialog/transformation.cpp b/src/ui/dialog/transformation.cpp
index 8c12df558..ed89bf6aa 100644
--- a/src/ui/dialog/transformation.cpp
+++ b/src/ui/dialog/transformation.cpp
@@ -457,7 +457,7 @@ Transformation::updatePageMove(Inkscape::Selection *selection)
{
if (selection && !selection->isEmpty()) {
if (!_check_move_relative.get_active()) {
- 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];
@@ -478,7 +478,7 @@ void
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);
@@ -508,7 +508,7 @@ void
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);
@@ -604,7 +604,7 @@ Transformation::applyPageMove(Inkscape::Selection *selection)
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]);
@@ -625,7 +625,7 @@ Transformation::applyPageMove(Inkscape::Selection *selection)
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.));
}
@@ -649,7 +649,7 @@ Transformation::applyPageMove(Inkscape::Selection *selection)
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.));
}
@@ -668,7 +668,7 @@ Transformation::applyPageMove(Inkscape::Selection *selection)
}
}
} 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]);
@@ -692,7 +692,7 @@ Transformation::applyPageScale(Inkscape::Selection *selection)
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
@@ -710,7 +710,7 @@ Transformation::applyPageScale(Inkscape::Selection *selection)
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);
@@ -747,7 +747,7 @@ Transformation::applyPageRotate(Inkscape::Selection *selection)
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);
}
@@ -777,7 +777,7 @@ Transformation::applyPageSkew(Inkscape::Selection *selection)
} 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);
@@ -786,8 +786,8 @@ Transformation::applyPageSkew(Inkscape::Selection *selection)
}
}
} 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);
@@ -869,7 +869,7 @@ Transformation::onMoveRelativeToggled()
//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()) {
@@ -1009,7 +1009,7 @@ Transformation::onClear()
_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 638f1a70c..d4c1bb705 100644
--- a/src/ui/widget/object-composite-settings.cpp
+++ b/src/ui/widget/object-composite-settings.cpp
@@ -114,7 +114,7 @@ ObjectCompositeSettings::_blendBlurValueChanged()
// FIXME: fix for GTK breakage, see comment in SelectedStyle::on_opacity_changed; here it results in crash 1580903
sp_canvas_force_full_redraw_after_interruptions(sp_desktop_canvas(desktop), 0);
- 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);
@@ -260,7 +260,7 @@ ObjectCompositeSettings::_subjectChanged() {
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);
diff --git a/src/ui/widget/style-subject.cpp b/src/ui/widget/style-subject.cpp
index 46d33abb7..39081b005 100644
--- a/src/ui/widget/style-subject.cpp
+++ b/src/ui/widget/style-subject.cpp
@@ -65,12 +65,12 @@ StyleSubject::iterator StyleSubject::Selection::begin() {
}
}
-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>();
}
}
@@ -143,12 +143,12 @@ StyleSubject::iterator StyleSubject::CurrentLayer::begin() {
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>();
}
}
diff --git a/src/ui/widget/style-subject.h b/src/ui/widget/style-subject.h
index f9c544976..9204a8163 100644
--- a/src/ui/widget/style-subject.h
+++ b/src/ui/widget/style-subject.h
@@ -10,7 +10,7 @@
#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>
@@ -43,7 +43,7 @@ public:
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;
@@ -66,7 +66,7 @@ public:
~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);
@@ -87,7 +87,7 @@ public:
~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);
diff --git a/src/vanishing-point.cpp b/src/vanishing-point.cpp
index dcf8d6e71..ac123792d 100644
--- 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 e40ffe1d6..8d7a4a2a1 100644
--- a/src/verbs.cpp
+++ b/src/verbs.cpp
@@ -1309,7 +1309,7 @@ ObjectVerb::perform( SPAction *action, void *data, void */*pdata*/ )
if (sel->isEmpty())
return;
- NR::Maybe<NR::Rect> bbox = sel->bounds();
+ boost::optional<NR::Rect> bbox = sel->bounds();
if (!bbox) {
return;
}
diff --git a/src/widgets/font-selector.cpp b/src/widgets/font-selector.cpp
index 1faf7005f..20b105614 100644
--- a/src/widgets/font-selector.cpp
+++ b/src/widgets/font-selector.cpp
@@ -671,7 +671,7 @@ static gint sp_font_preview_expose(GtkWidget *widget, GdkEventExpose *event)
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 d89a85eaa..b460258ed 100644
--- a/src/widgets/icon.cpp
+++ b/src/widgets/icon.cpp
@@ -623,7 +623,7 @@ sp_icon_doc_icon( SPDocument *doc, NRArenaItem *root,
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 )
{
diff --git a/src/widgets/select-toolbar.cpp b/src/widgets/select-toolbar.cpp
index 5a2adc8d2..e413aa39e 100644
--- a/src/widgets/select-toolbar.cpp
+++ b/src/widgets/select-toolbar.cpp
@@ -68,7 +68,7 @@ sp_selection_layout_widget_update(SPWidget *spw, Inkscape::Selection *sel)
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();
@@ -158,7 +158,7 @@ sp_object_layout_any_value_changed(GtkAdjustment *adj, SPWidget *spw)
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));
diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp
index 9ca705189..07b388d14 100644
--- a/src/widgets/toolbox.cpp
+++ b/src/widgets/toolbox.cpp
@@ -1107,8 +1107,8 @@ sp_node_toolbox_coord_changed(gpointer /*shape_editor*/, GObject *tbl)
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 71dca4846..56eeb69cb 100644
--- 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) {