align-and-distribute.cpp revision e42e6130e1aca183d24c4e696c9fae555c49beaa
#ifdef HAVE_CONFIG_H
# include <config.h>
#include "verbs.h"
#include "removeoverlap/removeoverlap.h"
#include "graphlayout/graphlayout.h"
#include "util/glib-list-iterators.h"
#include "inkscape.h"
#include "document.h"
#include "selection.h"
#include "desktop-handles.h"
#include "macros.h"
#include "sp-item-transform.h"
#include "prefs-utils.h"
#include "enums.h"
#include "sp-text.h"
#include "sp-flowtext.h"
#include "text-editing.h"
#include "tools-switch.h"
#include "align-and-distribute.h"
namespace Inkscape {
namespace UI {
namespace Dialog {
class Action {
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_get_int_attribute("options.clonecompensation", "value", SP_CLONE_COMPENSATION_UNMOVED);
bool changed = false;
it++)
changed = true;
if (changed) {
struct BBoxSort
float anchor;
bool onInterSpace,
virtual void on_button_click() {
if (!desktop) return;
if (!selection) return;
++second;
++it)
int saved_compensation = prefs_get_int_attribute("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 (!SP_ACTIVE_DESKTOP) return;
if (!nodepath) return;
if (_distribute)
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()
if (!SP_ACTIVE_DESKTOP) return;
int saved_compensation = prefs_get_int_attribute("options.clonecompensation", "value", SP_CLONE_COMPENSATION_UNMOVED);
virtual void on_button_click()
if (!SP_ACTIVE_DESKTOP) return;
int saved_compensation = prefs_get_int_attribute("options.clonecompensation", "value", SP_CLONE_COMPENSATION_UNMOVED);
virtual void on_button_click()
if (!SP_ACTIVE_DESKTOP) return;
int saved_compensation = prefs_get_int_attribute("options.clonecompensation", "value", SP_CLONE_COMPENSATION_UNMOVED);
virtual void on_button_click()
if (!desktop) return;
if (!selection) return;
int saved_compensation = prefs_get_int_attribute("options.clonecompensation", "value", SP_CLONE_COMPENSATION_UNMOVED);
++it)
struct Baselines
bool _distribute;
virtual void on_button_click()
if (!desktop) return;
if (!selection) return;
++it)
bool changed = false;
if (_distribute) {
changed = true;
++it)
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, NR::X, false);
g_signal_connect (G_OBJECT (INKSCAPE), "change_selection", G_CALLBACK (on_selection_changed), this);
randomize_bbox_set = false;
it ++)
delete *it;
new ActionAlign(
new ActionDistribute(
new ActionNode(
void AlignAndDistribute::addRemoveOverlapsButton(const Glib::ustring &id, const Glib::ustring tiptext,
new ActionRemoveOverlaps(
new ActionGraphLayout(
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;