Code

NR::Maybe => boost::optional
[inkscape.git] / src / ui / dialog / transformation.cpp
index 8c12df55849eefce08b997fbf0fc1a87d1a06f95..ed89bf6aaf0945bb7acd2085b7ff5af4d9d27098 100644 (file)
@@ -457,7 +457,7 @@ Transformation::updatePageMove(Inkscape::Selection *selection)
 {
     if (selection && !selection->isEmpty()) {
         if (!_check_move_relative.get_active()) {
-            NR::Maybe<NR::Rect> bbox = selection->bounds();
+            boost::optional<NR::Rect> bbox = selection->bounds();
             if (bbox) {
                 double x = bbox->min()[Geom::X];
                 double y = bbox->min()[Geom::Y];
@@ -478,7 +478,7 @@ void
 Transformation::updatePageScale(Inkscape::Selection *selection)
 {
     if (selection && !selection->isEmpty()) {
-        NR::Maybe<NR::Rect> bbox = selection->bounds();
+        boost::optional<NR::Rect> bbox = selection->bounds();
         if (bbox) {
             double w = bbox->extent(Geom::X);
             double h = bbox->extent(Geom::Y);
@@ -508,7 +508,7 @@ void
 Transformation::updatePageSkew(Inkscape::Selection *selection)
 {
     if (selection && !selection->isEmpty()) {
-        NR::Maybe<NR::Rect> bbox = selection->bounds();
+        boost::optional<NR::Rect> bbox = selection->bounds();
         if (bbox) {
             double w = bbox->extent(Geom::X);
             double h = bbox->extent(Geom::Y);
@@ -604,7 +604,7 @@ Transformation::applyPageMove(Inkscape::Selection *selection)
         if (_check_move_relative.get_active()) {
             sp_selection_move_relative(selection, x, y);
         } else {
-            NR::Maybe<NR::Rect> bbox = selection->bounds();
+            boost::optional<NR::Rect> bbox = selection->bounds();
             if (bbox) {
                 sp_selection_move_relative(selection,
                                            x - bbox->min()[Geom::X], y - bbox->min()[Geom::Y]);
@@ -625,7 +625,7 @@ Transformation::applyPageMove(Inkscape::Selection *selection)
                      it != selected.end();
                      ++it)
                 {
-                    NR::Maybe<NR::Rect> bbox = sp_item_bbox_desktop(*it);
+                    boost::optional<NR::Rect> bbox = sp_item_bbox_desktop(*it);
                     if (bbox) {
                         sorted.push_back(BBoxSort(*it, to_2geom(*bbox), Geom::X, x > 0? 1. : 0., x > 0? 0. : 1.));
                     }
@@ -649,7 +649,7 @@ Transformation::applyPageMove(Inkscape::Selection *selection)
                      it != selected.end();
                      ++it)
                 {
-                    NR::Maybe<NR::Rect> bbox = sp_item_bbox_desktop(*it);
+                    boost::optional<NR::Rect> bbox = sp_item_bbox_desktop(*it);
                     if (bbox) {
                         sorted.push_back(BBoxSort(*it, to_2geom(*bbox), Geom::Y, y > 0? 1. : 0., y > 0? 0. : 1.));
                     }
@@ -668,7 +668,7 @@ Transformation::applyPageMove(Inkscape::Selection *selection)
                 }
             }
         } else {
-            NR::Maybe<NR::Rect> bbox = selection->bounds();
+            boost::optional<NR::Rect> bbox = selection->bounds();
             if (bbox) {
                 sp_selection_move_relative(selection,
                                            x - bbox->min()[Geom::X], y - bbox->min()[Geom::Y]);
@@ -692,7 +692,7 @@ Transformation::applyPageScale(Inkscape::Selection *selection)
             NR::scale scale (0,0);
             // the values are increments!
             if (_units_scale.isAbsolute()) {
-                NR::Maybe<NR::Rect> bbox(sp_item_bbox_desktop(item));
+                boost::optional<NR::Rect> bbox(sp_item_bbox_desktop(item));
                 if (bbox) {
                     double new_width = scaleX;
                     if (fabs(new_width) < 1e-6) new_width = 1e-6; // not 0, as this would result in a nasty no-bbox object
@@ -710,7 +710,7 @@ Transformation::applyPageScale(Inkscape::Selection *selection)
             sp_item_scale_rel (item, scale);
         }
     } else {
-        NR::Maybe<NR::Rect> bbox(selection->bounds());
+        boost::optional<NR::Rect> bbox(selection->bounds());
         if (bbox) {
             Geom::Point center(bbox->midpoint()); // use rotation center?
             NR::scale scale (0,0);
@@ -747,7 +747,7 @@ Transformation::applyPageRotate(Inkscape::Selection *selection)
             sp_item_rotate_rel(item, NR::rotate (angle*M_PI/180.0));
         }
     } else {
-        NR::Maybe<NR::Point> center = selection->center();
+        boost::optional<NR::Point> center = selection->center();
         if (center) {
             sp_selection_rotate_relative(selection, *center, angle);
         }
@@ -777,7 +777,7 @@ Transformation::applyPageSkew(Inkscape::Selection *selection)
             } else { // absolute displacement
                 double skewX = _scalar_skew_horizontal.getValue("px");
                 double skewY = _scalar_skew_vertical.getValue("px");
-                NR::Maybe<NR::Rect> bbox(sp_item_bbox_desktop(item));
+                boost::optional<NR::Rect> bbox(sp_item_bbox_desktop(item));
                 if (bbox) {
                     double width = bbox->extent(Geom::X);
                     double height = bbox->extent(Geom::Y);
@@ -786,8 +786,8 @@ Transformation::applyPageSkew(Inkscape::Selection *selection)
             }
         }
     } else { // transform whole selection
-        NR::Maybe<NR::Rect> bbox = selection->bounds();
-        NR::Maybe<NR::Point> center = selection->center();
+        boost::optional<NR::Rect> bbox = selection->bounds();
+        boost::optional<NR::Point> center = selection->center();
 
         if ( bbox && center ) {
             double width  = bbox->extent(Geom::X);
@@ -869,7 +869,7 @@ Transformation::onMoveRelativeToggled()
 
     //g_message("onMoveRelativeToggled: %f, %f px\n", x, y);
 
-    NR::Maybe<NR::Rect> bbox = selection->bounds();
+    boost::optional<NR::Rect> bbox = selection->bounds();
 
     if (bbox) {
         if (_check_move_relative.get_active()) {
@@ -1009,7 +1009,7 @@ Transformation::onClear()
             _scalar_move_horizontal.setValue(0);
             _scalar_move_vertical.setValue(0);
         } else {
-            NR::Maybe<NR::Rect> bbox = selection->bounds();
+            boost::optional<NR::Rect> bbox = selection->bounds();
             if (bbox) {
                 _scalar_move_horizontal.setValue(bbox->min()[Geom::X], "px");
                 _scalar_move_vertical.setValue(bbox->min()[Geom::Y], "px");