/*
* Container for SPKnot visual handles.
*
* Authors:
* Mitsuru Oka <oka326@parkcity.ne.jp>
* bulia byak <buliabyak@users.sf.net>
* Maximilian Albert <maximilian.albert@gmail.com>
* Abhishek Sharma
* Jon A. Cruz <jon@joncruz.org>
*
* Copyright (C) 2001-2008 authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include "document.h"
#include "document-undo.h"
#include "sp-shape.h"
#include "knot.h"
#include "knotholder.h"
#include "knot-holder-entity.h"
#include "ui/tools/rect-tool.h"
#include "sp-rect.h"
#include "ui/tools/arc-tool.h"
#include "sp-ellipse.h"
#include "ui/tools/tweak-tool.h"
#include "sp-star.h"
#include "ui/tools/spiral-tool.h"
#include "sp-spiral.h"
#include "sp-offset.h"
#include "box3d.h"
#include "sp-pattern.h"
#include "style.h"
#include "live_effects/lpeobject.h"
#include "live_effects/effect.h"
#include "desktop.h"
#include "display/sp-canvas.h"
#include "display/sp-canvas-item.h"
#include "verbs.h"
#include "ui/control-manager.h"
using Inkscape::ControlManager;
using Inkscape::DocumentUndo;
class SPDesktop;
//XML Tree being used directly for item->getRepr() while it shouldn't be...
entity(),
dragging(false)
{
g_print ("Error! Throw an exception, please!\n");
}
sizeUpdatedConn = ControlManager::getManager().connectCtrlSizeChanged(sigc::mem_fun(*this, &KnotHolder::updateControlSizes));
}
KnotHolder::~KnotHolder() {
{
delete (*i);
(*i) = NULL;
}
}
{
KnotHolderEntity *e = *it;
}
}
{
KnotHolderEntity *e = *i;
e->update_knot();
}
}
/**
* Returns true if at least one of the KnotHolderEntities has the mouse hovering above it.
*/
return true;
}
}
return false;
}
void
{
for(std::list<KnotHolderEntity *>::iterator i = knot_holder->entity.begin(); i != knot_holder->entity.end(); ++i) {
KnotHolderEntity *e = *i;
// no need to test whether knot_click exists since it's virtual now
e->knot_click(state);
break;
}
}
{
if (savedShape) {
savedShape->set_shape();
}
}
// TODO extract duplicated blocks;
if (dynamic_cast<SPRect *>(saved_item)) {
} else if (dynamic_cast<SPBox3D *>(saved_item)) {
} else if (dynamic_cast<SPGenericEllipse *>(saved_item)) {
} else if (dynamic_cast<SPStar *>(saved_item)) {
} else if (dynamic_cast<SPSpiral *>(saved_item)) {
} else {
if (offset) {
if (offset->sourceHref) {
} else {
}
}
}
// for drag, this is done by ungrabbed_handler, but for click we must do it here
if (saved_item) { //increasingly aggressive sanity checks
if (saved_item->document) {
// enum is unsigned so can't be less than SP_VERB_INVALID
if (object_verb <= SP_VERB_LAST) {
_("Change handle"));
}
}
} // else { abort(); }
}
void
{
if (this->dragging == false) {
this->dragging = true;
}
// this was a local change and the knotholder does not need to be recreated:
this->local_change = TRUE;
for(std::list<KnotHolderEntity *>::iterator i = this->entity.begin(); i != this->entity.end(); ++i) {
KnotHolderEntity *e = *i;
break;
}
}
if (shape) {
}
this->update_knots();
}
void
{
this->dragging = false;
if (this->released) {
} else {
// Caution: this call involves a screen update, which may process events, and as a
// result the knotholder may be destructed. So, after the updateRepr, we cannot use any
// fields of this knotholder (such as this->item), but only values we have saved beforehand
// (such as object).
object->updateRepr();
/* do cleanup tasks (e.g., for LPE items write the parameter values
* that were changed by dragging the handle to SVG)
*/
if (lpeItem) {
// This writes all parameters to SVG. Is this sufficiently efficient or should we only
// write the ones that were changed?
if (lpe) {
lpeobj->updateRepr();
}
}
// TODO extract duplicated blocks:
} else if (dynamic_cast<SPGenericEllipse *>(object)) {
} else {
if (offset) {
if (offset->sourceHref) {
} else {
}
}
}
}
}
{
// g_message("Adding a knot at %p", e);
}
{
if ((item->style->fill.isPaintserver()) && dynamic_cast<SPPattern *>(item->style->getFillPaintServer())) {
// TRANSLATORS: This refers to the pattern that's inside the object
_("<b>Move</b> the pattern fill inside the object"),
_("<b>Scale</b> the pattern fill; uniformly if with <b>Ctrl</b>"),
_("<b>Rotate</b> the pattern fill; with <b>Ctrl</b> to snap angle"),
}
if ((item->style->stroke.isPaintserver()) && dynamic_cast<SPPattern *>(item->style->getStrokePaintServer())) {
// TRANSLATORS: This refers to the pattern that's inside the object
_("<b>Move</b> the pattern fill inside the object"),
_("<b>Scale</b> the pattern fill; uniformly if with <b>Ctrl</b>"),
_("<b>Rotate</b> the pattern fill; with <b>Ctrl</b> to snap angle"),
}
}
/*
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 :