Code

Fixing scrollbar size for embeded color swatches.
[inkscape.git] / src / selection-chemistry.cpp
index 0ba60a91cac30868e47ed6d025261d3e3b23fd5e..36f3b1b3f1b4d8e635f19bb450b3ac88f100f438 100644 (file)
@@ -129,7 +129,7 @@ void sp_selection_copy_impl (const GSList *items, GSList **clip, GSList **defs_c
 /**
 Add gradients/patterns/markers referenced by copied objects to defs
 */
-void 
+void
 paste_defs (GSList **defs_clip, SPDocument *doc)
 {
     if (!defs_clip)
@@ -299,7 +299,7 @@ get_all_items (GSList *list, SPObject *from, SPDesktop *desktop, bool onlyvisibl
     for (SPObject *child = sp_object_first_child(SP_OBJECT(from)) ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
         if (SP_IS_ITEM(child) &&
             !desktop->isLayer(SP_ITEM(child)) &&
-            (!onlysensitive || !SP_ITEM(child)->isLocked()) && 
+            (!onlysensitive || !SP_ITEM(child)->isLocked()) &&
             (!onlyvisible || !desktop->itemIsHidden(SP_ITEM(child))) &&
             (!exclude || !g_slist_find ((GSList *) exclude, child))
             )
@@ -809,7 +809,7 @@ void sp_copy_gradient (GSList **defs_clip, SPGradient *gradient)
 {
     SPGradient *ref = gradient;
 
-    while (ref) { 
+    while (ref) {
         // climb up the refs, copying each one in the chain
         Inkscape::XML::Node *grad_repr = SP_OBJECT_REPR(ref)->duplicate();
         *defs_clip = g_slist_prepend (*defs_clip, grad_repr);
@@ -858,9 +858,9 @@ void sp_copy_textpath_path (GSList **defs_clip, SPTextPath *tp, const GSList *it
 
 void sp_copy_stuff_used_by_item (GSList **defs_clip, SPItem *item, const GSList *items)
 {
-    SPStyle *style = SP_OBJECT_STYLE (item); 
+    SPStyle *style = SP_OBJECT_STYLE (item);
 
-    if (style && (style->fill.type == SP_PAINT_TYPE_PAINTSERVER)) { 
+    if (style && (style->fill.type == SP_PAINT_TYPE_PAINTSERVER)) {
         SPObject *server = SP_OBJECT_STYLE_FILL_SERVER(item);
         if (SP_IS_LINEARGRADIENT (server) || SP_IS_RADIALGRADIENT (server))
             sp_copy_gradient (defs_clip, SP_GRADIENT(server));
@@ -868,7 +868,7 @@ void sp_copy_stuff_used_by_item (GSList **defs_clip, SPItem *item, const GSList
             sp_copy_pattern (defs_clip, SP_PATTERN(server));
     }
 
-    if (style && (style->stroke.type == SP_PAINT_TYPE_PAINTSERVER)) { 
+    if (style && (style->stroke.type == SP_PAINT_TYPE_PAINTSERVER)) {
         SPObject *server = SP_OBJECT_STYLE_STROKE_SERVER(item);
         if (SP_IS_LINEARGRADIENT (server) || SP_IS_RADIALGRADIENT (server))
             sp_copy_gradient (defs_clip, SP_GRADIENT(server));
@@ -876,7 +876,7 @@ void sp_copy_stuff_used_by_item (GSList **defs_clip, SPItem *item, const GSList
             sp_copy_pattern (defs_clip, SP_PATTERN(server));
     }
 
-    if (SP_IS_SHAPE (item)) { 
+    if (SP_IS_SHAPE (item)) {
         SPShape *shape = SP_SHAPE (item);
         for (int i = 0 ; i < SP_MARKER_LOC_QTY ; i++) {
             if (shape->marker[i]) {
@@ -959,7 +959,7 @@ void sp_selection_copy()
     const GSList *items = g_slist_copy ((GSList *) selection->itemList());
 
     // 0. Copy text to system clipboard
-    // FIXME: for non-texts, put serialized XML as text to the clipboard; 
+    // FIXME: for non-texts, put serialized XML as text to the clipboard;
     //for this sp_repr_write_stream needs to be rewritten with iostream instead of FILE
     Glib::ustring text;
     if (tools_isactive (desktop, TOOLS_TEXT)) {
@@ -998,8 +998,8 @@ void sp_selection_copy()
         sp_repr_css_attr_unref (style_clipboard);
         style_clipboard = NULL;
     }
-  
-    //clear main clipboard 
+
+    //clear main clipboard
     while (clipboard) {
         Inkscape::GC::release((Inkscape::XML::Node *) clipboard->data);
         clipboard = g_slist_remove(clipboard, clipboard->data);
@@ -1030,7 +1030,7 @@ void sp_selection_copy()
 void sp_selection_paste(bool in_place)
 {
     SPDesktop *desktop = SP_ACTIVE_DESKTOP;
-    
+
     if (desktop == NULL) {
         return;
     }
@@ -1103,7 +1103,7 @@ void sp_selection_paste_style()
     sp_document_done(SP_DT_DOCUMENT (desktop));
 }
 
-void sp_selection_to_next_layer () 
+void sp_selection_to_next_layer ()
 {
     SPDesktop *dt = SP_ACTIVE_DESKTOP;
 
@@ -1135,7 +1135,7 @@ void sp_selection_to_next_layer ()
     g_slist_free ((GSList *) items);
 }
 
-void sp_selection_to_prev_layer () 
+void sp_selection_to_prev_layer ()
 {
     SPDesktop *dt = SP_ACTIVE_DESKTOP;
 
@@ -1153,7 +1153,7 @@ void sp_selection_to_prev_layer ()
     if (next) {
         GSList *temp_clip = NULL;
         sp_selection_copy_impl (items, &temp_clip, NULL, NULL); // we're in the same doc, so no need to copy defs
-        sp_selection_delete_impl (items); 
+        sp_selection_delete_impl (items);
         GSList *copied = sp_selection_paste_impl (SP_DT_DOCUMENT (dt), next, &temp_clip, NULL);
         selection->setReprList((GSList const *) copied);
         g_slist_free (copied);
@@ -1182,7 +1182,7 @@ void sp_selection_apply_affine(Inkscape::Selection *selection, NR::Matrix const
         SPItem *item = SP_ITEM(l->data);
 
         NR::Point old_center(0,0);
-        if (set_i2d && item->isCenterSet()) 
+        if (set_i2d && item->isCenterSet())
             old_center = item->getCenter();
 
 #if 0 /* Re-enable this once persistent guides have a graphical indication.
@@ -1232,7 +1232,7 @@ void sp_selection_apply_affine(Inkscape::Selection *selection, NR::Matrix const
 
             // calculate the matrix we need to apply to the clone to cancel its induced transform from its original
             NR::Matrix t = matrix_to_desktop (matrix_from_desktop (affine, item), item);
-            NR::Matrix t_inv = matrix_to_desktop (matrix_from_desktop (affine.inverse(), item), item); 
+            NR::Matrix t_inv = matrix_to_desktop (matrix_from_desktop (affine.inverse(), item), item);
             NR::Matrix result = t_inv * item->transform * t;
 
             if ((prefs_parallel || prefs_unmoved) && affine.is_translation()) {
@@ -1301,7 +1301,7 @@ sp_selection_scale_absolute(Inkscape::Selection *selection,
 
     NR::Rect const bbox(selection->bounds());
     if (bbox.isEmpty()) {
-        return; 
+        return;
     }
 
     NR::translate const p2o(-bbox.min());
@@ -1562,7 +1562,7 @@ SPItem *next_item(SPDesktop *desktop, GSList *path, SPObject *root,
                   bool only_in_viewport, bool inlayer, bool onlyvisible, bool onlysensitive);
 
 template <typename D>
-SPItem *next_item_from_list(SPDesktop *desktop, GSList const *items, SPObject *root, 
+SPItem *next_item_from_list(SPDesktop *desktop, GSList const *items, SPObject *root,
                   bool only_in_viewport, bool inlayer, bool onlyvisible, bool onlysensitive);
 
 struct Forward {
@@ -2026,7 +2026,7 @@ sp_selection_untile()
 
         SPStyle *style = SP_OBJECT_STYLE (item);
 
-        if (!style || style->fill.type != SP_PAINT_TYPE_PAINTSERVER) 
+        if (!style || style->fill.type != SP_PAINT_TYPE_PAINTSERVER)
             continue;
 
         SPObject *server = SP_OBJECT_STYLE_FILL_SERVER(item);
@@ -2046,7 +2046,7 @@ sp_selection_untile()
             SPItem *i = SP_ITEM (desktop->currentLayer()->appendChildRepr(copy));
 
            // FIXME: relink clones to the new canvas objects
-           // use SPObject::setid when mental finishes it to steal ids of 
+           // use SPObject::setid when mental finishes it to steal ids of
 
             // this is needed to make sure the new item has curve (simply requestDisplayUpdate does not work)
             sp_document_ensure_up_to_date (document);
@@ -2105,7 +2105,7 @@ sp_selection_create_bitmap_copy ()
     // multiple times, and this is done so that they don't clash)
     GTimeVal cu;
     g_get_current_time (&cu);
-    guint current = (int) (cu.tv_sec * 1000000 + cu.tv_usec) % 1024; 
+    guint current = (int) (cu.tv_sec * 1000000 + cu.tv_usec) % 1024;
 
     // Create the filename
     gchar *filename = g_strdup_printf ("%s-%s-%u.png", document->name, SP_OBJECT_REPR(items->data)->attribute("id"), current);
@@ -2164,7 +2164,7 @@ sp_selection_create_bitmap_copy ()
 
     // Calculate the matrix that will be applied to the image so that it exactly overlaps the source objects
     NR::Matrix eek = sp_item_i2d_affine (SP_ITEM(parent_object));
-    NR::Matrix t = NR::scale (1/res, -1/res) * NR::translate (bbox.x0, bbox.y1) * eek.inverse(); 
+    NR::Matrix t = NR::scale (1/res, -1/res) * NR::translate (bbox.x0, bbox.y1) * eek.inverse();
 
     // Do the export
     sp_export_png_file(document, filepath,
@@ -2197,12 +2197,12 @@ sp_selection_create_bitmap_copy ()
         gchar c[256];
         if (sp_svg_transform_write(c, 256, t)) {
             repr->setAttribute("transform", c);
-        } 
+        }
 
         // add the new repr to the parent
         parent->appendChild(repr);
 
-        // move to the saved position 
+        // move to the saved position
         repr->setPosition(pos > 0 ? pos + 1 : 1);
 
         // Set selection to the new image