Code

More accurate wording in snap tooltips
authordvlierop2 <dvlierop2@users.sourceforge.net>
Fri, 27 Feb 2009 18:49:52 +0000 (18:49 +0000)
committerdvlierop2 <dvlierop2@users.sourceforge.net>
Fri, 27 Feb 2009 18:49:52 +0000 (18:49 +0000)
src/display/snap-indicator.cpp
src/snapped-point.h
src/sp-ellipse.cpp
src/sp-image.cpp
src/sp-rect.cpp
src/sp-text.cpp

index b9f7ee1d420632d38cb1acb122f9d07216404068..a5d7b77f02f5c6e874ccdd57807db97fb008e286 100644 (file)
@@ -127,6 +127,15 @@ SnapIndicator::set_new_snaptarget(Inkscape::SnappedPoint const p)
             case SNAPTARGET_ELLIPSE_QUADRANT_POINT:
                target_name = _("quadrant point");
                break;
+            case SNAPTARGET_CENTER:
+               target_name = _("center");
+                               break;
+            case SNAPTARGET_CORNER:
+               target_name = _("corner");
+                               break;
+            case SNAPTARGET_TEXT_BASELINE:
+               target_name = _("text baseline");
+                               break;
             default:
                g_warning("Snap target has not yet been defined!");
                 break;
@@ -176,6 +185,15 @@ SnapIndicator::set_new_snaptarget(Inkscape::SnappedPoint const p)
                        case SNAPSOURCE_ELLIPSE_QUADRANT_POINT:
                                source_name = _("Quadrant point");
                                break;
+                       case SNAPSOURCE_CENTER:
+                               source_name = _("Center");
+                               break;
+                       case SNAPSOURCE_CORNER:
+                               source_name = _("Corner");
+                               break;
+                       case SNAPSOURCE_TEXT_BASELINE:
+                               source_name = _("Text baseline");
+                               break;
                        default:
                                g_warning("Snap source has not yet been defined!");
                                break;
index f8ef50ff361f873f92c44c6f2ef7986bba62a985..c0209c09d24850a82ad178c03995be98f44d6894 100644 (file)
@@ -33,7 +33,7 @@ enum SnapTargetType {
     SNAPTARGET_LINE_MIDPOINT,
     SNAPTARGET_OBJECT_MIDPOINT,
     SNAPTARGET_ROTATION_CENTER,
-    SNAPTARGET_HANDLE, //e.g. center of ellipse, corner of rectangle
+    SNAPTARGET_HANDLE,
     SNAPTARGET_PATH,
     SNAPTARGET_PATH_INTERSECTION,
     SNAPTARGET_BBOX_CORNER,
@@ -45,6 +45,9 @@ enum SnapTargetType {
     SNAPTARGET_PAGE_CORNER,
     SNAPTARGET_CONVEX_HULL_CORNER,
     SNAPTARGET_ELLIPSE_QUADRANT_POINT,
+    SNAPTARGET_CENTER, // of ellipse
+    SNAPTARGET_CORNER, // of image or of rectangle
+    SNAPTARGET_TEXT_BASELINE
 };
 
 enum SnapSourceType {
@@ -61,7 +64,10 @@ enum SnapSourceType {
     SNAPSOURCE_PATH_INTERSECTION,
     SNAPSOURCE_GUIDE,
     SNAPSOURCE_CONVEX_HULL_CORNER,
-    SNAPSOURCE_ELLIPSE_QUADRANT_POINT
+    SNAPSOURCE_ELLIPSE_QUADRANT_POINT,
+    SNAPSOURCE_CENTER, // of ellipse
+    SNAPSOURCE_CORNER, // of image or of rectangle
+    SNAPSOURCE_TEXT_BASELINE
 };
 
 
index 8022be5603e9ddf02daa8e945613fbc4b5963913..251620b6c96eb7c323a58844af7e8505c1864855 100644 (file)
@@ -304,7 +304,7 @@ static void sp_genericellipse_snappoints(SPItem const *item, bool const target,
     // Add the centre, if we have a closed slice or when explicitly asked for
     if ((snapprefs->getSnapToItemNode() && slice && ellipse->closed) || snapprefs->getSnapObjectMidpoints()) {
        pt = Geom::Point(cx, cy) * i2d;
-       p.push_back(std::make_pair(pt, target ? int(Inkscape::SNAPTARGET_HANDLE) : int(Inkscape::SNAPSOURCE_HANDLE)));
+       p.push_back(std::make_pair(pt, target ? int(Inkscape::SNAPTARGET_CENTER) : int(Inkscape::SNAPSOURCE_CENTER)));
     }
 
     // And if we have a slice, also snap to the endpoints
index 49350bd6941f90735898b023fe3a8186190329b1..c99e1e0f79ffdbfc3ccccbba4d80de3b5f45bef9 100644 (file)
@@ -1330,7 +1330,7 @@ static void sp_image_snappoints(SPItem const *item, bool const target, SnapPoint
         double const y1 = y0 + image.height.computed;
         Geom::Matrix const i2d (sp_item_i2d_affine (item));
         Geom::Point pt;
-        int type = target ? int(Inkscape::SNAPTARGET_HANDLE) : int(Inkscape::SNAPSOURCE_HANDLE);
+        int type = target ? int(Inkscape::SNAPTARGET_CORNER) : int(Inkscape::SNAPSOURCE_CORNER);
         p.push_back(std::make_pair(Geom::Point(x0, y0) * i2d, type));
         p.push_back(std::make_pair(Geom::Point(x0, y1) * i2d, type));
         p.push_back(std::make_pair(Geom::Point(x1, y1) * i2d, type));
index 4f8dbbbce6ad733923b56a90490dae8d2530948e..f59a02853dfcfc0e549ace1c8a06ad09bccf91d6 100644 (file)
@@ -572,7 +572,7 @@ static void sp_rect_snappoints(SPItem const *item, bool const target, SnapPoints
     int type;
 
     if (snapprefs->getSnapToItemNode()) {
-       type = target ? int(Inkscape::SNAPTARGET_HANDLE) : int(Inkscape::SNAPSOURCE_HANDLE);
+       type = target ? int(Inkscape::SNAPTARGET_CORNER) : int(Inkscape::SNAPSOURCE_CORNER);
        p.push_back(std::make_pair(p0, type));
        p.push_back(std::make_pair(p1, type));
        p.push_back(std::make_pair(p2, type));
index 91a8a03617247c3b567569edb284ceb41534a356..61947311c4995155f4de67629d5afa665bfac99a 100644 (file)
@@ -433,7 +433,7 @@ static void sp_text_snappoints(SPItem const *item, bool const target, SnapPoints
     // the baseline anchor of the first char
     Inkscape::Text::Layout const *layout = te_get_layout((SPItem *) item);
     if(layout != NULL) {
-        int type = target ? int(Inkscape::SNAPTARGET_HANDLE) : int(Inkscape::SNAPSOURCE_HANDLE);
+        int type = target ? int(Inkscape::SNAPTARGET_TEXT_BASELINE) : int(Inkscape::SNAPSOURCE_TEXT_BASELINE);
        p.push_back(std::make_pair(layout->characterAnchorPoint(layout->begin()) * sp_item_i2d_affine(item), type));
     }
 }