Code

NR::Maybe => boost::optional
authorjohanengelen <johanengelen@users.sourceforge.net>
Tue, 5 Aug 2008 22:40:31 +0000 (22:40 +0000)
committerjohanengelen <johanengelen@users.sourceforge.net>
Tue, 5 Aug 2008 22:40:31 +0000 (22:40 +0000)
95 files changed:
src/conn-avoid-ref.cpp
src/connector-context.cpp
src/desktop.cpp
src/dialogs/clonetiler.cpp
src/dialogs/export.cpp
src/dialogs/stroke-style.cpp
src/dialogs/tiledialog.cpp
src/dialogs/unclump.cpp
src/display/inkscape-cairo.cpp
src/display/inkscape-cairo.h
src/display/nr-arena-item.cpp
src/display/nr-arena-item.h
src/display/nr-arena-shape.cpp
src/display/nr-filter-image.cpp
src/display/sp-canvas.cpp
src/document.cpp
src/dyna-draw-context.cpp
src/eraser-context.cpp
src/event-context.cpp
src/extension/internal/cairo-renderer.cpp
src/extension/internal/grid.cpp
src/extension/internal/odf.cpp
src/file.cpp
src/filter-chemistry.cpp
src/flood-context.cpp
src/gradient-chemistry.cpp
src/gradient-context.cpp
src/gradient-drag.cpp
src/graphlayout/graphlayout.cpp
src/interface.cpp
src/libnr/nr-convex-hull.h
src/libnr/nr-rect-l.cpp
src/libnr/nr-rect-l.h
src/libnr/nr-rect.cpp
src/libnr/nr-rect.h
src/libnrtype/FontInstance.cpp
src/libnrtype/Layout-TNG-OutIter.cpp
src/libnrtype/Layout-TNG-Output.cpp
src/libnrtype/Layout-TNG.h
src/libnrtype/RasterFont.cpp
src/libnrtype/font-instance.h
src/line-geometry.cpp
src/line-geometry.h
src/line-snapper.cpp
src/line-snapper.h
src/main.cpp
src/node-context.cpp
src/nodepath.cpp
src/nodepath.h
src/object-snapper.cpp
src/object-snapper.h
src/removeoverlap/removeoverlap.cpp
src/rubberband.cpp
src/rubberband.h
src/selcue.cpp
src/select-context.cpp
src/selection-chemistry.cpp
src/selection.cpp
src/selection.h
src/seltrans.cpp
src/seltrans.h
src/shape-editor.cpp
src/shape-editor.h
src/snap.cpp
src/snap.h
src/snapper.h
src/sp-conn-end-pair.cpp
src/sp-conn-end.cpp
src/sp-flowtext.cpp
src/sp-item-group.cpp
src/sp-item-transform.cpp
src/sp-item-transform.h
src/sp-item.cpp
src/sp-item.h
src/sp-offset.cpp
src/sp-shape.cpp
src/splivarot.cpp
src/splivarot.h
src/text-context.cpp
src/tweak-context.cpp
src/ui/clipboard.cpp
src/ui/dialog/align-and-distribute.cpp
src/ui/dialog/align-and-distribute.h
src/ui/dialog/filedialogimpl-win32.cpp
src/ui/dialog/transformation.cpp
src/ui/widget/object-composite-settings.cpp
src/ui/widget/style-subject.cpp
src/ui/widget/style-subject.h
src/vanishing-point.cpp
src/verbs.cpp
src/widgets/font-selector.cpp
src/widgets/icon.cpp
src/widgets/select-toolbar.cpp
src/widgets/toolbox.cpp
src/zoom-context.cpp

index 7e764788d231ede5b16d6794dc6149a79e060751..2eb1f441e015978b6f6f4de45c89e80c853a1b92 100644 (file)
@@ -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);
     }
