From 8b9a820756fdf348239872236be2257f854e094a Mon Sep 17 00:00:00 2001 From: johanengelen Date: Tue, 5 Aug 2008 22:40:31 +0000 Subject: [PATCH] NR::Maybe => boost::optional --- src/conn-avoid-ref.cpp | 2 +- src/connector-context.cpp | 2 +- src/desktop.cpp | 6 ++-- src/dialogs/clonetiler.cpp | 2 +- src/dialogs/export.cpp | 8 ++--- src/dialogs/stroke-style.cpp | 2 +- src/dialogs/tiledialog.cpp | 16 ++++----- src/dialogs/unclump.cpp | 4 +-- src/display/inkscape-cairo.cpp | 4 +-- src/display/inkscape-cairo.h | 4 +-- src/display/nr-arena-item.cpp | 2 +- src/display/nr-arena-item.h | 4 +-- src/display/nr-arena-shape.cpp | 2 +- src/display/nr-filter-image.cpp | 2 +- src/display/sp-canvas.cpp | 2 +- src/document.cpp | 2 +- src/dyna-draw-context.cpp | 2 +- src/eraser-context.cpp | 6 ++-- src/event-context.cpp | 2 +- src/extension/internal/cairo-renderer.cpp | 2 +- src/extension/internal/grid.cpp | 2 +- src/extension/internal/odf.cpp | 6 ++-- src/file.cpp | 2 +- src/filter-chemistry.cpp | 4 +-- src/flood-context.cpp | 2 +- src/gradient-chemistry.cpp | 6 ++-- src/gradient-context.cpp | 2 +- src/gradient-drag.cpp | 2 +- src/graphlayout/graphlayout.cpp | 4 +-- src/interface.cpp | 4 +-- src/libnr/nr-convex-hull.h | 8 ++--- src/libnr/nr-rect-l.cpp | 4 +-- src/libnr/nr-rect-l.h | 6 ++-- src/libnr/nr-rect.cpp | 14 ++++---- src/libnr/nr-rect.h | 37 ++++++------------- src/libnrtype/FontInstance.cpp | 4 +-- src/libnrtype/Layout-TNG-OutIter.cpp | 2 +- src/libnrtype/Layout-TNG-Output.cpp | 2 +- src/libnrtype/Layout-TNG.h | 6 +++- src/libnrtype/RasterFont.cpp | 2 +- src/libnrtype/font-instance.h | 2 +- src/line-geometry.cpp | 10 +++--- src/line-geometry.h | 6 ++-- src/line-snapper.cpp | 4 +-- src/line-snapper.h | 4 +-- src/main.cpp | 4 +-- src/node-context.cpp | 4 +-- src/nodepath.cpp | 6 ++-- src/nodepath.h | 4 +-- src/object-snapper.cpp | 8 ++--- src/object-snapper.h | 4 +-- src/removeoverlap/removeoverlap.cpp | 2 +- src/rubberband.cpp | 4 +-- src/rubberband.h | 4 +-- src/selcue.cpp | 2 +- src/select-context.cpp | 2 +- src/selection-chemistry.cpp | 38 ++++++++++---------- src/selection.cpp | 14 ++++---- src/selection.h | 6 ++-- src/seltrans.cpp | 4 +-- src/seltrans.h | 8 ++--- src/shape-editor.cpp | 2 +- src/shape-editor.h | 4 +-- src/snap.cpp | 8 ++--- src/snap.h | 8 ++--- src/snapper.h | 6 ++-- src/sp-conn-end-pair.cpp | 2 +- src/sp-conn-end.cpp | 4 +-- src/sp-flowtext.cpp | 2 +- src/sp-item-group.cpp | 2 +- src/sp-item-transform.cpp | 4 +-- src/sp-item-transform.h | 2 +- src/sp-item.cpp | 40 ++++++++++----------- src/sp-item.h | 8 ++--- src/sp-offset.cpp | 2 +- src/sp-shape.cpp | 4 +-- src/splivarot.cpp | 6 ++-- src/splivarot.h | 2 +- src/text-context.cpp | 4 +-- src/tweak-context.cpp | 6 ++-- src/ui/clipboard.cpp | 8 ++--- src/ui/dialog/align-and-distribute.cpp | 24 ++++++------- src/ui/dialog/align-and-distribute.h | 2 +- src/ui/dialog/filedialogimpl-win32.cpp | 2 +- src/ui/dialog/transformation.cpp | 30 ++++++++-------- src/ui/widget/object-composite-settings.cpp | 4 +-- src/ui/widget/style-subject.cpp | 8 ++--- src/ui/widget/style-subject.h | 8 ++--- src/vanishing-point.cpp | 2 +- src/verbs.cpp | 2 +- src/widgets/font-selector.cpp | 2 +- src/widgets/icon.cpp | 2 +- src/widgets/select-toolbar.cpp | 4 +-- src/widgets/toolbox.cpp | 4 +-- src/zoom-context.cpp | 2 +- 95 files changed, 271 insertions(+), 284 deletions(-) diff --git a/src/conn-avoid-ref.cpp b/src/conn-avoid-ref.cpp index 7e764788d..2eb1f441e 100644 --- a/src/conn-avoid-ref.cpp +++ b/src/conn-avoid-ref.cpp @@ -193,7 +193,7 @@ static Avoid::Polygn avoid_item_poly(SPItem const *item) // by the sp_*_update functions, e.g., text. sp_document_ensure_up_to_date(item->document); - NR::Maybe rHull = item->getBounds(from_2geom(sp_item_i2doc_affine(item))); + boost::optional rHull = item->getBounds(from_2geom(sp_item_i2doc_affine(item))); if (!rHull) { return Avoid::newPoly(0); } diff --git a/src/connector-context.cpp b/src/connector-context.cpp index 1a77008f1..5e2cdc2b8 100644 --- a/src/connector-context.cpp +++ b/src/connector-context.cpp @@ -1148,7 +1148,7 @@ static void cc_set_active_shape(SPConnectorContext *cc, SPItem *item) } - NR::Maybe bbox = sp_item_bbox_desktop(cc->active_shape); + boost::optional bbox = sp_item_bbox_desktop(cc->active_shape); if (bbox) { NR::Point center = bbox->midpoint(); sp_knot_set_position(cc->connpthandle, center, 0); diff --git a/src/desktop.cpp b/src/desktop.cpp index b8d9ef0b0..54285c083 100644 --- a/src/desktop.cpp +++ b/src/desktop.cpp @@ -529,7 +529,7 @@ bool SPDesktop::isLayer(SPObject *object) const { bool SPDesktop::isWithinViewport (SPItem *item) const { NR::Rect const viewport = get_display_area(); - NR::Maybe const bbox = sp_item_bbox_desktop(item); + boost::optional 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 const d = selection->bounds(); + boost::optional 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 d = sp_item_bbox_desktop(docitem); + boost::optional d = sp_item_bbox_desktop(docitem); /* Note that the second condition here indicates that ** there are no items in the drawing. diff --git a/src/dialogs/clonetiler.cpp b/src/dialogs/clonetiler.cpp index 65c8fba02..07b146fca 100644 --- a/src/dialogs/clonetiler.cpp +++ b/src/dialogs/clonetiler.cpp @@ -1242,7 +1242,7 @@ clonetiler_apply( GtkWidget */*widget*/, void * ) int prefs_bbox = prefs_get_int_attribute("tools", "bounding_box", 0); SPItem::BBoxType bbox_type = (prefs_bbox ==0)? SPItem::APPROXIMATE_BBOX : SPItem::GEOMETRIC_BBOX; - NR::Maybe r = SP_ITEM(obj)->getBounds(from_2geom(sp_item_i2doc_affine(SP_ITEM(obj))), + boost::optional r = SP_ITEM(obj)->getBounds(from_2geom(sp_item_i2doc_affine(SP_ITEM(obj))), bbox_type); if (r) { w = r->dimensions()[NR::X]; diff --git a/src/dialogs/export.cpp b/src/dialogs/export.cpp index 0e2a08eb4..bd4493eae 100644 --- a/src/dialogs/export.cpp +++ b/src/dialogs/export.cpp @@ -780,7 +780,7 @@ sp_export_selection_modified ( Inkscape::Application */*inkscape*/, if ( SP_ACTIVE_DESKTOP ) { SPDocument *doc; doc = sp_desktop_document (SP_ACTIVE_DESKTOP); - NR::Maybe bbox = sp_item_bbox_desktop (SP_ITEM (SP_DOCUMENT_ROOT (doc))); + boost::optional 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 bbox; + boost::optional 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 bbox = (sp_desktop_selection (SP_ACTIVE_DESKTOP))->bounds(); + boost::optional 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 bbox = sp_item_bbox_desktop (SP_ITEM (SP_DOCUMENT_ROOT (doc))); + boost::optional bbox = sp_item_bbox_desktop (SP_ITEM (SP_DOCUMENT_ROOT (doc))); // std::cout << "Drawing " << bbox2; if ( bbox && sp_export_bbox_equal(*bbox,current_bbox) ) { diff --git a/src/dialogs/stroke-style.cpp b/src/dialogs/stroke-style.cpp index 7d9aa84a6..ae387e5f8 100644 --- a/src/dialogs/stroke-style.cpp +++ b/src/dialogs/stroke-style.cpp @@ -615,7 +615,7 @@ sp_marker_prev_new(unsigned psize, gchar const *mname, // Find object's bbox in document Geom::Matrix const i2doc(sp_item_i2doc_affine(SP_ITEM(object))); - NR::Maybe dbox = SP_ITEM(object)->getBounds(from_2geom(i2doc)); + boost::optional dbox = SP_ITEM(object)->getBounds(from_2geom(i2doc)); if (!dbox) { return NULL; diff --git a/src/dialogs/tiledialog.cpp b/src/dialogs/tiledialog.cpp index 0c37e5ac0..f9bde3c0b 100644 --- a/src/dialogs/tiledialog.cpp +++ b/src/dialogs/tiledialog.cpp @@ -49,8 +49,8 @@ sp_compare_x_position(SPItem *first, SPItem *second) using NR::X; using NR::Y; - NR::Maybe a = first->getBounds(from_2geom(sp_item_i2doc_affine(first))); - NR::Maybe b = second->getBounds(from_2geom(sp_item_i2doc_affine(second))); + boost::optional a = first->getBounds(from_2geom(sp_item_i2doc_affine(first))); + boost::optional 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 a = first->getBounds(from_2geom(sp_item_i2doc_affine(first))); - NR::Maybe b = second->getBounds(from_2geom(sp_item_i2doc_affine(second))); + boost::optional a = first->getBounds(from_2geom(sp_item_i2doc_affine(first))); + boost::optional 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 b = item->getBounds(from_2geom(sp_item_i2doc_affine(item))); + boost::optional 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 b = item->getBounds(from_2geom(sp_item_i2doc_affine(item))); + boost::optional 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 sel_bbox = selection->bounds(); + boost::optional 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 b = item->getBounds(from_2geom(sp_item_i2doc_affine(item))); + boost::optional b = item->getBounds(from_2geom(sp_item_i2doc_affine(item))); NR::Point min; if (b) { width = b->dimensions()[NR::X]; diff --git a/src/dialogs/unclump.cpp b/src/dialogs/unclump.cpp index 73131384f..923c44add 100644 --- a/src/dialogs/unclump.cpp +++ b/src/dialogs/unclump.cpp @@ -35,7 +35,7 @@ unclump_center (SPItem *item) return i->second; } - NR::Maybe r = item->getBounds(from_2geom(sp_item_i2d_affine(item))); + boost::optional 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 r = item->getBounds(from_2geom(sp_item_i2d_affine(item))); + boost::optional r = item->getBounds(from_2geom(sp_item_i2d_affine(item))); if (r) { wh = r->dimensions(); wh_cache[SP_OBJECT_ID(item)] = wh; diff --git a/src/display/inkscape-cairo.cpp b/src/display/inkscape-cairo.cpp index 8bc9eade2..33a84d508 100644 --- a/src/display/inkscape-cairo.cpp +++ b/src/display/inkscape-cairo.cpp @@ -170,7 +170,7 @@ feed_path_to_cairo (cairo_t *ct, Geom::Path const &path) /** Feeds path-creating calls to the cairo context translating them from the Path, with the given transform and shift */ static void -feed_path_to_cairo (cairo_t *ct, Geom::Path const &path, Geom::Matrix trans, NR::Maybe area, bool optimize_stroke, double stroke_width) +feed_path_to_cairo (cairo_t *ct, Geom::Path const &path, Geom::Matrix trans, boost::optional 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 area, bool optimize_stroke, double stroke_width) +feed_pathvector_to_cairo (cairo_t *ct, Geom::PathVector const &pathv, Geom::Matrix trans, boost::optional area, bool optimize_stroke, double stroke_width) { if (!area || area->isEmpty()) return; diff --git a/src/display/inkscape-cairo.h b/src/display/inkscape-cairo.h index 03bf50cb5..f3be94464 100644 --- a/src/display/inkscape-cairo.h +++ b/src/display/inkscape-cairo.h @@ -13,7 +13,7 @@ #include <2geom/forward.h> #include -#include "libnr/nr-maybe.h" +#include #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 area, bool optimize_stroke, double stroke_width); +void feed_pathvector_to_cairo (cairo_t *ct, Geom::PathVector const &pathv, Geom::Matrix trans, boost::optional area, bool optimize_stroke, double stroke_width); void feed_pathvector_to_cairo (cairo_t *ct, Geom::PathVector const &pathv); #endif diff --git a/src/display/nr-arena-item.cpp b/src/display/nr-arena-item.cpp index a6a04bb8b..a236b866b 100644 --- a/src/display/nr-arena-item.cpp +++ b/src/display/nr-arena-item.cpp @@ -836,7 +836,7 @@ nr_arena_item_set_order (NRArenaItem *item, int order) } void -nr_arena_item_set_item_bbox (NRArenaItem *item, NR::Maybe &bbox) +nr_arena_item_set_item_bbox (NRArenaItem *item, boost::optional &bbox) { nr_return_if_fail(item != NULL); nr_return_if_fail(NR_IS_ARENA_ITEM(item)); diff --git a/src/display/nr-arena-item.h b/src/display/nr-arena-item.h index c62c9a6ca..b95fc5e72 100644 --- a/src/display/nr-arena-item.h +++ b/src/display/nr-arena-item.h @@ -91,7 +91,7 @@ struct NRArenaItem : public NRObject { NRRectL bbox; /* BBox in item coordinates - this should be a bounding box as * specified in SVG standard. Required by filters. */ - NR::Maybe item_bbox; + boost::optional 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 &bbox); +void nr_arena_item_set_item_bbox (NRArenaItem *item, boost::optional &bbox); NRPixBlock *nr_arena_item_get_background (NRArenaItem const *item, int depth = 0); diff --git a/src/display/nr-arena-shape.cpp b/src/display/nr-arena-shape.cpp index 840f5044a..60795becf 100644 --- a/src/display/nr-arena-shape.cpp +++ b/src/display/nr-arena-shape.cpp @@ -716,7 +716,7 @@ nr_arena_shape_add_bboxes(NRArenaShape* shape, Geom::Rect &bbox) // cairo outline rendering: static unsigned int -cairo_arena_shape_render_outline(cairo_t *ct, NRArenaItem *item, NR::Maybe area) +cairo_arena_shape_render_outline(cairo_t *ct, NRArenaItem *item, boost::optional area) { NRArenaShape *shape = NR_ARENA_SHAPE(item); diff --git a/src/display/nr-filter-image.cpp b/src/display/nr-filter-image.cpp index 086e4114d..65958f0d2 100644 --- a/src/display/nr-filter-image.cpp +++ b/src/display/nr-filter-image.cpp @@ -62,7 +62,7 @@ int FilterImage::render(FilterSlot &slot, FilterUnits const &units) { Matrix identity(1.0, 0.0, 0.0, 1.0, 0.0, 0.0); - NR::Maybe area = SVGElem->getBounds(identity); + boost::optional area = SVGElem->getBounds(identity); NRRectL rect; rect.x0=area->min()[NR::X]; diff --git a/src/display/sp-canvas.cpp b/src/display/sp-canvas.cpp index 592085bcd..a558774c4 100644 --- a/src/display/sp-canvas.cpp +++ b/src/display/sp-canvas.cpp @@ -792,7 +792,7 @@ sp_canvas_group_update (SPCanvasItem *item, NR::Matrix const &affine, unsigned i } } - NR::Maybe const bounds = corners.bounds(); + boost::optional const bounds = corners.bounds(); if (bounds) { item->x1 = bounds->min()[NR::X]; item->y1 = bounds->min()[NR::Y]; diff --git a/src/document.cpp b/src/document.cpp index 356fba577..24b6edd20 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -900,7 +900,7 @@ static GSList *find_items_in_area(GSList *s, SPGroup *group, unsigned int dkey, s = find_items_in_area(s, SP_GROUP(o), dkey, area, test); } else { SPItem *child = SP_ITEM(o); - NR::Maybe box = sp_item_bbox_desktop(child); + boost::optional box = sp_item_bbox_desktop(child); if ( box && test(area, *box) && (take_insensitive || child->isVisibleAndUnlocked(dkey))) { s = g_slist_append(s, child); } diff --git a/src/dyna-draw-context.cpp b/src/dyna-draw-context.cpp index 35e220a49..abe4d7dce 100644 --- a/src/dyna-draw-context.cpp +++ b/src/dyna-draw-context.cpp @@ -607,7 +607,7 @@ sp_dyna_draw_context_root_handler(SPEventContext *event_context, pointer = motion_dt * motion_to_curve; // calculate the nearest point on the guide path - NR::Maybe position = get_nearest_position_on_Path(dc->hatch_livarot_path, pointer); + boost::optional position = get_nearest_position_on_Path(dc->hatch_livarot_path, pointer); nearest = get_point_on_Path(dc->hatch_livarot_path, position->piece, position->t); diff --git a/src/eraser-context.cpp b/src/eraser-context.cpp index 81025d2b2..7f662f526 100644 --- a/src/eraser-context.cpp +++ b/src/eraser-context.cpp @@ -557,7 +557,7 @@ sp_eraser_context_root_handler(SPEventContext *event_context, if (dc->dragging && event->button.button == 1 && !event_context->space_panning) { dc->dragging = FALSE; - NR::Maybe const b = Inkscape::Rubberband::get()->getRectangle(); + boost::optional 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 eraserBbox = acid->getBounds(NR::identity()); + boost::optional eraserBbox = acid->getBounds(NR::identity()); NR::Rect bounds = (*eraserBbox) * desktop->doc2dt(); std::vector 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 bbox = item->getBounds(NR::identity()); + boost::optional bbox = item->getBounds(NR::identity()); if (bbox && bbox->intersects(*eraserBbox)) { Inkscape::XML::Node* dup = dc->repr->duplicate(xml_doc); dc->repr->parent()->appendChild(dup); diff --git a/src/event-context.cpp b/src/event-context.cpp index e7c5ac88a..22c91e450 100644 --- a/src/event-context.cpp +++ b/src/event-context.cpp @@ -497,7 +497,7 @@ static gint sp_event_context_private_root_handler(SPEventContext *event_context, ret = TRUE; } else if (zoom_rb == event->button.button) { zoom_rb = 0; - NR::Maybe const b = Inkscape::Rubberband::get()->getRectangle(); + boost::optional const b = Inkscape::Rubberband::get()->getRectangle(); Inkscape::Rubberband::get()->stop(); if (b && !within_tolerance) { desktop->set_display_area(*b, 10); diff --git a/src/extension/internal/cairo-renderer.cpp b/src/extension/internal/cairo-renderer.cpp index e7620f319..48fe3bec2 100644 --- a/src/extension/internal/cairo-renderer.cpp +++ b/src/extension/internal/cairo-renderer.cpp @@ -409,7 +409,7 @@ static void sp_asbitmap_render(SPItem *item, CairoRenderContext *ctx) Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document); // Get the bounding box of the selection - //NR::Maybe _bbox = item->getBounds(from_2geom(sp_item_i2d_affine(item))); + //boost::optional _bbox = item->getBounds(from_2geom(sp_item_i2d_affine(item))); // NRRect bbox = item->getBounds(from_2geom(sp_item_i2d_affine(item))); NRRect bbox(item->getBounds(from_2geom(sp_item_i2d_affine(item)))); diff --git a/src/extension/internal/grid.cpp b/src/extension/internal/grid.cpp index 534d4bcda..e206b2a68 100644 --- a/src/extension/internal/grid.cpp +++ b/src/extension/internal/grid.cpp @@ -86,7 +86,7 @@ Grid::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View *doc NR::Point(sp_document_width(doc), sp_document_height(doc))); } else { - NR::Maybe bounds = selection->bounds(); + boost::optional bounds = selection->bounds(); if (bounds) { bounding_area = *bounds; } diff --git a/src/extension/internal/odf.cpp b/src/extension/internal/odf.cpp index 02c3626bf..959070b50 100644 --- a/src/extension/internal/odf.cpp +++ b/src/extension/internal/odf.cpp @@ -962,9 +962,9 @@ static NR::Matrix getODFTransform(const SPItem *item) * Get the bounding box of an item, as mapped onto * an ODF document, in cm. */ -static NR::Maybe getODFBoundingBox(const SPItem *item) +static boost::optional getODFBoundingBox(const SPItem *item) { - NR::Maybe bbox = sp_item_bbox_desktop((SPItem *)item); + boost::optional 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 bbox = getODFBoundingBox(item); + boost::optional bbox = getODFBoundingBox(item); if (!bbox) { return true; } diff --git a/src/file.cpp b/src/file.cpp index 633dc08ce..b620e9c9e 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -978,7 +978,7 @@ file_import(SPDocument *in_doc, const Glib::ustring &uri, int const saved_pref = prefs_get_int_attribute("options.transform", "pattern", 1); prefs_set_int_attribute("options.transform", "pattern", 1); sp_document_ensure_up_to_date(sp_desktop_document(desktop)); - NR::Maybe sel_bbox = selection->bounds(); + boost::optional sel_bbox = selection->bounds(); if (sel_bbox) { NR::Point m( desktop->point() - sel_bbox->midpoint() ); sp_selection_move_relative(selection, m); diff --git a/src/filter-chemistry.cpp b/src/filter-chemistry.cpp index cefb3227d..af8cfbfa1 100644 --- a/src/filter-chemistry.cpp +++ b/src/filter-chemistry.cpp @@ -319,7 +319,7 @@ new_filter_blend_gaussian_blur (SPDocument *document, const char *blendmode, gdo SPFilter * new_filter_simple_from_item (SPDocument *document, SPItem *item, const char *mode, gdouble radius) { - NR::Maybe const r = sp_item_bbox_desktop(item, SPItem::GEOMETRIC_BBOX); + boost::optional 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 const r = sp_item_bbox_desktop(item, SPItem::GEOMETRIC_BBOX); + boost::optional const r = sp_item_bbox_desktop(item, SPItem::GEOMETRIC_BBOX); double width; double height; if (r) { diff --git a/src/flood-context.cpp b/src/flood-context.cpp index b11d32f8a..0c284db68 100644 --- a/src/flood-context.cpp +++ b/src/flood-context.cpp @@ -801,7 +801,7 @@ static void sp_flood_do_flood_fill(SPEventContext *event_context, GdkEvent *even sp_document_ensure_up_to_date (document); SPItem *document_root = SP_ITEM(SP_DOCUMENT_ROOT(document)); - NR::Maybe bbox = document_root->getBounds(NR::identity()); + boost::optional bbox = document_root->getBounds(NR::identity()); if (!bbox) { desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Area is not bounded, cannot fill.")); diff --git a/src/gradient-chemistry.cpp b/src/gradient-chemistry.cpp index 9fade37ec..c6dd26712 100644 --- a/src/gradient-chemistry.cpp +++ b/src/gradient-chemistry.cpp @@ -281,7 +281,7 @@ sp_gradient_reset_to_userspace (SPGradient *gr, SPItem *item) // calculate the bbox of the item sp_document_ensure_up_to_date(SP_OBJECT_DOCUMENT(item)); - NR::Maybe bbox = item->getBounds(NR::identity()); // we need "true" bbox without item_i2d_affine + boost::optional 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 bbox = item->getBounds(NR::identity()); // we need "true" bbox without item_i2d_affine + boost::optional 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 bbox = item->getBounds(NR::identity()); // we need "true" bbox without item_i2d_affine + boost::optional bbox = item->getBounds(NR::identity()); // we need "true" bbox without item_i2d_affine if (bbox) { p *= NR::Matrix(bbox->dimensions()[NR::X], 0, 0, bbox->dimensions()[NR::Y], diff --git a/src/gradient-context.cpp b/src/gradient-context.cpp index 01964b8e7..9101fcee1 100644 --- a/src/gradient-context.cpp +++ b/src/gradient-context.cpp @@ -641,7 +641,7 @@ sp_gradient_context_root_handler(SPEventContext *event_context, GdkEvent *event) if (r->is_started() && !event_context->within_tolerance) { // this was a rubberband drag if (r->getMode() == RUBBERBAND_MODE_RECT) { - NR::Maybe const b = r->getRectangle(); + boost::optional const b = r->getRectangle(); drag->selectRect(*b); } } diff --git a/src/gradient-drag.cpp b/src/gradient-drag.cpp index 71b71b1c3..1657288cc 100644 --- a/src/gradient-drag.cpp +++ b/src/gradient-drag.cpp @@ -1723,7 +1723,7 @@ GrDrag::updateLevels () for (GSList const* i = this->selection->itemList(); i != NULL; i = i->next) { SPItem *item = SP_ITEM(i->data); - NR::Maybe rect = sp_item_bbox_desktop (item); + boost::optional rect = sp_item_bbox_desktop (item); if (rect) { // Remember the edges of the bbox and the center axis hor_levels.push_back(rect->min()[NR::Y]); diff --git a/src/graphlayout/graphlayout.cpp b/src/graphlayout/graphlayout.cpp index 9285e9618..60cdab814 100644 --- a/src/graphlayout/graphlayout.cpp +++ b/src/graphlayout/graphlayout.cpp @@ -124,7 +124,7 @@ void graphlayout(GSList const *const items) { ++i) { SPItem *u=*i; - NR::Maybe const item_box(sp_item_bbox_desktop(u)); + boost::optional 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::iterator i=nodelookup.find(u->id); if(i!=nodelookup.end()) { Rectangle* r=rs[i->second]; - NR::Maybe item_box(sp_item_bbox_desktop(u)); + boost::optional item_box(sp_item_bbox_desktop(u)); if(item_box) { NR::Point const curr(item_box->midpoint()); NR::Point const dest(r->getCentreX(),r->getCentreY()); diff --git a/src/interface.cpp b/src/interface.cpp index dc583a645..0ec73d81b 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -1180,7 +1180,7 @@ sp_ui_drag_data_received(GtkWidget *widget, Path *livarot_path = Path_for_item(item, true, true); livarot_path->ConvertWithBackData(0.04); - NR::Maybe position = get_nearest_position_on_Path(livarot_path, button_doc); + boost::optional 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 sel_bbox = selection->bounds(); + boost::optional sel_bbox = selection->bounds(); if (sel_bbox) { NR::Point m( desktop->point() - sel_bbox->midpoint() ); sp_selection_move_relative(selection, m); diff --git a/src/libnr/nr-convex-hull.h b/src/libnr/nr-convex-hull.h index 51dabcf07..dafdd8840 100644 --- a/src/libnr/nr-convex-hull.h +++ b/src/libnr/nr-convex-hull.h @@ -20,11 +20,11 @@ public: ConvexHull() : _bounds() {} explicit ConvexHull(Point const &p) : _bounds(Rect(p, p)) {} - Maybe midpoint() const { + boost::optional midpoint() const { if (_bounds) { return _bounds->midpoint(); } else { - return Nothing(); + return boost::optional(); } } @@ -46,12 +46,12 @@ public: } } - Maybe const &bounds() const { + boost::optional const &bounds() const { return _bounds; } private: - Maybe _bounds; + boost::optional _bounds; }; } /* namespace NR */ diff --git a/src/libnr/nr-rect-l.cpp b/src/libnr/nr-rect-l.cpp index fa3c687c5..4f6c5c866 100644 --- a/src/libnr/nr-rect-l.cpp +++ b/src/libnr/nr-rect-l.cpp @@ -1,8 +1,8 @@ #include -NR::Maybe NRRectL::upgrade() const { +boost::optional NRRectL::upgrade() const { if (nr_rect_l_test_empty_ptr(this)) { - return NR::Nothing(); + return boost::optional(); } else { return NR::Rect(NR::Point(x0, y0), NR::Point(x1, y1)); } diff --git a/src/libnr/nr-rect-l.h b/src/libnr/nr-rect-l.h index 18065d1d7..f21ba8fc6 100644 --- a/src/libnr/nr-rect-l.h +++ b/src/libnr/nr-rect-l.h @@ -2,12 +2,12 @@ #define SEEN_NR_RECT_L_H #include -#include +#include #include #include struct NRRectL { - NR::Maybe upgrade() const; + boost::optional 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 intersection(const IRect &a, const IRect &b); + static boost::optional intersection(const IRect &a, const IRect &b); /** Returns the smallest rectangle that encloses both rectangles. */ static IRect union_bounds(const IRect &a, const IRect &b); diff --git a/src/libnr/nr-rect.cpp b/src/libnr/nr-rect.cpp index 04d93ae04..77af27417 100644 --- a/src/libnr/nr-rect.cpp +++ b/src/libnr/nr-rect.cpp @@ -17,7 +17,7 @@ NRRect::NRRect(NR::Rect const &rect) x1(rect.max()[NR::X]), y1(rect.max()[NR::Y]) {} -NRRect::NRRect(NR::Maybe const &rect) { +NRRect::NRRect(boost::optional const &rect) { if (rect) { x0 = rect->min()[NR::X]; y0 = rect->min()[NR::Y]; @@ -28,9 +28,9 @@ NRRect::NRRect(NR::Maybe const &rect) { } } -NR::Maybe NRRect::upgrade() const { +boost::optional NRRect::upgrade() const { if (nr_rect_d_test_empty_ptr(this)) { - return NR::Nothing(); + return boost::optional(); } 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 intersection(Maybe const & a, Maybe const & b) { +boost::optional intersection(boost::optional const & a, boost::optional const & b) { if ( !a || !b ) { - return Nothing(); + return boost::optional(); } 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(); + } } return r; } diff --git a/src/libnr/nr-rect.h b/src/libnr/nr-rect.h index da1299b2b..7d130fd18 100644 --- a/src/libnr/nr-rect.h +++ b/src/libnr/nr-rect.h @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include @@ -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::infinity(); @@ -180,47 +180,30 @@ private: Point _min, _max; - friend class MaybeStorage; - friend Maybe intersection(Maybe const &, Maybe const &); + friend boost::optional intersection(boost::optional const &, boost::optional const &); friend Rect union_bounds(Rect const &, Rect const &); }; -template <> -class MaybeStorage { -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 intersection(Maybe const & a, Maybe const & b); +boost::optional intersection(boost::optional const & a, boost::optional const & b); /** Returns the smallest rectangle that encloses both rectangles. */ Rect union_bounds(Rect const &a, Rect const &b); -inline Rect union_bounds(Maybe const & a, Rect const &b) { +inline Rect union_bounds(boost::optional const & a, Rect const &b) { if (a) { return union_bounds(*a, b); } else { return b; } } -inline Rect union_bounds(Rect const &a, Maybe const & b) { +inline Rect union_bounds(Rect const &a, boost::optional const & b) { if (b) { return union_bounds(a, *b); } else { return a; } } -inline Maybe union_bounds(Maybe const & a, Maybe const & b) +inline boost::optional union_bounds(boost::optional const & a, boost::optional 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 const &rect); - operator NR::Maybe() const { return upgrade(); } - NR::Maybe upgrade() const; + explicit NRRect(boost::optional const &rect); + operator boost::optional() const { return upgrade(); } + boost::optional upgrade() const; NR::Coord x0, y0, x1, y1; }; diff --git a/src/libnrtype/FontInstance.cpp b/src/libnrtype/FontInstance.cpp index 5058e8e22..4f745c0f9 100644 --- a/src/libnrtype/FontInstance.cpp +++ b/src/libnrtype/FontInstance.cpp @@ -613,7 +613,7 @@ bool font_instance::FontSlope(double &run, double &rise) return true; } -NR::Maybe font_instance::BBox(int glyph_id) +boost::optional 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 font_instance::BBox(int glyph_id) no=id_to_no[glyph_id]; } if ( no < 0 ) { - return NR::Nothing(); + return boost::optional(); } else { NR::Point rmin(glyphs[no].bbox[0],glyphs[no].bbox[1]); NR::Point rmax(glyphs[no].bbox[2],glyphs[no].bbox[3]); diff --git a/src/libnrtype/Layout-TNG-OutIter.cpp b/src/libnrtype/Layout-TNG-OutIter.cpp index 2471da3dd..84307c9ce 100644 --- a/src/libnrtype/Layout-TNG-OutIter.cpp +++ b/src/libnrtype/Layout-TNG-OutIter.cpp @@ -201,7 +201,7 @@ Layout::iterator Layout::sourceToIterator(void *source_cookie) const return sourceToIterator(source_cookie, Glib::ustring::const_iterator(std::string::const_iterator(NULL))); } -NR::Maybe Layout::glyphBoundingBox(iterator const &it, double *rotation) const +boost::optional Layout::glyphBoundingBox(iterator const &it, double *rotation) const { if (rotation) *rotation = _glyphs[it._glyph_index].rotation; return _glyphs[it._glyph_index].span(this).font->BBox(_glyphs[it._glyph_index].glyph); diff --git a/src/libnrtype/Layout-TNG-Output.cpp b/src/libnrtype/Layout-TNG-Output.cpp index 3ad979cca..36c882d44 100644 --- a/src/libnrtype/Layout-TNG-Output.cpp +++ b/src/libnrtype/Layout-TNG-Output.cpp @@ -116,7 +116,7 @@ void Layout::getBoundingBox(NRRect *bounding_box, NR::Matrix const &transform, i _getGlyphTransformMatrix(glyph_index, &glyph_matrix); NR::Matrix total_transform = glyph_matrix; total_transform *= transform; - NR::Maybe glyph_rect = _glyphs[glyph_index].span(this).font->BBox(_glyphs[glyph_index].glyph); + boost::optional glyph_rect = _glyphs[glyph_index].span(this).font->BBox(_glyphs[glyph_index].glyph); if (glyph_rect) { NR::Point bmi = glyph_rect->min(), bma = glyph_rect->max(); NR::Point tlp(bmi[0],bmi[1]), trp(bma[0],bmi[1]), blp(bmi[0],bma[1]), brp(bma[0],bma[1]); diff --git a/src/libnrtype/Layout-TNG.h b/src/libnrtype/Layout-TNG.h index 36e7be0a5..cea97ff2a 100644 --- a/src/libnrtype/Layout-TNG.h +++ b/src/libnrtype/Layout-TNG.h @@ -11,6 +11,9 @@ #ifndef __LAYOUT_TNG_H__ #define __LAYOUT_TNG_H__ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif #include "libnr/nr-rect.h" #include "libnr/nr-matrix.h" #include "libnr/nr-matrix-ops.h" @@ -19,6 +22,7 @@ #include #include #include +#include #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 glyphBoundingBox(iterator const &it, double *rotation) const; + boost::optional glyphBoundingBox(iterator const &it, double *rotation) const; /** Returns the zero-based line number of the character pointed to by \a it. */ diff --git a/src/libnrtype/RasterFont.cpp b/src/libnrtype/RasterFont.cpp index 61ef1720b..10e653664 100644 --- a/src/libnrtype/RasterFont.cpp +++ b/src/libnrtype/RasterFont.cpp @@ -107,7 +107,7 @@ void raster_font::BBox(int glyph_id,NRRect *area) { area->x0=area->y0=area->x1=area->y1=0; if ( daddy == NULL ) return; - NR::Maybe res=daddy->BBox(glyph_id); + boost::optional res=daddy->BBox(glyph_id); if (res) { NR::Point bmi=res->min(),bma=res->max(); NR::Point tlp(bmi[0],bmi[1]),trp(bma[0],bmi[1]),blp(bmi[0],bma[1]),brp(bma[0],bma[1]); diff --git a/src/libnrtype/font-instance.h b/src/libnrtype/font-instance.h index e204f5df1..f2e3438f1 100644 --- a/src/libnrtype/font-instance.h +++ b/src/libnrtype/font-instance.h @@ -77,7 +77,7 @@ public: bool FontMetrics(double &ascent, double &descent, double &leading); bool FontSlope(double &run, double &rise); // for generating slanted cursors for oblique fonts - NR::Maybe BBox(int glyph_id); + boost::optional BBox(int glyph_id); // creates a rasterfont for the given style raster_font* RasterFont(NR::Matrix const &trs, double stroke_width, diff --git a/src/line-geometry.cpp b/src/line-geometry.cpp index d050ec458..056bfb71a 100644 --- a/src/line-geometry.cpp +++ b/src/line-geometry.cpp @@ -52,9 +52,9 @@ Line &Line::operator=(Line const &line) { return *this; } -NR::Maybe Line::intersect(Line const &line) { +boost::optional Line::intersect(Line const &line) { NR::Coord denom = NR::dot(v_dir, line.normal); - NR::Maybe no_point = NR::Nothing(); + boost::optional 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 result = this->intersect(Line(pt, (this->v_dir).ccw(), false)); + boost::optional 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 Line::intersection_with_viewbox (SPDesktop *desktop) +boost::optional Line::intersection_with_viewbox (SPDesktop *desktop) { NR::Rect vb = desktop->get_display_area(); /* remaining viewbox corners */ @@ -188,7 +188,7 @@ NR::Maybe Line::intersection_with_viewbox (SPDesktop *desktop) std::pair 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(); } Line line (e.first, e.second); diff --git a/src/line-geometry.h b/src/line-geometry.h index 5e3152c03..86ed9ee8a 100644 --- a/src/line-geometry.h +++ b/src/line-geometry.h @@ -14,7 +14,7 @@ #include "libnr/nr-point.h" #include "libnr/nr-point-fns.h" -#include "libnr/nr-maybe.h" +#include #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 intersect(Line const &line); + virtual boost::optional 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 intersection_with_viewbox (SPDesktop *desktop); + boost::optional intersection_with_viewbox (SPDesktop *desktop); inline bool lie_on_same_side (NR::Point const &A, NR::Point const &B) { /* If A is a point in the plane and n is the normal vector of the line then the sign of dot(A, n) specifies the half-plane in which A lies. diff --git a/src/line-snapper.cpp b/src/line-snapper.cpp index ee902d5fc..d06d027e3 100644 --- a/src/line-snapper.cpp +++ b/src/line-snapper.cpp @@ -27,7 +27,7 @@ void Inkscape::LineSnapper::freeSnap(SnappedConstraints &sc, Inkscape::Snapper::PointType const &t, NR::Point const &p, bool const &/*f*/, - NR::Maybe const &/*bbox_to_snap*/, + boost::optional const &/*bbox_to_snap*/, std::vector const */*it*/, std::vector */*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 const &/*bbox_to_snap*/, + boost::optional const &/*bbox_to_snap*/, ConstraintLine const &c, std::vector const */*it*/) const diff --git a/src/line-snapper.h b/src/line-snapper.h index e5fc95dcb..e0adf3845 100644 --- a/src/line-snapper.h +++ b/src/line-snapper.h @@ -25,7 +25,7 @@ public: Inkscape::Snapper::PointType const &t, NR::Point const &p, bool const &first_point, - NR::Maybe const &bbox_to_snap, + boost::optional const &bbox_to_snap, std::vector const *it, std::vector *unselected_nodes) const; @@ -33,7 +33,7 @@ public: Inkscape::Snapper::PointType const &t, NR::Point const &p, bool const &first_point, - NR::Maybe const &bbox_to_snap, + boost::optional const &bbox_to_snap, ConstraintLine const &c, std::vector const *it) const; diff --git a/src/main.cpp b/src/main.cpp index 6ec0ca6b4..d6f0ae9e8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -920,7 +920,7 @@ do_query_dimension (SPDocument *doc, bool extent, NR::Dim2 const axis, const gch SPItem *item = ((SPItem *) o); // "true" SVG bbox for scripting - NR::Maybe area = item->getBounds(from_2geom(sp_item_i2doc_affine(item))); + boost::optional 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 area = item->getBounds(from_2geom(sp_item_i2doc_affine(item))); + boost::optional area = item->getBounds(from_2geom(sp_item_i2doc_affine(item))); if (area) { Inkscape::SVGOStringStream os; os << o->id; diff --git a/src/node-context.cpp b/src/node-context.cpp index bff972408..d8a1ec1d7 100644 --- a/src/node-context.cpp +++ b/src/node-context.cpp @@ -437,7 +437,7 @@ sp_node_context_root_handler(SPEventContext *event_context, GdkEvent *event) if (event->type == GDK_BUTTON_RELEASE) { event_context->xp = event_context->yp = 0; if (event->button.button == 1) { - NR::Maybe b = Inkscape::Rubberband::get()->getRectangle(); + boost::optional 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 const b = Inkscape::Rubberband::get()->getRectangle(); + boost::optional const b = Inkscape::Rubberband::get()->getRectangle(); if (b) { Inkscape::Rubberband::get()->stop(); nc->current_state = SP_NODE_CONTEXT_INACTIVE; diff --git a/src/nodepath.cpp b/src/nodepath.cpp index c5a653bf0..017544901 100644 --- a/src/nodepath.cpp +++ b/src/nodepath.cpp @@ -1616,9 +1616,9 @@ void sp_node_selected_move_absolute(Inkscape::NodePath::Path *nodepath, Geom::Co /** * If the coordinates of all selected nodes coincide, return the common coordinate; otherwise return NR::Nothing */ -NR::Maybe sp_node_selected_common_coord (Inkscape::NodePath::Path *nodepath, Geom::Dim2 axis) +boost::optional sp_node_selected_common_coord (Inkscape::NodePath::Path *nodepath, Geom::Dim2 axis) { - NR::Maybe no_coord = NR::Nothing(); + boost::optional 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 center) +void sp_nodepath_flip (Inkscape::NodePath::Path *nodepath, NR::Dim2 axis, boost::optional center) { if (!nodepath || !nodepath->selected) return; diff --git a/src/nodepath.h b/src/nodepath.h index ac0c400d4..b330ff964 100644 --- a/src/nodepath.h +++ b/src/nodepath.h @@ -313,7 +313,7 @@ void sp_node_selected_move (Inkscape::NodePath::Path *nodepath, gdouble dx, gdou void sp_node_selected_move_screen (Inkscape::NodePath::Path *nodepath, gdouble dx, gdouble dy); void sp_node_selected_move_absolute (Inkscape::NodePath::Path *nodepath, Geom::Coord val, Geom::Dim2 axis); Geom::Rect sp_node_selected_bbox (Inkscape::NodePath::Path *nodepath); -NR::Maybe sp_node_selected_common_coord (Inkscape::NodePath::Path *nodepath, Geom::Dim2 axis); +boost::optional 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 center); +void sp_nodepath_flip (Inkscape::NodePath::Path *nodepath, NR::Dim2 axis, boost::optional center); #endif diff --git a/src/object-snapper.cpp b/src/object-snapper.cpp index 5f65e3ff9..020a4793d 100644 --- a/src/object-snapper.cpp +++ b/src/object-snapper.cpp @@ -96,7 +96,7 @@ void Inkscape::ObjectSnapper::_findCandidates(SPObject* parent, _candidates->clear(); } - NR::Maybe bbox_of_item = NR::Rect(); // a default NR::Rect is infinitely large + boost::optional 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 b = sp_item_bbox_desktop(root_item, bbox_type); + boost::optional 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 const &bbox_to_snap, + boost::optional const &bbox_to_snap, std::vector const *it, std::vector *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 const &bbox_to_snap, + boost::optional const &bbox_to_snap, ConstraintLine const &c, std::vector const *it) const { diff --git a/src/object-snapper.h b/src/object-snapper.h index 603466000..3784c43d0 100644 --- a/src/object-snapper.h +++ b/src/object-snapper.h @@ -80,7 +80,7 @@ public: Inkscape::Snapper::PointType const &t, NR::Point const &p, bool const &first_point, - NR::Maybe const &bbox_to_snap, + boost::optional const &bbox_to_snap, std::vector const *it, std::vector *unselected_nodes) const; @@ -88,7 +88,7 @@ public: Inkscape::Snapper::PointType const &t, NR::Point const &p, bool const &first_point, - NR::Maybe const &bbox_to_snap, + boost::optional const &bbox_to_snap, ConstraintLine const &c, std::vector const *it) const; diff --git a/src/removeoverlap/removeoverlap.cpp b/src/removeoverlap/removeoverlap.cpp index 395d4fe0e..0562123de 100644 --- a/src/removeoverlap/removeoverlap.cpp +++ b/src/removeoverlap/removeoverlap.cpp @@ -48,7 +48,7 @@ void removeoverlap(GSList const *const items, double const xGap, double const yG ++it) { using NR::X; using NR::Y; - NR::Maybe item_box(sp_item_bbox_desktop(*it)); + boost::optional item_box(sp_item_bbox_desktop(*it)); if (item_box) { NR::Point min(item_box->min() - .5*gap); NR::Point max(item_box->max() + .5*gap); diff --git a/src/rubberband.cpp b/src/rubberband.cpp index 58f88bbfb..73333a555 100644 --- a/src/rubberband.cpp +++ b/src/rubberband.cpp @@ -126,10 +126,10 @@ void Inkscape::Rubberband::setMode(int mode) _mode = mode; } -NR::Maybe Inkscape::Rubberband::getRectangle() const +boost::optional Inkscape::Rubberband::getRectangle() const { if (!_started) { - return NR::Nothing(); + return boost::optional(); } return NR::Rect(_start, _end); diff --git a/src/rubberband.h b/src/rubberband.h index b6ef1984e..7734a65fa 100644 --- a/src/rubberband.h +++ b/src/rubberband.h @@ -17,7 +17,7 @@ #include "forward.h" #include "libnr/nr-forward.h" #include "libnr/nr-point.h" -#include "libnr/nr-maybe.h" +#include #include /* 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 getRectangle() const; + boost::optional getRectangle() const; void stop(); bool is_started(); diff --git a/src/selcue.cpp b/src/selcue.cpp index bac12fe80..2ce9a8b50 100644 --- a/src/selcue.cpp +++ b/src/selcue.cpp @@ -84,7 +84,7 @@ void Inkscape::SelCue::_updateItemBboxes() for (GSList const *l = _selection->itemList(); l != NULL; l = l->next) { SPItem *item = (SPItem *) l->data; - NR::Maybe const b = sp_item_bbox_desktop(item, bbox_type); + boost::optional const b = sp_item_bbox_desktop(item, bbox_type); SPCanvasItem* box = NULL; diff --git a/src/select-context.cpp b/src/select-context.cpp index 010382376..0957b8432 100644 --- a/src/select-context.cpp +++ b/src/select-context.cpp @@ -594,7 +594,7 @@ sp_select_context_root_handler(SPEventContext *event_context, GdkEvent *event) // this was a rubberband drag GSList *items = NULL; if (r->getMode() == RUBBERBAND_MODE_RECT) { - NR::Maybe const b = r->getRectangle(); + boost::optional const b = r->getRectangle(); items = sp_document_items_in_box(sp_desktop_document(desktop), desktop->dkey, *b); } else if (r->getMode() == RUBBERBAND_MODE_TOUCHPATH) { items = sp_document_items_at_points(sp_desktop_document(desktop), desktop->dkey, r->getPoints()); diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index a5f270389..114ed9c64 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -567,12 +567,12 @@ sp_item_list_common_parent_group(GSList const *items) } /** Finds out the minimum common bbox of the selected items. */ -static NR::Maybe +static boost::optional enclose_items(GSList const *items) { g_assert(items != NULL); - NR::Maybe r = NR::Nothing(); + boost::optional 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 selected = enclose_items(items); + boost::optional 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 newref_bbox = sp_item_bbox_desktop(SP_ITEM(newref)); + boost::optional 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 selected = enclose_items(items); + boost::optional 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 ref_bbox = sp_item_bbox_desktop(SP_ITEM(newref)); + boost::optional 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 const bbox(selection->bounds()); + boost::optional 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 const bbox(selection->bounds()); + boost::optional 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 center = selection->center(); + boost::optional 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 const bbox(selection->bounds()); - NR::Maybe center = selection->center(); + boost::optional const bbox(selection->bounds()); + boost::optional 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 const bbox(selection->bounds()); + boost::optional 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 sel_bbox = selection->bounds(); + boost::optional 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 sbox = sp_item_bbox_desktop(item); + boost::optional 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 r = selection->bounds(); - NR::Maybe c = selection->center(); + boost::optional r = selection->bounds(); + boost::optional 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 r = selection->bounds(); + boost::optional 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 object(s) to fit canvas to.")); return false; } - NR::Maybe const bbox(desktop->selection->bounds()); + boost::optional 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 const bbox(root->getBounds(from_2geom(sp_item_i2r_affine(root)))); + boost::optional const bbox(root->getBounds(from_2geom(sp_item_i2r_affine(root)))); if (bbox && !bbox->isEmpty()) { doc->fitToRect(*bbox); return true; diff --git a/src/selection.cpp b/src/selection.cpp index acab9396c..b71f27815 100644 --- a/src/selection.cpp +++ b/src/selection.cpp @@ -382,11 +382,11 @@ NRRect *Selection::bounds(NRRect *bbox, SPItem::BBoxType type) const return bbox; } -NR::Maybe Selection::bounds(SPItem::BBoxType type) const +boost::optional Selection::bounds(SPItem::BBoxType type) const { GSList const *items = const_cast(this)->itemList(); - NR::Maybe bbox = NR::Nothing(); + boost::optional 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 Selection::boundsInDocument(SPItem::BBoxType type) const { +boost::optional 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 Selection::center() const { +boost::optional Selection::center() const { GSList *items = (GSList *) const_cast(this)->itemList(); NR::Point center; if (items) { @@ -429,11 +429,11 @@ NR::Maybe Selection::center() const { return first->getCenter(); } } - NR::Maybe bbox = bounds(); + boost::optional bbox = bounds(); if (bbox) { return bounds()->midpoint(); } else { - return NR::Nothing(); + return boost::optional(); } } @@ -473,7 +473,7 @@ std::vector Selection::getSnapPointsConvexHull() const { cvh.add(*i); } - NR::Maybe rHull = cvh.bounds(); + boost::optional rHull = cvh.bounds(); if (rHull) { for ( unsigned i = 0 ; i < 4 ; ++i ) { pHull.push_back(rHull->corner(i)); diff --git a/src/selection.h b/src/selection.h index 3d45c171d..f02aeb456 100644 --- a/src/selection.h +++ b/src/selection.h @@ -243,7 +243,7 @@ public: /** @brief Returns the bounding rectangle of the selection */ NRRect *bounds(NRRect *dest, SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX) const; /** @brief Returns the bounding rectangle of the selection */ - NR::Maybe bounds(SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX) const; + boost::optional 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 boundsInDocument(SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX) const; + boost::optional boundsInDocument(SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX) const; /** * @brief Returns the rotation/skew center of the selection */ - NR::Maybe center() const; + boost::optional center() const; /** * @brief Gets the selection's snap points. diff --git a/src/seltrans.cpp b/src/seltrans.cpp index c478036c7..0b297318d 100644 --- a/src/seltrans.cpp +++ b/src/seltrans.cpp @@ -94,8 +94,8 @@ Inkscape::SelTrans::SelTrans(SPDesktop *desktop) : _show(SHOW_CONTENT), _grabbed(false), _show_handles(true), - _bbox(NR::Nothing()), - _approximate_bbox(NR::Nothing()), + _bbox(), + _approximate_bbox(), _absolute_affine(NR::scale(1,1)), _opposite(NR::Point(0,0)), _opposite_for_specpoints(NR::Point(0,0)), diff --git a/src/seltrans.h b/src/seltrans.h index d06e05276..3a7f6f4b2 100644 --- a/src/seltrans.h +++ b/src/seltrans.h @@ -131,9 +131,9 @@ private: SPItem::BBoxType _snap_bbox_type; - NR::Maybe _bbox; - NR::Maybe _approximate_bbox; - NR::Maybe _geometric_bbox; + boost::optional _bbox; + boost::optional _approximate_bbox; + boost::optional _geometric_bbox; gdouble _strokewidth; NR::Matrix _current_relative_affine; @@ -154,7 +154,7 @@ private: gdouble _handle_x; gdouble _handle_y; - NR::Maybe _center; + boost::optional _center; bool _center_is_set; ///< we've already set _center, no need to reread it from items SPKnot *_shandle[8]; diff --git a/src/shape-editor.cpp b/src/shape-editor.cpp index c88b5eb3f..2b7ec4c3d 100644 --- a/src/shape-editor.cpp +++ b/src/shape-editor.cpp @@ -571,7 +571,7 @@ void ShapeEditor::show_helperpath (bool show) { sp_nodepath_show_helperpath (this->nodepath, show); } -void ShapeEditor::flip (NR::Dim2 axis, NR::Maybe center) { +void ShapeEditor::flip (NR::Dim2 axis, boost::optional center) { if (this->nodepath) sp_nodepath_flip (this->nodepath, axis, center); } diff --git a/src/shape-editor.h b/src/shape-editor.h index 2a6da68c3..fe95aca8f 100644 --- a/src/shape-editor.h +++ b/src/shape-editor.h @@ -19,7 +19,7 @@ namespace Inkscape { namespace NodePath { class Path; } } #include "libnr/nr-path-code.h" #include "libnr/nr-point.h" -#include "libnr/nr-maybe.h" +#include #include class KnotHolder; @@ -114,7 +114,7 @@ public: void show_handles (bool show); void show_helperpath (bool show); - void flip (NR::Dim2 axis, NR::Maybe center = NR::Nothing()); + void flip (NR::Dim2 axis, boost::optional center = boost::optional()); void distribute (NR::Dim2 axis); void align (NR::Dim2 axis); diff --git a/src/snap.cpp b/src/snap.cpp index 09cdbbaba..68f4c8465 100644 --- a/src/snap.cpp +++ b/src/snap.cpp @@ -182,7 +182,7 @@ bool SnapManager::getSnapModeGuide() const void SnapManager::freeSnapReturnByRef(Inkscape::Snapper::PointType point_type, NR::Point &p, bool first_point, - NR::Maybe const &bbox_to_snap) const + boost::optional 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 const &bbox_to_snap) const + boost::optional 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 const &bbox_to_snap) const + boost::optional 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 const &bbox_to_snap) const + boost::optional const &bbox_to_snap) const { if (!SomeSnapperMightSnap()) { return Inkscape::SnappedPoint(p, Inkscape::SNAPTARGET_UNDEFINED, NR_HUGE, 0, false); diff --git a/src/snap.h b/src/snap.h index 4c5e57b73..966d2a543 100644 --- a/src/snap.h +++ b/src/snap.h @@ -55,12 +55,12 @@ public: void freeSnapReturnByRef(Inkscape::Snapper::PointType point_type, NR::Point &p, bool first_point = true, - NR::Maybe const &bbox_to_snap = NR::Nothing()) const; + boost::optional const &bbox_to_snap = boost::optional()) const; Inkscape::SnappedPoint freeSnap(Inkscape::Snapper::PointType point_type, NR::Point const &p, bool first_point = true, - NR::Maybe const &bbox_to_snap = NR::Nothing()) const; + boost::optional const &bbox_to_snap = boost::optional() ) 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 const &bbox_to_snap = NR::Nothing()) const; + boost::optional const &bbox_to_snap = boost::optional()) const; Inkscape::SnappedPoint constrainedSnap(Inkscape::Snapper::PointType point_type, NR::Point const &p, Inkscape::Snapper::ConstraintLine const &constraint, bool first_point = true, - NR::Maybe const &bbox_to_snap = NR::Nothing()) const; + boost::optional const &bbox_to_snap = boost::optional()) const; void guideSnap(NR::Point &p, NR::Point const &guide_normal) const; diff --git a/src/snapper.h b/src/snapper.h index f79573990..cf2732b24 100644 --- a/src/snapper.h +++ b/src/snapper.h @@ -16,7 +16,7 @@ #include #include "libnr/nr-coord.h" #include "libnr/nr-point.h" -#include "libnr/nr-maybe.h" +#include #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 const &/*bbox_to_snap*/, + boost::optional const &/*bbox_to_snap*/, std::vector const */*it*/, std::vector */*unselected_nodes*/) const {}; @@ -105,7 +105,7 @@ public: PointType const &/*t*/, NR::Point const &/*p*/, bool const &/*first_point*/, - NR::Maybe const &/*bbox_to_snap*/, + boost::optional const &/*bbox_to_snap*/, ConstraintLine const &/*c*/, std::vector const */*it*/) const {}; diff --git a/src/sp-conn-end-pair.cpp b/src/sp-conn-end-pair.cpp index 786209fda..6ef374684 100644 --- a/src/sp-conn-end-pair.cpp +++ b/src/sp-conn-end-pair.cpp @@ -167,7 +167,7 @@ SPConnEndPair::getEndpoints(NR::Point endPts[]) const { for (unsigned h = 0; h < 2; ++h) { if ( h2attItem[h] ) { - NR::Maybe bbox = h2attItem[h]->getBounds(from_2geom(sp_item_i2doc_affine(h2attItem[h]))); + boost::optional bbox = h2attItem[h]->getBounds(from_2geom(sp_item_i2doc_affine(h2attItem[h]))); if (bbox) { endPts[h] = bbox->midpoint(); } else { diff --git a/src/sp-conn-end.cpp b/src/sp-conn-end.cpp index a4ecf1f65..127262540 100644 --- a/src/sp-conn-end.cpp +++ b/src/sp-conn-end.cpp @@ -72,7 +72,7 @@ sp_conn_end_move_compensate(NR::Matrix const */*mp*/, SPItem */*moved_item*/, path->curve->penultimate_point() }; for (unsigned h = 0; h < 2; ++h) { - NR::Maybe bbox = h2attItem[h]->getBounds(NR::identity()); + boost::optional 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 bbox = h2attItem[ind]->getBounds(NR::identity()); + boost::optional bbox = h2attItem[ind]->getBounds(NR::identity()); if (!bbox) { if (updatePathRepr) { path->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); diff --git a/src/sp-flowtext.cpp b/src/sp-flowtext.cpp index 8621a27b5..f6ba68911 100644 --- a/src/sp-flowtext.cpp +++ b/src/sp-flowtext.cpp @@ -352,7 +352,7 @@ sp_flowtext_print(SPItem *item, SPPrintContext *ctx) NRRect pbox; sp_item_invoke_bbox(item, &pbox, NR::identity(), TRUE); NRRect bbox; - NR::Maybe bbox_maybe = sp_item_bbox_desktop(item); + boost::optional bbox_maybe = sp_item_bbox_desktop(item); if (!bbox_maybe) { return; } diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp index 80089df35..186b76663 100644 --- a/src/sp-item-group.cpp +++ b/src/sp-item-group.cpp @@ -696,7 +696,7 @@ void CGroup::onModified(guint flags) { void CGroup::calculateBBox(NRRect *bbox, NR::Matrix const &transform, unsigned const flags) { - NR::Maybe dummy_bbox = NR::Nothing(); + boost::optional dummy_bbox; GSList *l = _group->childList(false, SPObject::ActionBBox); while (l) { diff --git a/src/sp-item-transform.cpp b/src/sp-item-transform.cpp index 4caf155bf..6a6ab4fc4 100644 --- a/src/sp-item-transform.cpp +++ b/src/sp-item-transform.cpp @@ -46,7 +46,7 @@ sp_item_rotate_rel(SPItem *item, NR::rotate const &rotation) void sp_item_scale_rel (SPItem *item, NR::scale const &scale) { - NR::Maybe bbox = sp_item_bbox_desktop(item); + boost::optional 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 const &initial_geom_bbox, NR::Matrix const &abs_affine, gdouble const initial_strokewidth, bool const transform_stroke) +get_visual_bbox (boost::optional const &initial_geom_bbox, NR::Matrix const &abs_affine, gdouble const initial_strokewidth, bool const transform_stroke) { g_assert(initial_geom_bbox); diff --git a/src/sp-item-transform.h b/src/sp-item-transform.h index 8f6cdc24d..26258a1fe 100644 --- a/src/sp-item-transform.h +++ b/src/sp-item-transform.h @@ -10,7 +10,7 @@ void sp_item_skew_rel (SPItem *item, double skewX, double skewY); void sp_item_move_rel(SPItem *item, NR::translate const &tr); NR::Matrix get_scale_transform_with_stroke (NR::Rect &bbox, gdouble strokewidth, bool transform_stroke, gdouble x0, gdouble y0, gdouble x1, gdouble y1); -NR::Rect get_visual_bbox (NR::Maybe const &initial_geom_bbox, NR::Matrix const &abs_affine, gdouble const initial_strokewidth, bool const transform_stroke); +NR::Rect get_visual_bbox (boost::optional const &initial_geom_bbox, NR::Matrix const &abs_affine, gdouble const initial_strokewidth, bool const transform_stroke); #endif /* !SP_ITEM_TRANSFORM_H */ diff --git a/src/sp-item.cpp b/src/sp-item.cpp index 5d7177253..b0b6d8137 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -287,7 +287,7 @@ SPItem::setExplicitlyHidden(bool const val) { */ void SPItem::setCenter(NR::Point object_centre) { - NR::Maybe bbox = getBounds(from_2geom(sp_item_i2d_affine(this))); + boost::optional 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 bbox = getBounds(from_2geom(sp_item_i2d_affine(this))); + boost::optional 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 i_bbox = item_bbox; + boost::optional 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 SPItem::getBounds(NR::Matrix const &transform, +boost::optional SPItem::getBounds(NR::Matrix const &transform, SPItem::BBoxType type, unsigned int /*dkey*/) const { - NR::Maybe r = NR::Nothing(); + boost::optional 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 r = NR::Nothing(); + boost::optional 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 *bbox, NR::Matrix const &transform, unsigned const clear, SPItem::BBoxType type) +sp_item_invoke_bbox(SPItem const *item, boost::optional *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 +// DEPRECATED to phase out the use of NRRect in favor of boost::optional 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 *bbox, NR::Matrix const &transform, unsigned const flags, unsigned const clear) +sp_item_invoke_bbox_full(SPItem const *item, boost::optional *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(); } // 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 *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) + // explicitely defined this way for NRRects (as opposed to boost::optional) // 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() // 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 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() (see bug https://bugs.launchpad.net/inkscape/+bug/168684) + boost::optional 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 +// DEPRECATED to phase out the use of NRRect in favor of boost::optional /** 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 sp_item_bbox_desktop(SPItem *item, SPItem::BBoxType type) +boost::optional sp_item_bbox_desktop(SPItem *item, SPItem::BBoxType type) { - NR::Maybe rect = NR::Nothing(); + boost::optional rect = boost::optional(); 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 bbox = item->getBounds(from_2geom(sp_item_i2d_affine(item))); + boost::optional 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 i_bbox = item_bbox; + boost::optional 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 bbox = sp_item_bbox_desktop(item, bbox_type); + boost::optional bbox = sp_item_bbox_desktop(item, bbox_type); if (!bbox) { g_warning ("Cannot determine item's bounding box during conversion to guides.\n"); return; diff --git a/src/sp-item.h b/src/sp-item.h index 39907999f..581b6acdd 100644 --- a/src/sp-item.h +++ b/src/sp-item.h @@ -154,7 +154,7 @@ struct SPItem : public SPObject { void raiseToTop(); void lowerToBottom(); - NR::Maybe getBounds(NR::Matrix const &transform, BBoxType type=APPROXIMATE_BBOX, unsigned int dkey=0) const; + boost::optional 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 *bbox, NR::Matrix const &transform, unsigned const clear, SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX); +void sp_item_invoke_bbox(SPItem const *item, boost::optional *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 *bbox, NR::Matrix const &transform, unsigned const flags, unsigned const clear); +void sp_item_invoke_bbox_full(SPItem const *item, boost::optional *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 sp_item_bbox_desktop(SPItem *item, SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX); +boost::optional sp_item_bbox_desktop(SPItem *item, SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX); Geom::Matrix i2anc_affine(SPObject const *item, SPObject const *ancestor); Geom::Matrix i2i_affine(SPObject const *src, SPObject const *dest); diff --git a/src/sp-offset.cpp b/src/sp-offset.cpp index 2f8dc7c50..37ea2e5f5 100644 --- a/src/sp-offset.cpp +++ b/src/sp-offset.cpp @@ -510,7 +510,7 @@ sp_offset_set_shape(SPShape *shape) theRes->ConvertToForme (orig, 1, originaux); SPItem *item = shape; - NR::Maybe bbox = sp_item_bbox_desktop (item); + boost::optional bbox = sp_item_bbox_desktop (item); if ( bbox && !bbox->isEmpty() ) { gdouble size = L2(bbox->dimensions()); gdouble const exp = NR::expansion(item->transform); diff --git a/src/sp-shape.cpp b/src/sp-shape.cpp index 5509b7c77..054310472 100644 --- a/src/sp-shape.cpp +++ b/src/sp-shape.cpp @@ -272,7 +272,7 @@ sp_shape_update (SPObject *object, SPCtx *ctx, unsigned int flags) if (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_PARENT_MODIFIED_FLAG)) { /* This is suboptimal, because changing parent style schedules recalculation */ /* But on the other hand - how can we know that parent does not tie style and transform */ - NR::Maybe paintbox = SP_ITEM(object)->getBounds(NR::identity()); + boost::optional 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 paintbox = item->getBounds(NR::identity()); + boost::optional paintbox = item->getBounds(NR::identity()); if (paintbox) { s->setPaintBox(*paintbox); } diff --git a/src/splivarot.cpp b/src/splivarot.cpp index 11044ec1a..06ae89ba0 100644 --- a/src/splivarot.cpp +++ b/src/splivarot.cpp @@ -1610,7 +1610,7 @@ sp_selected_path_simplify_items(SPDesktop *desktop, bool didSomething = false; - NR::Maybe selectionBbox = selection->bounds(); + boost::optional selectionBbox = selection->bounds(); if (!selectionBbox) { return false; } @@ -1631,7 +1631,7 @@ sp_selected_path_simplify_items(SPDesktop *desktop, continue; if (simplifyIndividualPaths) { - NR::Maybe itemBbox = item->getBounds(from_2geom(sp_item_i2d_affine(item))); + boost::optional 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 get_nearest_position_on_Path(Path *path, NR::Point p, unsigned seg) +boost::optional get_nearest_position_on_Path(Path *path, NR::Point p, unsigned seg) { //get nearest position on path Path::cut_position pos = path->PointToCurvilignPosition(p, seg); diff --git a/src/splivarot.h b/src/splivarot.h index 69e985ffa..ad4d9c6e0 100644 --- a/src/splivarot.h +++ b/src/splivarot.h @@ -50,7 +50,7 @@ void sp_selected_path_simplify (); Path *Path_for_item(SPItem *item, bool doTransformation, bool transformFull = true); Geom::PathVector* pathvector_for_curve(SPItem *item, SPCurve *curve, bool doTransformation, bool transformFull, Geom::Matrix extraPreAffine, Geom::Matrix extraPostAffine); SPCurve *curve_for_item(SPItem *item); -NR::Maybe get_nearest_position_on_Path(Path *path, NR::Point p, unsigned seg = 0); +boost::optional get_nearest_position_on_Path(Path *path, NR::Point p, unsigned seg = 0); NR::Point get_point_on_Path(Path *path, int piece, double t); Path *bpath_to_Path(NArtBpath const *bpath); diff --git a/src/text-context.cpp b/src/text-context.cpp index da69277f8..0865e06cb 100644 --- a/src/text-context.cpp +++ b/src/text-context.cpp @@ -437,7 +437,7 @@ sp_text_context_item_handler(SPEventContext *event_context, SPItem *item, GdkEve item_ungrouped = desktop->item_at_point(NR::Point(event->button.x, event->button.y), TRUE); if (SP_IS_TEXT(item_ungrouped) || SP_IS_FLOWTEXT(item_ungrouped)) { sp_canvas_item_show(tc->indicator); - NR::Maybe ibbox = sp_item_bbox_desktop(item_ungrouped); + boost::optional 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 frame_bbox = sp_item_bbox_desktop(frame); + boost::optional frame_bbox = sp_item_bbox_desktop(frame); if (frame_bbox) { SP_CTRLRECT(tc->frame)->setRectangle(*frame_bbox); } diff --git a/src/tweak-context.cpp b/src/tweak-context.cpp index 70cd49c81..e670a2db4 100644 --- a/src/tweak-context.cpp +++ b/src/tweak-context.cpp @@ -40,7 +40,7 @@ #include "pixmaps/cursor-push.xpm" #include "pixmaps/cursor-roughen.xpm" #include "pixmaps/cursor-color.xpm" -#include "libnr/nr-maybe.h" +#include #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 bbox = item->getBounds(from_2geom(sp_item_i2doc_affine(item))); + boost::optional 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 bbox = item->getBounds(from_2geom(sp_item_i2doc_affine(item)), + boost::optional bbox = item->getBounds(from_2geom(sp_item_i2doc_affine(item)), SPItem::GEOMETRIC_BBOX); if (!bbox) { return false; diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index 537277afc..013882327 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -405,14 +405,14 @@ bool ClipboardManagerImpl::pasteSize(bool separately, bool apply_x, bool apply_y if (separately) { for (GSList *i = const_cast(selection->itemList()) ; i ; i = i->next) { SPItem *item = SP_ITEM(i->data); - NR::Maybe obj_size = sp_item_bbox_desktop(item); + boost::optional 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 sel_size = selection->bounds(); + boost::optional 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 size = selection->bounds(); + boost::optional 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 sel_size = selection->bounds(); + boost::optional sel_size = selection->bounds(); Geom::Point m( desktop->point() ); if (sel_size) { diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp index 7d4820663..e83907f49 100644 --- a/src/ui/dialog/align-and-distribute.cpp +++ b/src/ui/dialog/align-and-distribute.cpp @@ -153,7 +153,7 @@ private : SPItem * thing = *master; selected.erase(master); //Compute the anchor point - NR::Maybe b = sp_item_bbox_desktop (thing); + boost::optional 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 b = sp_item_bbox_desktop + boost::optional 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 b = selection->bounds(); + boost::optional 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 b = sp_item_bbox_desktop (*it); + boost::optional 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 bbox = sp_item_bbox_desktop(*it); + boost::optional 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 sel_bbox = selection->bounds(); + boost::optional 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 item_box = sp_item_bbox_desktop (*it); + boost::optional 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(); } ///////////////////////////////////////////////////////// @@ -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(); show_all_children(); @@ -1073,7 +1073,7 @@ std::list::iterator AlignAndDistribute::find_master( std::list::iterator it = list.begin(); it != list.end(); it++) { - NR::Maybe b = sp_item_bbox_desktop (*it); + boost::optional 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::iterator AlignAndDistribute::find_master( std::list::iterator it = list.begin(); it != list.end(); it++) { - NR::Maybe b = sp_item_bbox_desktop (*it); + boost::optional b = sp_item_bbox_desktop (*it); if (b) { gdouble dim = (*b).extent(horizontal ? Geom::X : Geom::Y); if (dim < max) { diff --git a/src/ui/dialog/align-and-distribute.h b/src/ui/dialog/align-and-distribute.h index c29fd7c0d..e4fdf9604 100644 --- a/src/ui/dialog/align-and-distribute.h +++ b/src/ui/dialog/align-and-distribute.h @@ -65,7 +65,7 @@ public: std::list::iterator find_master(std::list &list, bool horizontal); void setMode(bool nodeEdit); - NR::Maybe randomize_bbox; + boost::optional randomize_bbox; protected: diff --git a/src/ui/dialog/filedialogimpl-win32.cpp b/src/ui/dialog/filedialogimpl-win32.cpp index c726b0454..a512f9849 100644 --- a/src/ui/dialog/filedialogimpl-win32.cpp +++ b/src/ui/dialog/filedialogimpl-win32.cpp @@ -866,7 +866,7 @@ bool FileOpenDialogImplWin32::set_svg_preview() NRRectL bbox = {0, 0, scaledSvgWidth, scaledSvgHeight}; // write object bbox to area - NR::Maybe maybeArea(from_2geom(area)); + boost::optional maybeArea(from_2geom(area)); sp_document_ensure_up_to_date (svgDoc); sp_item_invoke_bbox((SPItem *) svgDoc->root, &maybeArea, from_2geom(sp_item_i2r_affine((SPItem *)(svgDoc->root))), TRUE); diff --git a/src/ui/dialog/transformation.cpp b/src/ui/dialog/transformation.cpp index 8c12df558..ed89bf6aa 100644 --- a/src/ui/dialog/transformation.cpp +++ b/src/ui/dialog/transformation.cpp @@ -457,7 +457,7 @@ Transformation::updatePageMove(Inkscape::Selection *selection) { if (selection && !selection->isEmpty()) { if (!_check_move_relative.get_active()) { - NR::Maybe bbox = selection->bounds(); + boost::optional 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 bbox = selection->bounds(); + boost::optional 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 bbox = selection->bounds(); + boost::optional 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 bbox = selection->bounds(); + boost::optional 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 bbox = sp_item_bbox_desktop(*it); + boost::optional 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 bbox = sp_item_bbox_desktop(*it); + boost::optional 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 bbox = selection->bounds(); + boost::optional 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 bbox(sp_item_bbox_desktop(item)); + boost::optional 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 bbox(selection->bounds()); + boost::optional 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 center = selection->center(); + boost::optional 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 bbox(sp_item_bbox_desktop(item)); + boost::optional 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 bbox = selection->bounds(); - NR::Maybe center = selection->center(); + boost::optional bbox = selection->bounds(); + boost::optional 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 bbox = selection->bounds(); + boost::optional 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 bbox = selection->bounds(); + boost::optional bbox = selection->bounds(); if (bbox) { _scalar_move_horizontal.setValue(bbox->min()[Geom::X], "px"); _scalar_move_vertical.setValue(bbox->min()[Geom::Y], "px"); diff --git a/src/ui/widget/object-composite-settings.cpp b/src/ui/widget/object-composite-settings.cpp index 638f1a70c..d4c1bb705 100644 --- a/src/ui/widget/object-composite-settings.cpp +++ b/src/ui/widget/object-composite-settings.cpp @@ -114,7 +114,7 @@ ObjectCompositeSettings::_blendBlurValueChanged() // FIXME: fix for GTK breakage, see comment in SelectedStyle::on_opacity_changed; here it results in crash 1580903 sp_canvas_force_full_redraw_after_interruptions(sp_desktop_canvas(desktop), 0); - NR::Maybe bbox = _subject->getBounds(SPItem::GEOMETRIC_BBOX); + boost::optional 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 bbox = _subject->getBounds(SPItem::GEOMETRIC_BBOX); + boost::optional bbox = _subject->getBounds(SPItem::GEOMETRIC_BBOX); if (bbox) { double perimeter = bbox->extent(Geom::X) + bbox->extent(Geom::Y); _fe_cb.set_blur_sensitive(true); diff --git a/src/ui/widget/style-subject.cpp b/src/ui/widget/style-subject.cpp index 46d33abb7..39081b005 100644 --- a/src/ui/widget/style-subject.cpp +++ b/src/ui/widget/style-subject.cpp @@ -65,12 +65,12 @@ StyleSubject::iterator StyleSubject::Selection::begin() { } } -NR::Maybe StyleSubject::Selection::getBounds(SPItem::BBoxType type) { +boost::optional StyleSubject::Selection::getBounds(SPItem::BBoxType type) { Inkscape::Selection *selection = _getSelection(); if (selection) { return selection->bounds(type); } else { - return NR::Nothing(); + return boost::optional(); } } @@ -143,12 +143,12 @@ StyleSubject::iterator StyleSubject::CurrentLayer::begin() { return iterator(_getLayerSList()); } -NR::Maybe StyleSubject::CurrentLayer::getBounds(SPItem::BBoxType type) { +boost::optional 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(); } } diff --git a/src/ui/widget/style-subject.h b/src/ui/widget/style-subject.h index f9c544976..9204a8163 100644 --- a/src/ui/widget/style-subject.h +++ b/src/ui/widget/style-subject.h @@ -10,7 +10,7 @@ #define SEEN_INKSCAPE_UI_WIDGET_STYLE_SUBJECT_H #include "util/glib-list-iterators.h" -#include "libnr/nr-maybe.h" +#include #include "libnr/nr-rect.h" #include "sp-item.h" #include @@ -43,7 +43,7 @@ public: virtual iterator begin() = 0; virtual iterator end() { return iterator(NULL); } - virtual NR::Maybe getBounds(SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX) = 0; + virtual boost::optional 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 getBounds(SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX); + virtual boost::optional 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 getBounds(SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX); + virtual boost::optional getBounds(SPItem::BBoxType type = SPItem::APPROXIMATE_BBOX); virtual int queryStyle(SPStyle *query, int property); virtual void setCSS(SPCSSAttr *css); diff --git a/src/vanishing-point.cpp b/src/vanishing-point.cpp index dcf8d6e71..ac123792d 100644 --- a/src/vanishing-point.cpp +++ b/src/vanishing-point.cpp @@ -677,7 +677,7 @@ VPDrag::drawLinesForFace (const SPBox3D *box, Proj::Axis axis) //, guint corner1 } } else { // draw perspective lines for infinite VPs - NR::Maybe pt1, pt2, pt3, pt4; + boost::optional pt1, pt2, pt3, pt4; Persp3D *persp = box3d_get_perspective(box); SPDesktop *desktop = inkscape_active_desktop (); // FIXME: Store the desktop in VPDrag Box3D::PerspectiveLine pl (corner1, axis, persp); diff --git a/src/verbs.cpp b/src/verbs.cpp index e40ffe1d6..8d7a4a2a1 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -1309,7 +1309,7 @@ ObjectVerb::perform( SPAction *action, void *data, void */*pdata*/ ) if (sel->isEmpty()) return; - NR::Maybe bbox = sel->bounds(); + boost::optional bbox = sel->bounds(); if (!bbox) { return; } diff --git a/src/widgets/font-selector.cpp b/src/widgets/font-selector.cpp index 1faf7005f..20b105614 100644 --- a/src/widgets/font-selector.cpp +++ b/src/widgets/font-selector.cpp @@ -671,7 +671,7 @@ static gint sp_font_preview_expose(GtkWidget *widget, GdkEventExpose *event) hpos[len] = base_pt[0]; len++; if ( curF ) { - NR::Maybe nbbox = curF->BBox(str_text->glyph_text[i].gl); + boost::optional nbbox = curF->BBox(str_text->glyph_text[i].gl); if (nbbox) { bbox.x0 = MIN(bbox.x0, base_pt[Geom::X] + theSize * (nbbox->min())[0]); bbox.y0 = MIN(bbox.y0, base_pt[Geom::Y] - theSize * (nbbox->max())[1]); diff --git a/src/widgets/icon.cpp b/src/widgets/icon.cpp index d89a85eaa..b460258ed 100644 --- a/src/widgets/icon.cpp +++ b/src/widgets/icon.cpp @@ -623,7 +623,7 @@ sp_icon_doc_icon( SPDocument *doc, NRArenaItem *root, if (object && SP_IS_ITEM(object)) { /* Find bbox in document */ Geom::Matrix const i2doc(sp_item_i2doc_affine(SP_ITEM(object))); - NR::Maybe dbox = SP_ITEM(object)->getBounds(i2doc); + boost::optional dbox = SP_ITEM(object)->getBounds(i2doc); if ( SP_OBJECT_PARENT(object) == NULL ) { diff --git a/src/widgets/select-toolbar.cpp b/src/widgets/select-toolbar.cpp index 5a2adc8d2..e413aa39e 100644 --- a/src/widgets/select-toolbar.cpp +++ b/src/widgets/select-toolbar.cpp @@ -68,7 +68,7 @@ sp_selection_layout_widget_update(SPWidget *spw, Inkscape::Selection *sel) int prefs_bbox = prefs_get_int_attribute("tools", "bounding_box", 0); SPItem::BBoxType bbox_type = (prefs_bbox ==0)? SPItem::APPROXIMATE_BBOX : SPItem::GEOMETRIC_BBOX; - NR::Maybe const bbox(sel->bounds(bbox_type)); + boost::optional const bbox(sel->bounds(bbox_type)); if ( bbox && !bbox->isEmpty() ) { UnitTracker *tracker = reinterpret_cast(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 bbox = selection->bounds(bbox_type); + boost::optional bbox = selection->bounds(bbox_type); if ( !bbox || bbox->isEmpty() ) { g_object_set_data(G_OBJECT(spw), "update", GINT_TO_POINTER(FALSE)); diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index 9ca705189..07b388d14 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -1107,8 +1107,8 @@ sp_node_toolbox_coord_changed(gpointer /*shape_editor*/, GObject *tbl) gtk_adjustment_set_value(yadj, sp_pixels_get_units(sel_node[Geom::Y], *unit)); } } else { - NR::Maybe x = sp_node_selected_common_coord(nodepath, Geom::X); - NR::Maybe y = sp_node_selected_common_coord(nodepath, Geom::Y); + boost::optional x = sp_node_selected_common_coord(nodepath, Geom::X); + boost::optional y = sp_node_selected_common_coord(nodepath, Geom::Y); if ((x && ((*x) != oldx)) || (y && ((*y) != oldy))) { /* Note: Currently x and y will always have a value, even if the coordinates of the selected nodes don't coincide (in this case we use the coordinates of the center diff --git a/src/zoom-context.cpp b/src/zoom-context.cpp index 71dca4846..56eeb69cb 100644 --- a/src/zoom-context.cpp +++ b/src/zoom-context.cpp @@ -174,7 +174,7 @@ static gint sp_zoom_context_root_handler(SPEventContext *event_context, GdkEvent NR::Point const button_w(event->button.x, event->button.y); NR::Point const button_dt(desktop->w2d(button_w)); if ( event->button.button == 1 && !event_context->space_panning) { - NR::Maybe const b = Inkscape::Rubberband::get()->getRectangle(); + boost::optional const b = Inkscape::Rubberband::get()->getRectangle(); if (b && !within_tolerance) { desktop->set_display_area(*b, 10); } else if (!escaped) { -- 2.30.2