index 0e93ecb12350267f7a4fd2c72ede8f657e2ff320..627f10c0c4c12c3ab1ba0ee0d8f7013729b886f8 100644 (file)
Inkscape::Selection *selection = sp_desktop_selection(desktop);
if (!selection) return;
+ bool sel_as_group = (prefs_get_int_attribute("dialogs.align", "sel-as-groups", 0) != 0);
+
using Inkscape::Util::GSListConstIterator;
std::list<SPItem *> selected;
selected.insert<GSListConstIterator<SPItem *> >(selected.end(), selection->itemList(), NULL);
);
//remove the master from the selection
SPItem * thing = *master;
- selected.erase(master);
+ if (!sel_as_group) {
+ selected.erase(master);
+ }
//Compute the anchor point
boost::optional<NR::Rect> b = sp_item_bbox_desktop (thing);
if (b) {
prefs_set_int_attribute("options.clonecompensation", "value", SP_CLONE_COMPENSATION_UNMOVED);
bool changed = false;
- //Move each item in the selected list
+ boost::optional<NR::Rect> b;
+ if (sel_as_group)
+ b = selection->bounds();
+
+ //Move each item in the selected list separately
for (std::list<SPItem *>::iterator it(selected.begin());
it != selected.end();
it++)
{
sp_document_ensure_up_to_date(sp_desktop_document (desktop));
- boost::optional<NR::Rect> b = sp_item_bbox_desktop (*it);
+ if (!sel_as_group)
+ b = sp_item_bbox_desktop (*it);
if (b) {
Geom::Point const sp(a.sx0 * b->min()[Geom::X] + a.sx1 * b->max()[Geom::X],
- a.sy0 * b->min()[Geom::Y] + a.sy1 * b->max()[Geom::Y]);
+ a.sy0 * b->min()[Geom::Y] + a.sy1 * b->max()[Geom::Y]);
Geom::Point const mp_rel( mp - sp );
if (LInfty(mp_rel) > 1e-9) {
sp_item_move_rel(*it, NR::translate(mp_rel));
_removeOverlapTable(1, 5, false),
_graphLayoutTable(1, 5, false),
_nodesTable(1, 4, true),
- _anchorLabel(_("Relative to: "))
+ _anchorLabel(_("Relative to: ")),
+ _selgrpLabel(_("Treat selection as group: "))
{
//Instanciate the align buttons
_anchorBox.pack_start(_anchorLabel);
_anchorBox.pack_start(_combo);
+ _selgrpBox.pack_start(_selgrpLabel);
+ _selgrpBox.pack_start(_selgrp);
+ _selgrp.set_active(prefs_get_int_attribute("dialogs.align", "sel-as-groups", 0));
+ _selgrp.signal_toggled().connect(sigc::mem_fun(*this, &AlignAndDistribute::on_selgrp_toggled));
+
_alignBox.pack_start(_anchorBox);
+ _alignBox.pack_start(_selgrpBox);
_alignBox.pack_start(_alignTable);
_alignFrame.add(_alignBox);
//Make blink the master
}
+void AlignAndDistribute::on_selgrp_toggled(){
+
+ prefs_set_int_attribute("dialogs.align", "sel-as-groups", _selgrp.get_active());
+
+ //Make blink the master
+}
+