index 1a77008f1cb2ab7236d2fa7f5a0540b5fdcd5ae3..5e2cdc2b80612d7dbd36a44a684f76c2f50e210a 100644 (file)
@@ -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);
index b8d9ef0b036543f9b929af206ff3dce7bc1a0b4c..54285c083c1cb7064f35f930b5914b4af8c17c7c 100644 (file)
@@ -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.
index 65c8fba02e274b32d020ae880159d73335658506..07b146fca23e7c84c99faa3b7185ca1d81c0f511 100644 (file)
@@ -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];
index 0e2a08eb4c4442f3ae08ab55c1fedc54489d1e0d..bd4493eaeddb14445b0475ddbee16c2ecb79c7a3 100644 (file)
@@ -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) ) {
index 7d9aa84a6559d5312b03bfab0811d193a0a2360a..ae387e5f84e6a2f004cf08813f3c7daca3a5e91c 100644 (file)
@@ -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;
index 0c37e5ac0dc6587d2f61c64c8750e6703fb91d46..f9bde3c0b18bf5cabd4aa5f9fe6e26ee489f0a75 100644 (file)
@@ -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];
index 73131384fa4608ac0254ba459b256ff0bf521899..923c44addcb49a5c82038ecfc4b7865f358bfc4a 100644 (file)
@@ -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;
index 8bc9eade2815fa61100229d68741289dd219a675..33a84d5086edff59e678f11a0ce1cba51c90c2a6 100644 (file)
@@ -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;
index 03bf50cb57deb4d0dfb7c44212e69d42c0170688..f3be94464acaddc331aa6ebd1eb5da4d74ea3e6a 100644 (file)
@@ -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
index a6a04bb8b2c42993477e24ee754246b6c8ee8de2..a236b866bbfb17bc43d3b306cd70091630d22deb 100644 (file)
@@ -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));
index c62c9a6ca5403d8b27f411f026e17c5558ece442..b95fc5e72081610a25a9abedf85dfa6e9afff6d1 100644 (file)
@@ -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);
 
index 840f5044a8ad7189776d25fb05d957fa3e61778f..60795becf7f2b42350161e65b23683eaa20c5b32 100644 (file)
@@ -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);
 
index 086e4114d288b3bdfc3d4364e219567991a773cd..65958f0d216c5b08c5e1d1f897bbc5018148e1bf 100644 (file)
@@ -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];
index 592085bcd9ccb0f69f1eccc8851586c7b32bd135..a558774c451dd35933405a22f40da46d439e5cea 100644 (file)
@@ -792,7 +792,7 @@ sp_canvas_group_update (SPCanvasItem *item, NR::Matrix const &affine, unsigned i
         }
     }
 
-    NR::Maybe<NR::Rect> const bounds = corners.bounds();
+    boost::optional<NR::Rect> const bounds = corners.bounds();
     if (bounds) {
         item->x1 = bounds->min()[NR::X];
         item->y1 = bounds->min()[NR::Y];
index 356fba577055c7cab0d165401117f68c68fcadc6..24b6edd20bff95e9766a4fc60002873a5f7c5a93 100644 (file)
@@ -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);
             }
index 35e220a4965b5afbf1e795b3469c52f5b0e66b1e..abe4d7dcec36cbf19ec5bf8cc959e394a62a7282 100644 (file)
@@ -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);
 
 
index 81025d2b2e3a06311f3e1a22dcaeddb918fdfda0..7f662f5265791234bff9af0c21cde9d2ae572779 100644 (file)
@@ -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);
index e7c5ac88aeee1034e2d26a75e4d52e5858e74da8..22c91e4505c8f66f508b090406fd5fcc5ac8ce9f 100644 (file)
@@ -497,7 +497,7 @@ static gint sp_event_context_private_root_handler(SPEventContext *event_context,
                 ret = TRUE;
             } else if (zoom_rb == event->button.button) {
                 zoom_rb = 0;
-                NR::Maybe<NR::Rect> const b = Inkscape::Rubberband::get()->getRectangle();
+                boost::optional<NR::Rect> const b = Inkscape::Rubberband::get()->getRectangle();
                 Inkscape::Rubberband::get()->stop();
                 if (b && !within_tolerance) {
                     desktop->set_display_area(*b, 10);
index e7620f3195c17bd1fc6a1dfef61c23c9a07df2cc..48fe3bec2afaa020dc95f81d2f7e56947a83fdab 100644 (file)
@@ -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))));
 
index 534d4bcda632f96d7dbdd618bb29620c39454b95..e206b2a68dddf9bee4adcb121e4873c2fb5f910c 100644 (file)
@@ -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;
         }
index 02c3626bf9ba9f2255e0b3ee60810cac0f178e23..959070b50948f58adb6fdfef9f7d6e200e5060ef 100644 (file)
@@ -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;
     }
