align-and-distribute.cpp revision 153204556626440b5c646e4d852a15edbefac510
16a8c7d5e433b176636a4a1260c42ea43932110bKrzysztof Kosiński * Align and Distribute dialog - implementation.
16a8c7d5e433b176636a4a1260c42ea43932110bKrzysztof Kosiński * Bryce W. Harrington <bryce@bryceharrington.org>
16a8c7d5e433b176636a4a1260c42ea43932110bKrzysztof Kosiński * Aubanel MONNIER <aubi@libertysurf.fr>
16a8c7d5e433b176636a4a1260c42ea43932110bKrzysztof Kosiński * Frank Felfe <innerspace@iname.com>
16a8c7d5e433b176636a4a1260c42ea43932110bKrzysztof Kosiński * Lauris Kaplinski <lauris@kaplinski.com>
16a8c7d5e433b176636a4a1260c42ea43932110bKrzysztof Kosiński * Tim Dwyer <tgdwyer@gmail.com>
16a8c7d5e433b176636a4a1260c42ea43932110bKrzysztof Kosiński * Jon A. Cruz <jon@joncruz.org>
16a8c7d5e433b176636a4a1260c42ea43932110bKrzysztof Kosiński * Abhishek Sharma
16a8c7d5e433b176636a4a1260c42ea43932110bKrzysztof Kosiński * Copyright (C) 1999-2004, 2005 Authors
16a8c7d5e433b176636a4a1260c42ea43932110bKrzysztof Kosiński * Released under GNU GPL. Read the file 'COPYING' for more information.
16a8c7d5e433b176636a4a1260c42ea43932110bKrzysztof Kosiński#include "ui/tool/multi-path-manipulator.h"
16a8c7d5e433b176636a4a1260c42ea43932110bKrzysztof Kosiński/////////helper classes//////////////////////////////////
virtual ~Action(){}
virtual void on_button_click(){}
struct Coeffs {
virtual void on_button_click() {
if (!desktop) return;
if (!selection) return;
switch (target)
++second;
// Top hack: temporarily set clone compensation to unmoved, so that we can align/distribute
// expecation. However this is a minor point compared to making align/distribute always
int saved_compensation = prefs->getInt("/options/clonecompensation/value", SP_CLONE_COMPENSATION_UNMOVED);
bool changed = false;
if (sel_as_group)
it++)
if (!sel_as_group)
changed = true;
if (changed) {
BBoxSort::BBoxSort(SPItem *pItem, Geom::Rect const &bounds, Geom::Dim2 orientation, double kBegin, double kEnd) :
bool onInterSpace,
virtual void on_button_click() {
if (!desktop) return;
if (!selection) return;
++second;
++it)
if (bbox) {
int saved_compensation = prefs->getInt("/options/clonecompensation/value", SP_CLONE_COMPENSATION_UNMOVED);
bool changed = false;
if (_onInterSpace)
float span = 0;
for (unsigned int i = 0; i < len; i++)
it ++ )
changed = true;
for ( unsigned int i = 0; i < len ; i ++ )
changed = true;
if (changed) {
bool _onInterSpace;
double _kBegin;
double _kEnd;
bool _distribute;
virtual void on_button_click()
if (_distribute)
removeOverlapXGap.set_tooltip_text(_("Minimum horizontal gap (in px units) between bounding boxes"));
dialog.removeOverlap_table().attach(removeOverlapXGapLabel, column, column+1, row, row+1, Gtk::FILL, Gtk::FILL);
dialog.removeOverlap_table().attach(removeOverlapXGap, column+1, column+2, row, row+1, Gtk::FILL, Gtk::FILL);
dialog.removeOverlap_table().attach(removeOverlapYGapLabel, column+2, column+3, row, row+1, Gtk::FILL, Gtk::FILL);
dialog.removeOverlap_table().attach(removeOverlapYGap, column+3, column+4, row, row+1, Gtk::FILL, Gtk::FILL);
virtual void on_button_click()
int saved_compensation = prefs->getInt("/options/clonecompensation/value", SP_CLONE_COMPENSATION_UNMOVED);
virtual void on_button_click()
int saved_compensation = prefs->getInt("/options/clonecompensation/value", SP_CLONE_COMPENSATION_UNMOVED);
enum SortOrder {
None,
if (a == NULL) return false;
if (b == NULL) return true;
if (center) {
return (a->isSiblingOf(b));
virtual void on_button_click()
if (!desktop) return;
if (!selection) return;
int saved_compensation = prefs->getInt("/options/clonecompensation/value", SP_CLONE_COMPENSATION_UNMOVED);
virtual void on_button_click()
int saved_compensation = prefs->getInt("/options/clonecompensation/value", SP_CLONE_COMPENSATION_UNMOVED);
virtual void on_button_click()
if (!desktop) return;
if (!selection) return;
if (!sel_bbox) {
int saved_compensation = prefs->getInt("/options/clonecompensation/value", SP_CLONE_COMPENSATION_UNMOVED);
++it)
if (item_box) {
g_random_double_range (0, (*_dialog.randomize_bbox)[Geom::X].extent() - (*item_box)[Geom::X].extent());
g_random_double_range (0, (*_dialog.randomize_bbox)[Geom::Y].extent() - (*item_box)[Geom::Y].extent());
struct Baselines
bool _distribute;
virtual void on_button_click()
if (!desktop) return;
if (!selection) return;
++it)
if (pt) {
bool changed = false;
if (_distribute) {
changed = true;
if (changed) {
++it)
if (pt) {
changed = true;
if (changed) {
void on_tool_changed(Inkscape::Application */*inkscape*/, SPEventContext */*context*/, AlignAndDistribute *daad)
void on_selection_changed(Inkscape::Application */*inkscape*/, Inkscape::Selection */*selection*/, AlignAndDistribute *daad)
0, Geom::X, false);
g_signal_connect (G_OBJECT (INKSCAPE), "change_selection", G_CALLBACK (on_selection_changed), this);
++it)
delete *it;
new ActionAlign(
new ActionDistribute(
new ActionNode(
void AlignAndDistribute::addRemoveOverlapsButton(const Glib::ustring &id, const Glib::ustring tiptext,
new ActionRemoveOverlaps(
new ActionGraphLayout(
void AlignAndDistribute::addExchangePositionsButton(const Glib::ustring &id, const Glib::ustring tiptext,
void AlignAndDistribute::addExchangePositionsByZOrderButton(const Glib::ustring &id, const Glib::ustring tiptext,
void AlignAndDistribute::addExchangePositionsClockwiseButton(const Glib::ustring &id, const Glib::ustring tiptext,
new ActionUnclump(
new ActionRandomize(
new ActionBaseline(
std::list<SPItem *>::iterator AlignAndDistribute::find_master( std::list<SPItem *> &list, bool horizontal){
switch (getAlignTarget()) {
case LAST:
case FIRST:
case BIGGEST:
return master;
case SMALLEST:
return master;
return master;