~centralelyon2010/inkscape/imagelinks2

« back to all changes in this revision

Viewing changes to src/ui/dialog/transformation.cpp

  • Committer: Ted Gould
  • Date: 2008-11-21 05:24:08 UTC
  • Revision ID: ted@canonical.com-20081121052408-tilucis2pjrrpzxx
MergeĀ fromĀ fe-moved

Show diffs side-by-side

added added

removed removed

Lines of Context:
457
457
{
458
458
    if (selection && !selection->isEmpty()) {
459
459
        if (!_check_move_relative.get_active()) {
460
 
            boost::optional<Geom::Rect> bbox = selection->bounds();
 
460
            Geom::OptRect bbox = selection->bounds();
461
461
            if (bbox) {
462
462
                double x = bbox->min()[Geom::X];
463
463
                double y = bbox->min()[Geom::Y];
478
478
Transformation::updatePageScale(Inkscape::Selection *selection)
479
479
{
480
480
    if (selection && !selection->isEmpty()) {
481
 
        boost::optional<Geom::Rect> bbox = selection->bounds();
 
481
        Geom::OptRect bbox = selection->bounds();
482
482
        if (bbox) {
483
483
            double w = bbox->dimensions()[Geom::X];
484
484
            double h = bbox->dimensions()[Geom::Y];
508
508
Transformation::updatePageSkew(Inkscape::Selection *selection)
509
509
{
510
510
    if (selection && !selection->isEmpty()) {
511
 
        boost::optional<Geom::Rect> bbox = selection->bounds();
 
511
        Geom::OptRect bbox = selection->bounds();
512
512
        if (bbox) {
513
513
            double w = bbox->dimensions()[Geom::X];
514
514
            double h = bbox->dimensions()[Geom::Y];
605
605
        if (_check_move_relative.get_active()) {
606
606
            sp_selection_move_relative(selection, x, y);
607
607
        } else {
608
 
            boost::optional<Geom::Rect> bbox = selection->bounds();
 
608
            Geom::OptRect bbox = selection->bounds();
609
609
            if (bbox) {
610
610
                sp_selection_move_relative(selection,
611
611
                                           x - bbox->min()[Geom::X], y - bbox->min()[Geom::Y]);
626
626
                     it != selected.end();
627
627
                     ++it)
628
628
                {
629
 
                    boost::optional<Geom::Rect> bbox = sp_item_bbox_desktop(*it);
 
629
                    Geom::OptRect bbox = sp_item_bbox_desktop(*it);
630
630
                    if (bbox) {
631
631
                        sorted.push_back(BBoxSort(*it, *bbox, Geom::X, x > 0? 1. : 0., x > 0? 0. : 1.));
632
632
                    }
650
650
                     it != selected.end();
651
651
                     ++it)
652
652
                {
653
 
                    boost::optional<Geom::Rect> bbox = sp_item_bbox_desktop(*it);
 
653
                    Geom::OptRect bbox = sp_item_bbox_desktop(*it);
654
654
                    if (bbox) {
655
655
                        sorted.push_back(BBoxSort(*it, *bbox, Geom::Y, y > 0? 1. : 0., y > 0? 0. : 1.));
656
656
                    }
669
669
                }
670
670
            }
671
671
        } else {
672
 
            boost::optional<Geom::Rect> bbox = selection->bounds();
 
672
            Geom::OptRect bbox = selection->bounds();
673
673
            if (bbox) {
674
674
                sp_selection_move_relative(selection,
675
675
                                           x - bbox->min()[Geom::X], y - bbox->min()[Geom::Y]);
694
694
            Geom::Scale scale (0,0);
695
695
            // the values are increments!
696
696
            if (_units_scale.isAbsolute()) {
697
 
                boost::optional<Geom::Rect> bbox(sp_item_bbox_desktop(item));
 
697
                Geom::OptRect bbox(sp_item_bbox_desktop(item));
698
698
                if (bbox) {
699
699
                    double new_width = scaleX;
700
700
                    if (fabs(new_width) < 1e-6) new_width = 1e-6; // not 0, as this would result in a nasty no-bbox object
712
712
            sp_item_scale_rel (item, scale);
713
713
        }
714
714
    } else {
715
 
        boost::optional<Geom::Rect> bbox(selection->bounds());
 
715
        Geom::OptRect bbox(selection->bounds());
716
716
        if (bbox) {
717
717
            Geom::Point center(bbox->midpoint()); // use rotation center?
718
718
            Geom::Scale scale (0,0);
781
781
            } else { // absolute displacement
782
782
                double skewX = _scalar_skew_horizontal.getValue("px");
783
783
                double skewY = _scalar_skew_vertical.getValue("px");
784
 
                boost::optional<Geom::Rect> bbox(sp_item_bbox_desktop(item));
 
784
                Geom::OptRect bbox(sp_item_bbox_desktop(item));
785
785
                if (bbox) {
786
786
                    double width = bbox->dimensions()[Geom::X];
787
787
                    double height = bbox->dimensions()[Geom::Y];
790
790
            }
791
791
        }
792
792
    } else { // transform whole selection
793
 
        boost::optional<Geom::Rect> bbox = selection->bounds();
 
793
        Geom::OptRect bbox = selection->bounds();
794
794
        boost::optional<Geom::Point> center = selection->center();
795
795
 
796
796
        if ( bbox && center ) {
873
873
 
874
874
    //g_message("onMoveRelativeToggled: %f, %f px\n", x, y);
875
875
 
876
 
    boost::optional<Geom::Rect> bbox = selection->bounds();
 
876
    Geom::OptRect bbox = selection->bounds();
877
877
 
878
878
    if (bbox) {
879
879
        if (_check_move_relative.get_active()) {
1013
1013
            _scalar_move_horizontal.setValue(0);
1014
1014
            _scalar_move_vertical.setValue(0);
1015
1015
        } else {
1016
 
            boost::optional<Geom::Rect> bbox = selection->bounds();
 
1016
            Geom::OptRect bbox = selection->bounds();
1017
1017
            if (bbox) {
1018
1018
                _scalar_move_horizontal.setValue(bbox->min()[Geom::X], "px");
1019
1019
                _scalar_move_vertical.setValue(bbox->min()[Geom::Y], "px");