index 633dc08ceea7f38dfc887d29696a7a23124bb439..b620e9c9e745c60272069c7f6274b47c8952da6d 100644 (file)
@@ -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);
index cefb3227dd29cf82583511d21903e3ffb0230c2a..af8cfbfa1df0f6c674e06364bb8c1e06dc1a8adc 100644 (file)
@@ -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) {
index b11d32f8a1d9b0ab2e89ddac684fb397be782443..0c284db68537b7428968a5303097e82efc72c1af 100644 (file)
@@ -801,7 +801,7 @@ static void sp_flood_do_flood_fill(SPEventContext *event_context, GdkEvent *even
     sp_document_ensure_up_to_date (document);
     
     SPItem *document_root = SP_ITEM(SP_DOCUMENT_ROOT(document));
-    NR::Maybe<NR::Rect> bbox = document_root->getBounds(NR::identity());
+    boost::optional<NR::Rect> bbox = document_root->getBounds(NR::identity());
 
     if (!bbox) {
         desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("<b>Area is not bounded</b>, cannot fill."));
index 9fade37ecdcb042f5b430aad95b9989a6ccfc84d..c6dd26712c10a17eb6e782dcf9358ac1852f76a9 100644 (file)
@@ -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],
index 01964b8e7794444c7967ed3d017eab37db17633d..9101fcee10a9187487c0b6bda774ba45f67ab56e 100644 (file)
@@ -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);
                         }
                     }
index 71b71b1c3c0fda3daa08def877b2b8fe14817532..1657288cced11b8990666a2b38e301b52e22363d 100644 (file)
@@ -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]);
index 9285e9618cc510350104cb8f3d758c2852cf9bd9..60cdab8146c6490e07e810a1ca915e8385a0a243 100644 (file)
@@ -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());
index dc583a645fe373e2c7fea4777b0372fdea776cc5..0ec73d81bbcb735a39ae502bd5acfa22ee6d03ed 100644 (file)
@@ -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);
index 51dabcf07f1300a8c91bf336d9156eddbc94e7ff..dafdd8840bb69c7e7cf4b23ec652ff2f938888c6 100644 (file)
@@ -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 */
index fa3c687c539d534ffba8093f00d1aa61f90873bc..4f6c5c866814b2659bb137385866b064721bd7fc 100644 (file)
@@ -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));
     }
index 18065d1d7aa627ac2ebb395f604ce2c80d49e17d..f21ba8fc6295d5847ab4f5c64a5c2176bf9b9020 100644 (file)
@@ -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);
index 04d93ae043f08d26c7a1c6f411d69af69198cca1..77af27417517d6b9dadfce6a35b7d600f74a2a10 100644 (file)
@@ -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;
     }
index da1299b2bba61ad406262d3207b8498484f57e6e..7d130fd183f2586157631b5c81eed67704ed741d 100644 (file)
@@ -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;
 };
index 5058e8e229b7428f06ff45b67849102cb4a7e722..4f745c0f946d85859d2829555e86e30f16c80a48 100644 (file)
@@ -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]);
index 2471da3dd181078ee201e034a9e60b3799e24b4b..84307c9cea2ceb1522c4f1878a3b4f4b690d9771 100644 (file)
@@ -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);
index 3ad979ccadc52e98cc6170a1d6efe891ad32035a..36c882d446d3a0b1b530b1d25dbb49c19fcf5c43 100644 (file)
@@ -116,7 +116,7 @@ void Layout::getBoundingBox(NRRect *bounding_box, NR::Matrix const &transform, i
         _getGlyphTransformMatrix(glyph_index, &glyph_matrix);
         NR::Matrix total_transform = glyph_matrix;
         total_transform *= transform;
-        NR::Maybe<NR::Rect> glyph_rect = _glyphs[glyph_index].span(this).font->BBox(_glyphs[glyph_index].glyph);
+        boost::optional<NR::Rect> glyph_rect = _glyphs[glyph_index].span(this).font->BBox(_glyphs[glyph_index].glyph);
         if (glyph_rect) {
             NR::Point bmi = glyph_rect->min(), bma = glyph_rect->max();
             NR::Point tlp(bmi[0],bmi[1]), trp(bma[0],bmi[1]), blp(bmi[0],bma[1]), brp(bma[0],bma[1]);
index 36e7be0a5fe1b61dc95824e0720af9845f94cb81..cea97ff2a9b05549dc2595c398ab8f99ca586264 100644 (file)
@@ -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. */
index 61ef1720b4056dd05d89114228b0fc582b73cc13..10e65366470a61aec66727aae904da6ec9df7f3e 100644 (file)
@@ -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]);
index e204f5df1ee2462382618562153d6be6935fff9e..f2e3438f1b2084c07bc43465c34873ceb7bff9b2 100644 (file)
@@ -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,
index d050ec458c266605d4142a65e09e4593080508f5..056bfb71a964db081c7bfac0b2c409f9dbea4da5 100644 (file)
@@ -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);
index 5e3152c03c97e44e9f4be6b32cdf559af56db5d6..86ed9ee8aa1c3f8ef7a2489c413ee55074b26390 100644 (file)
@@ -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.
index ee902d5fc08ba6e07b279f584937be637b82cfde..d06d027e314c8b3d94f931e597d0981d2bf55e7d 100644 (file)
@@ -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
 
