summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMaximilian Albert <maximilian.albert@gmail.com>2008-09-13 15:31:36 +0000
committercilix42 <cilix42@users.sourceforge.net>2008-09-13 15:31:36 +0000
commit3727418a3e46c0bc0a7cd8fe384cf7127b549504 (patch)
treed4f9578dc4e9819b5d77b4388922186a9a2eb63d /src
parentFix to conform to the RELAX NG schema. (diff)
downloadinkscape-3727418a3e46c0bc0a7cd8fe384cf7127b549504.tar.gz
inkscape-3727418a3e46c0bc0a7cd8fe384cf7127b549504.zip
Add option to align & distribute dialog to treat the selection as a group (closes LP 255933)
(bzr r6800)
Diffstat (limited to 'src')
-rw-r--r--src/ui/dialog/align-and-distribute.cpp33
-rw-r--r--src/ui/dialog/align-and-distribute.h4
2 files changed, 32 insertions, 5 deletions
diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp
index 0e93ecb12..627f10c0c 100644
--- a/src/ui/dialog/align-and-distribute.cpp
+++ b/src/ui/dialog/align-and-distribute.cpp
@@ -122,6 +122,8 @@ private :
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);
@@ -151,7 +153,9 @@ private :
);
//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) {
@@ -208,16 +212,21 @@ private :
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));
@@ -783,7 +792,8 @@ AlignAndDistribute::AlignAndDistribute()
_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
@@ -910,7 +920,13 @@ AlignAndDistribute::AlignAndDistribute()
_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);
@@ -959,6 +975,13 @@ void AlignAndDistribute::on_ref_change(){
//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
+}
+
diff --git a/src/ui/dialog/align-and-distribute.h b/src/ui/dialog/align-and-distribute.h
index e4fdf9604..e2bb68fe5 100644
--- a/src/ui/dialog/align-and-distribute.h
+++ b/src/ui/dialog/align-and-distribute.h
@@ -70,6 +70,7 @@ public:
protected:
void on_ref_change();
+ void on_selgrp_toggled();
void addDistributeButton(const Glib::ustring &id, const Glib::ustring tiptext,
guint row, guint col, bool onInterSpace,
Geom::Dim2 orientation, float kBegin, float kEnd);
@@ -94,8 +95,11 @@ protected:
Gtk::Frame _alignFrame, _distributeFrame, _removeOverlapFrame, _graphLayoutFrame, _nodesFrame;
Gtk::Table _alignTable, _distributeTable, _removeOverlapTable, _graphLayoutTable, _nodesTable;
Gtk::HBox _anchorBox;
+ Gtk::HBox _selgrpBox;
Gtk::VBox _alignBox;
Gtk::Label _anchorLabel;
+ Gtk::Label _selgrpLabel;
+ Gtk::CheckButton _selgrp;
Gtk::ComboBoxText _combo;
Gtk::Tooltips _tooltips;