/**
*/
/* Authors:
* Declara Denis
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include "ui/dialog/polar-arrange-tab.h"
#include "verbs.h"
#include "preferences.h"
#include "inkscape.h"
#include "selection.h"
#include "document.h"
#include "document-undo.h"
#include "sp-item.h"
#include "desktop.h"
#include "sp-ellipse.h"
#include "sp-item-transform.h"
#include <gtkmm/messagedialog.h>
namespace Inkscape {
namespace UI {
namespace Dialog {
#if WITH_GTKMM_3_0
#else
#endif
{
pack_start(anchorPointLabel, false, false);
anchorBoundingBoxRadio.signal_toggled().connect(sigc::mem_fun(*this, &PolarArrangeTab::on_anchor_radio_changed));
pack_start(anchorBoundingBoxRadio, false, false);
pack_start(anchorSelector, false, false);
anchorObjectPivotRadio.signal_toggled().connect(sigc::mem_fun(*this, &PolarArrangeTab::on_anchor_radio_changed));
pack_start(anchorObjectPivotRadio, false, false);
pack_start(arrangeOnLabel, false, false);
arrangeOnFirstCircleRadio.signal_toggled().connect(sigc::mem_fun(*this, &PolarArrangeTab::on_arrange_radio_changed));
pack_start(arrangeOnFirstCircleRadio, false, false);
arrangeOnLastCircleRadio.signal_toggled().connect(sigc::mem_fun(*this, &PolarArrangeTab::on_arrange_radio_changed));
pack_start(arrangeOnLastCircleRadio, false, false);
arrangeOnParametersRadio.signal_toggled().connect(sigc::mem_fun(*this, &PolarArrangeTab::on_arrange_radio_changed));
pack_start(arrangeOnParametersRadio, false, false);
#if WITH_GTKMM_3_0
#else
#endif
#if WITH_GTKMM_3_0
#else
#endif
#if WITH_GTKMM_3_0
#else
#endif
#if WITH_GTKMM_3_0
#else
#endif
#if WITH_GTKMM_3_0
#else
#endif
#if WITH_GTKMM_3_0
#else
#endif
pack_start(parametersTable, false, false);
rotateObjectsCheckBox.set_active(true);
pack_start(rotateObjectsCheckBox, false, false);
centerX.set_sensitive(false);
centerY.set_sensitive(false);
angleX.set_sensitive(false);
angleY.set_sensitive(false);
radiusX.set_sensitive(false);
radiusY.set_sensitive(false);
}
/**
* This function rotates an item around a given point by a given amount
* @param item item to rotate
* @param center center of the rotation to perform
* @param rotation amount to rotate the object by
*/
{
// Save old center
if(item->isCenterSet())
{
item->updateRepr();
}
}
/**
* Calculates the angle at which to put an object given the total amount
* of objects, the index of the objects as well as the arc start and end
* points
* @param arcBegin angle at which the arc begins
* @param arcEnd angle at which the arc ends
* @param count number of objects in the selection
* @param n index of the object in the selection
*/
{
if(delta > 0.01) count--; // If not a complete circle, put an object also at the extremes of the arc;
// Normalize for arcLength:
return angle;
}
/**
* Calculates the point at which an object needs to be, given the center of the ellipse,
* it's radius (x and y), as well as the angle
*/
{
}
/**
* Returns the selected anchor point in document coordinates. If anchor
* is 0 to 8, then a bounding box point has been choosen. If it is 9 however
* the rotational center is chosen.
* @todo still using a hack to get the real coordinate space (subtracting document height
* and inverting axes)
*/
{
switch(anchor)
{
case 0: // Top - Left
case 3: // Middle - Left
case 6: // Bottom - Left
break;
case 1: // Top - Middle
case 4: // Middle - Middle
case 7: // Bottom - Middle
break;
case 2: // Top - Right
case 5: // Middle - Right
case 8: // Bottom - Right
break;
};
switch(anchor)
{
case 0: // Top - Left
case 1: // Top - Middle
case 2: // Top - Right
break;
case 3: // Middle - Left
case 4: // Middle - Middle
case 5: // Middle - Right
break;
case 6: // Bottom - Left
case 7: // Bottom - Middle
case 8: // Bottom - Right
break;
};
// If using center
if(anchor == 9)
else
{
// FIXME:
}
return source;
}
/**
* Moves an SPItem to a given location, the location is based on the given anchor point.
* @param anchor 0 to 8 are the various bounding box points like follows:
* 0 1 2
* 3 4 5
* 6 7 8
* Anchor mode 9 is the rotational center of the object
* @param item Item to move
* @param p point at which to move the object
*/
{
}
{
int count = 0;
{
if(arrangeOnEllipse)
{
{
// The first selected ellipse is actually the last one in the list
if(SP_IS_GENERICELLIPSE(item))
} else {
// The last selected ellipse is actually the first in list
}
}
++count;
}
if(arrangeOnEllipse)
{
if(referenceEllipse == NULL)
{
Gtk::MessageDialog dialog(_("Couldn't find an ellipse in selection"), false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_CLOSE, true);
return;
} else {
// We decrement the count by 1 as we are not going to lay
// out the reference ellipse
--count;
}
} else {
// Read options from UI
}
{
}
int i = 0;
{
// Ignore the reference ellipse if any
if(item != referenceEllipse)
{
if(rotateObjectsCheckBox.get_active()) {
// Calculate the angle by which to rotate each object
}
++i;
}
}
_("Arrange on ellipse"));
}
{
}
{
}
{
}
} //namespace Dialog
} //namespace UI
} //namespace Inkscape
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :