Code

Disable the page selector when there's only one page
[inkscape.git] / src / sp-item.cpp
index 9e836e84ae6e6287ede0a95f0467036d8c87ae3b..338a70c4ed4b838866151848821a4ce8b81ced9e 100644 (file)
@@ -50,6 +50,7 @@
 #include "prefs-utils.h"
 #include "conn-avoid-ref.h"
 #include "conditions.h"
+#include "sp-filter-reference.h"
 
 #include "libnr/nr-matrix-div.h"
 #include "libnr/nr-matrix-fns.h"
@@ -61,6 +62,7 @@
 #include "util/reverse-list.h"
 
 #include "xml/repr.h"
+#include "extract-uri.h"
 
 #define noSP_ITEM_DEBUG_IDLE
 
@@ -447,7 +449,7 @@ sp_item_set(SPObject *object, unsigned key, gchar const *value)
             break;
         }
         case SP_PROP_CLIP_PATH: {
-            gchar *uri = Inkscape::parse_css_url(value);
+            gchar *uri = extract_uri(value);
             if (uri) {
                 try {
                     item->clip_ref->attach(Inkscape::URI(uri));
@@ -463,7 +465,7 @@ sp_item_set(SPObject *object, unsigned key, gchar const *value)
             break;
         }
         case SP_PROP_MASK: {
-            gchar *uri=Inkscape::parse_css_url(value);
+            gchar *uri = extract_uri(value);
             if (uri) {
                 try {
                     item->mask_ref->attach(Inkscape::URI(uri));
@@ -621,6 +623,13 @@ sp_item_update(SPObject *object, SPCtx *ctx, guint flags)
         }
     }
 
+    if (item->display && item->display->arenaitem) {
+        NRRect item_bbox;
+        sp_item_invoke_bbox(item, &item_bbox, NR::identity(), TRUE, SPItem::GEOMETRIC_BBOX);
+        NR::Maybe<NR::Rect> i_bbox = item_bbox;
+        nr_arena_item_set_item_bbox(item->display->arenaitem, i_bbox);
+    }
+
     // Update libavoid with item geometry (for connector routing).
     item->avoidRef->handleSettingChange();
 }
@@ -762,12 +771,17 @@ NR::Maybe<NR::Rect> sp_item_bbox_desktop(SPItem *item, SPItem::BBoxType type)
 static void sp_item_private_snappoints(SPItem const *item, SnapPointsIter p)
 {
     NR::Maybe<NR::Rect> bbox = item->getBounds(sp_item_i2d_affine(item));
-    /* Just a pair of opposite corners of the bounding box suffices given that we don't yet
+    /* Just the corners of the bounding box suffices given that we don't yet
        support angled guide lines. */
 
     if (bbox) {
-        *p = bbox->min();
-        *p = bbox->max();
+        NR::Point p1, p2;
+        p1 = bbox->min();
+        p2 = bbox->max();
+        *p = p1;
+        *p = NR::Point(p1[NR::X], p2[NR::Y]);
+        *p = p2;
+        *p = NR::Point(p1[NR::Y], p2[NR::X]);
     }
 }
 
@@ -910,6 +924,10 @@ sp_item_invoke_show(SPItem *item, NRArena *arena, unsigned key, unsigned flags)
             SP_OBJECT(mask)->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
         }
         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<NR::Rect> i_bbox = item_bbox;
+        nr_arena_item_set_item_bbox(ai, i_bbox);
     }
 
     return ai;
@@ -1195,7 +1213,7 @@ sp_item_write_transform(SPItem *item, Inkscape::XML::Node *repr, NR::Matrix cons
              !preserve && // user did not chose to preserve all transforms
              !item->clip_ref->getObject() && // the object does not have a clippath
              !item->mask_ref->getObject() && // the object does not have a mask
-             !(!transform.is_translation() && SP_OBJECT_STYLE(item) && SP_OBJECT_STYLE(item)->filter.filter
+         !(!transform.is_translation() && SP_OBJECT_STYLE(item) && SP_OBJECT_STYLE(item)->getFilter()
              // the object does not have a filter, or the transform is translation (which is supposed to not affect filters)
         ) {
         transform_attr = ((SPItemClass *) G_OBJECT_GET_CLASS(item))->set_transform(item, transform);