Code

* INTL - fixed: "Crop to" dropdown strings not translated for PDF Import
[inkscape.git] / src / tweak-context.cpp
index a66f766cfcb2ea1e0bab2f98cf576b725850594f..a70ae49d325701a3170a173dafbd550e5a8e80d8 100644 (file)
@@ -71,6 +71,7 @@
 #include "isnan.h"
 #include "prefs-utils.h"
 #include "style.h"
+#include "box3d.h"
 
 #include "tweak-context.h"
 
@@ -263,6 +264,14 @@ sp_tweak_context_setup(SPEventContext *ec)
     tc->style_set_connection = ec->desktop->connectSetStyle( // catch style-setting signal in this tool
         sigc::bind(sigc::ptr_fun(&sp_tweak_context_style_set), tc)
     );
+
+    if (prefs_get_int_attribute("tools.tweak", "selcue", 0) != 0) {
+        ec->enableSelectionCue();
+    }
+
+    if (prefs_get_int_attribute("tools.tweak", "gradientdrag", 0) != 0) {
+        ec->enableGrDrag();
+    }
 }
 
 static void
@@ -328,6 +337,12 @@ sp_tweak_dilate_recursive (Inkscape::Selection *selection, SPItem *item, NR::Poi
 {
     bool did = false;
 
+    if (SP_IS_BOX3D(item)) {
+        // convert 3D boxes to ordinary groups before tweaking their shapes
+        item = SP_ITEM(box3d_convert_to_group(SP_BOX3D(item)));
+        selection->add(item);
+    }
+
     if (SP_IS_GROUP(item)) {
         for (SPObject *child = sp_object_first_child(SP_OBJECT(item)) ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
             if (SP_IS_ITEM(child)) {
@@ -375,8 +390,9 @@ sp_tweak_dilate_recursive (Inkscape::Selection *selection, SPItem *item, NR::Poi
 
         Shape *theShape = new Shape;
         Shape *theRes = new Shape;
+        NR::Matrix i2doc(sp_item_i2doc_affine(item));
 
-        orig->ConvertWithBackData(0.08 - (0.07 * fidelity)); // default 0.059
+        orig->ConvertWithBackData((0.08 - (0.07 * fidelity)) / i2doc.expansion()); // default 0.059
         orig->Fill(theShape, 0);
 
         SPCSSAttr *css = sp_repr_css_attr(SP_OBJECT_REPR(item), "style");
@@ -398,7 +414,6 @@ sp_tweak_dilate_recursive (Inkscape::Selection *selection, SPItem *item, NR::Poi
             vector = 1/NR::L2(vector) * vector;
 
         bool did_this = false;
-        NR::Matrix i2doc(sp_item_i2doc_affine(item));
         if (mode == TWEAK_MODE_SHRINK || mode == TWEAK_MODE_GROW) {
             if (theShape->MakeTweak(tweak_mode_grow, theRes,
                                  mode == TWEAK_MODE_GROW? force : -force,
@@ -413,7 +428,7 @@ sp_tweak_dilate_recursive (Inkscape::Selection *selection, SPItem *item, NR::Poi
               did_this = true;
         } else if (mode == TWEAK_MODE_PUSH) {
             if (theShape->MakeTweak(tweak_mode_push, theRes,
-                                 0,
+                                 1.0,
                                  join_straight, 4.0,
                                  true, p, force*2*vector, radius, &i2doc) == 0)
               did_this = true;
@@ -432,10 +447,10 @@ sp_tweak_dilate_recursive (Inkscape::Selection *selection, SPItem *item, NR::Poi
             res->Reset();
             theRes->ConvertToForme(res);
 
-            double th_max = 0.6 - 0.59*sqrt(fidelity);
+            double th_max = (0.6 - 0.59*sqrt(fidelity)) / i2doc.expansion();
             double threshold = MAX(th_max, th_max*force);
             res->ConvertEvenLines(threshold);
-            res->Simplify(threshold);
+            res->Simplify(threshold / (SP_ACTIVE_DESKTOP->current_zoom()));
 
             if (newrepr) { // converting to path, need to replace the repr
                 bool is_selected = selection->includes(item);