Code

refactoring, add background removal
[inkscape.git] / src / ui / dialog / transformation.cpp
index 9182209f516658a062589c24102e0773fec644d5..2cd21a560152b7e556b4e777020f7096761c44f7 100644 (file)
@@ -168,7 +168,7 @@ Transformation::~Transformation()
 ########################################################################*/
 
 void
-Transformation::present(Transformation::PageType page)
+Transformation::presentPage(Transformation::PageType page)
 {
     _notebook.set_current_page(page);
     Gtk::Dialog::show();
@@ -437,7 +437,7 @@ void
 Transformation::onSwitchPage(GtkNotebookPage *page,
                                    guint pagenum)
 {
-    updateSelection((PageType)pagenum, SP_DT_SELECTION(SP_ACTIVE_DESKTOP));
+    updateSelection((PageType)pagenum, sp_desktop_selection(SP_ACTIVE_DESKTOP));
 }
 
 void
@@ -581,7 +581,8 @@ Transformation::applyPageMove(Inkscape::Selection *selection)
             x - bbox.min()[NR::X], y - bbox.min()[NR::Y]);
     }
 
-    sp_document_done ( SP_DT_DOCUMENT (selection->desktop()) );
+    sp_document_done ( sp_desktop_document (selection->desktop()) , SP_VERB_DIALOG_TRANSFORM, 
+                       /* TODO: annotate */ "transformation.cpp:585");
 }
 
 void
@@ -613,7 +614,7 @@ Transformation::applyPageScale(Inkscape::Selection *selection)
         }
     } else {
         NR::Rect  bbox(selection->bounds());
-        NR::Point center(bbox.midpoint());
+        NR::Point center(bbox.midpoint()); // use rotation center?
         NR::scale scale (0,0);
         // the values are increments!
         if (_units_scale.isAbsolute()) {
@@ -632,7 +633,8 @@ Transformation::applyPageScale(Inkscape::Selection *selection)
         sp_selection_scale_relative(selection, center, scale);
     }
 
-    sp_document_done(SP_DT_DOCUMENT(selection->desktop()));
+    sp_document_done(sp_desktop_document(selection->desktop()), SP_VERB_DIALOG_TRANSFORM, 
+                     /* TODO: annotate */ "transformation.cpp:637");
 }
 
 void
@@ -646,13 +648,12 @@ Transformation::applyPageRotate(Inkscape::Selection *selection)
             sp_item_rotate_rel(item, NR::rotate (angle*M_PI/180.0));
         }
     } else {
-        NR::Rect  bbox   = selection->bounds();
-        NR::Point center = bbox.midpoint();
+        NR::Point center = selection->center();
         sp_selection_rotate_relative(selection, center, angle);
     }
 
-    sp_document_done(SP_DT_DOCUMENT(selection->desktop()));
-
+    sp_document_done(sp_desktop_document(selection->desktop()), SP_VERB_DIALOG_TRANSFORM, 
+                     /* TODO: annotate */ "transformation.cpp:656");
 }
 
 void
@@ -685,7 +686,7 @@ Transformation::applyPageSkew(Inkscape::Selection *selection)
         NR::Rect bbox = selection->bounds();
         double width  = bbox.max()[NR::X] - bbox.min()[NR::X];
         double height = bbox.max()[NR::Y] - bbox.min()[NR::Y];
-        NR::Point center = bbox.midpoint();
+        NR::Point center = selection->center();
 
         if (!_units_skew.isAbsolute()) { // percentage
             double skewX = _scalar_skew_horizontal.getValue("%");
@@ -704,7 +705,8 @@ Transformation::applyPageSkew(Inkscape::Selection *selection)
         }
     }
 
-    sp_document_done(SP_DT_DOCUMENT(selection->desktop()));
+    sp_document_done(sp_desktop_document(selection->desktop()), SP_VERB_DIALOG_TRANSFORM, 
+                     /* TODO: annotate */ "transformation.cpp:709");
 }
 
 
@@ -724,12 +726,14 @@ Transformation::applyPageTransform(Inkscape::Selection *selection)
         for (GSList const *l = selection->itemList(); l != NULL; l = l->next) {
             SPItem *item = SP_ITEM(l->data);
             sp_item_set_item_transform(item, displayed);
+            SP_OBJECT(item)->updateRepr();
         }
     } else {
         sp_selection_apply_affine(selection, displayed); // post-multiply each object's transform
     }
 
-    sp_document_done(SP_DT_DOCUMENT(selection->desktop()));
+    sp_document_done(sp_desktop_document(selection->desktop()), SP_VERB_DIALOG_TRANSFORM, 
+                     /* TODO: annotate */ "transformation.cpp:736");
 }