index e5fc95dcba82c4950744dbd9832fd915bc54b021..e0adf38454f6479968fc7be2d04cc7c779fddeeb 100644 (file)
@@ -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;
 
index 6ec0ca6b405df1bea3eaccd8411d254bc1a658be..d6f0ae9e827a49c93d7257673ed8db6da96061dd 100644 (file)
@@ -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;
index bff972408c8910055f80c846d4f99f5c3489141b..d8a1ec1d7deb953f20517561dfd35d78ff8b5d2b 100644 (file)
@@ -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;
index c5a653bf0ee1d152110f1762550543ac29affdf2..017544901a7717f6e51cc4d213aaa352afb0a28a 100644 (file)
@@ -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;
 
index ac0c400d41fd8d05ee5c9380d09e496a7d4636bb..b330ff96415b9ca8a75f8b2f9e7e324e77ed24df 100644 (file)
@@ -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
index 5f65e3ff91f26b93e688d17490a5e8a4121b4456..020a4793d81f232524716ecaa52d2a4c73305880 100644 (file)
@@ -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
 {
index 6034660002c58fd7336d0bb421c41ca8b73a2c87..3784c43d0e169bd3e498cc02f5915c9e66f15f5a 100644 (file)
@@ -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;
   
index 395d4fe0e78ffb4c5a87f4933749b2a27ed1c1b0..0562123dee7595ddc667ea91a9cdfa5abd9a535e 100644 (file)
@@ -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);
index 58f88bbfbf90ac75c8ea9c6f662b93767e4673b8..73333a555278f76a182104790bd6219f2c331d34 100644 (file)
@@ -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);
index b6ef1984eec6a32fb5efe9d8a1211fb02d3e51aa..7734a65fa98d2c309d620189f57269f79437ca6c 100644 (file)
@@ -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();
 
index bac12fe802f6ec25391ba30070c1b589239043a0..2ce9a8b50222a029b7df74cac301215e4ebc8c16 100644 (file)
@@ -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;
 
index 010382376e9f7b8e3d50c6256eaaf075e6659da4..0957b8432233000c74c91fc837e741becf0bf94f 100644 (file)
@@ -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());
index a5f27038965c5962ed962473cebc3f9bc28ab7ba..114ed9c645a67470811fe9d9502201820303eab0 100644 (file)
@@ -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;
index acab9396c86bb29b758a951e8b06d9dfb888373f..b71f27815214e527d8059792c352bdf5d21b5e4c 100644 (file)
@@ -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));
index 3d45c171d95021093c98eba4aef4c098a1f61777..f02aeb456725e951382625b077d9e6d8b14b8f42 100644 (file)
@@ -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.
index c478036c7eccbdbb1097a7b7b58077fa6d9c4ae4..0b297318d613d3805cfd5382be5cd787bc5f3505 100644 (file)
@@ -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)),
index d06e0527626c7629ae65dc227ead958ffead6c73..3a7f6f4b2e60d35f9ccb58d04158a3908e1703ba 100644 (file)
@@ -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];
index c88b5eb3f453baa938ecc8ed6ea595fdfa8c9102..2b7ec4c3d64e1a24e57df6801643533092e7bdfd 100644 (file)
@@ -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);
 }
index 2a6da68c3b6f9f72622a6c6649fd9e4e1db54f51..fe95aca8fd85ad7686c4ba9c6cf807429780205b 100644 (file)
@@ -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);
index 09cdbbaba9571933b5af33eea4d3a352e8bd64f0..68f4c8465acb1c6592909a9e707d9c19c67734cf 100644 (file)
@@ -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);
index 4c5e57b73c2987a6372d38ebf3e90c93cb6924e9..966d2a5431127968a7de6089d16ed1d3bdf79024 100644 (file)
@@ -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;
 
index f79573990c285381b2593d84eee445099541ef68..cf2732b2426c2f58c8246c35c58e5b4f61f937d7 100644 (file)
@@ -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 {};
 
index 786209fdae0a4a859286a85aed84c59f45e55529..6ef3746845d650d96ee1a9da9103f6e4a06a1c6b 100644 (file)
@@ -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 {
index a4ecf1f65917fd34560998908f5b91ad06954c8d..127262540185d6abb8b2110234a333d3992cca76 100644 (file)
@@ -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);
index 8621a27b576005338c343d468184c13c52213426..f6ba68911c636ee27e5dc96905dd3e1d8a2a6877 100644 (file)
@@ -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;
     }
index 80089df35d3be643fdb5b8b4d80df64c9546ab36..186b766635f1115ee63e0817401f4fd83af249c5 100644 (file)
@@ -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) {
index 4caf155bfdad7ec4cb771e4e418dfbfb39264306..6a6ab4fc40a77034b1d674e7232c5b56d3684e8d 100644 (file)
@@ -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);
index 8f6cdc24d930c694f88acb593db742f2cac1f9ff..26258a1fe7567bd55f88c6984633b15ceede71b6 100644 (file)
@@ -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 */
index 5d717725310bd16c97408d013e58b1e500901500..b0b6d8137f4cb9ba9109b7168886c6c09bc7f4ad 100644 (file)
@@ -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;
index 39907999fd5a56392df298e7f5694b53ca5a1978..581b6acdd255ac04684488e79961bdfccbd508b3 100644 (file)
@@ -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);
index 2f8dc7c50413af972a2e6de3d6538273d34950b1..37ea2e5f5fa04dbea6534e05cb866993295b6a77 100644 (file)
@@ -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);
index 5509b7c77ed33d9a72ec9057aaf13bc3c0a14a07..054310472e5820ae5393ea40006aeadafa54eed1 100644 (file)
@@ -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);
         }
index 11044ec1aa506567606a4564e5bdfbac7294c86c..06ae89ba035ef7cee7bfe182e0d101033f90b16b 100644 (file)
@@ -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);
index 69e985ffae1a0545645365c73cffc19c5a3f9e19..ad4d9c6e0907372891547d803082333fad4fb5fe 100644 (file)
@@ -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);
 
index da69277f8e7f7c0b94d15abc0721aa0d749ae70c..0865e06cb628fe630412aa7c2c5332550ec706ad 100644 (file)
@@ -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);
                 }
index 70cd49c81e1ebf6f96e2da8c19ce598f7518c6b8..e670a2db4fe3d62a47331a7dd3bf68f6ec5fc35d 100644 (file)
@@ -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;
index 537277afc774b4a1a64bd1eb31b6193d6dd170d6..0138823277bafebc4540c00b34d6d079cf9c3aaf 100644 (file)
@@ -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) {
index 7d4820663b319e47bc1631218a1f1d5631601e75..e83907f492cb5b2e8ccb91ab132ba2382cb7b380 100644 (file)
@@ -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) {
index c29fd7c0d349afad99d8d4158acf424f41ccf554..e4fdf9604e0107d3636c552a24e8fff28fb2b586 100644 (file)
@@ -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:
 
index c726b04549ca714953f2c3aa0cc09ca1db98b8a8..a512f984979109d25eb02c1323cfc03282b6e24b 100644 (file)
@@ -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);
index 8c12df55849eefce08b997fbf0fc1a87d1a06f95..ed89bf6aaf0945bb7acd2085b7ff5af4d9d27098 100644 (file)
@@ -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");
index 638f1a70c5b3f03449214ad7c420304914a1cbc7..d4c1bb7053d7038910d1c49c32e77036947f6f04 100644 (file)
@@ -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);
index 46d33abb7f1ac2b81207ab7d14ab4e5d8d36a7ac..39081b0057b36fc4c2c8d606b1e8da92724437cd 100644 (file)
@@ -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>();
     }
 }
 
index f9c54497603b4b2763452569ec97f55e150658c9..9204a816364189189995ea2bb2ab5efd0a4c865c 100644 (file)
@@ -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);
 
index dcf8d6e71ee0f99bf95671c4f2c7d663da0f8660..ac123792db6c595975fb53bca033f16ab0170658 100644 (file)
@@ -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);
index e40ffe1d69b3cc0e61af7c37504b68ce18e4c3d0..8d7a4a2a19d57046b26037940931e13ef66a9cf4 100644 (file)
@@ -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;
     }
index 1faf7005f128f2a346fa9d83b505d0da20787b7c..20b1056143a2604fcfd42528aa0b1c50859e2d80 100644 (file)
@@ -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]);
index d89a85eaa58a36c0e3b8a252f5f786ee0e42453f..b460258edb78d5ee0f9e5912d3691aaf3cf7a78d 100644 (file)
@@ -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 )
             {
index 5a2adc8d20d3056e9d09c150c596c66979f51dec..e413aa39e04f4b0879a92c95d6046566aedbfa39 100644 (file)
@@ -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));
index 9ca705189d586fbc0041c2f3d30ef655bf090578..07b388d140127087fdd2283e75babdc92a200168 100644 (file)
@@ -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
index 71dca484642ac044c8accc0ee64899b4a60450be..56eeb69cb9e93aa0644e601826a307111023e37e 100644 (file)
@@ -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) {