knot-holder-entity.cpp revision ff167176a03ecdec32a72a475341dc6cf7ff7afe
/*
* KnotHolderEntity definition.
*
* Authors:
* Mitsuru Oka <oka326@parkcity.ne.jp>
* Maximilian Albert <maximilian.albert@gmail.com>
* Abhishek Sharma
*
* Copyright (C) 1999-2001 Lauris Kaplinski
* Copyright (C) 2000-2001 Ximian, Inc.
* Copyright (C) 2001 Mitsuru Oka
* Copyright (C) 2004 Monash University
* Copyright (C) 2008 Maximilian Albert
*
* Released under GNU GPL
*/
#include "knot-holder-entity.h"
#include "knotholder.h"
#include "sp-item.h"
#include "style.h"
#include "preferences.h"
#include "macros.h"
#include "sp-pattern.h"
#include "snap.h"
#include "desktop.h"
#include "sp-namedview.h"
int KnotHolderEntity::counter = 0;
void KnotHolderEntity::create(SPDesktop *desktop, SPItem *item, KnotHolder *parent, Inkscape::ControlType type,
{
this->parent_holder = parent;
// TODO base more appearance from this type instead of passing in arbitrary values.
update_knot();
_moved_connection = knot->moved_signal.connect(sigc::mem_fun(*parent_holder, &KnotHolder::knot_moved_handler));
_click_connection = knot->click_signal.connect(sigc::mem_fun(*parent_holder, &KnotHolder::knot_clicked_handler));
_ungrabbed_connection = knot->ungrabbed_signal.connect(sigc::mem_fun(*parent_holder, &KnotHolder::knot_ungrabbed_handler));
}
{
/* unref should call destroy */
if (knot) {
//g_object_unref(knot);
} else {
// FIXME: This shouldn't occur. Perhaps it is caused by LPE PointParams being knotholder entities, too
// If so, it will likely be fixed with upcoming refactoring efforts.
}
}
void
{
}
{
return p;
}
m.unSetup();
}
KnotHolderEntity::snap_knot_position_constrained(Geom::Point const &p, Inkscape::Snapper::SnapConstraint const &constraint, guint state)
{
return p;
}
// constrainedSnap() will first project the point p onto the constraint line and then try to snap along that line.
// This way the constraint is already enforced, no need to worry about that later on
Inkscape::Snapper::SnapConstraint transformed_constraint = Inkscape::Snapper::SnapConstraint(constraint.getPoint() * i2d, (constraint.getPoint() + constraint.getDirection()) * i2d - constraint.getPoint() * i2d);
m.unSetup();
}
/* Pattern manipulation */
/* TODO: this pattern manipulation is not able to handle general transformation matrices. Only matrices that are the result of a pure scale times a pure rotation. */
{
}
{
}
{
}
void
{
// FIXME: this snapping should be done together with knowing whether control was pressed. If GDK_CONTROL_MASK, then constrained snapping should be used.
if ( state & GDK_CONTROL_MASK ) {
} else {
}
}
if (state) {
}
}
PatternKnotHolderEntityXY::knot_get() const
{
return sp_pattern_extract_trans(pat);
}
PatternKnotHolderEntityAngle::knot_get() const
{
gdouble y = 0;
return delta;
}
void
PatternKnotHolderEntityAngle::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint state)
{
// get the angle from pattern 0,0 to the cursor pos
if ( state & GDK_CONTROL_MASK ) {
}
// get the scale from the current transform so we can keep it.
}
void
PatternKnotHolderEntityScale::knot_set(Geom::Point const &p, Geom::Point const &/*origin*/, guint state)
{
// FIXME: this snapping should be done together with knowing whether control was pressed. If GDK_CONTROL_MASK, then constrained snapping should be used.
// get angle from current transform
// Get the new scale from the position of the knotholder
if ( state & GDK_CONTROL_MASK ) {
// if ctrl is pressed: use 1:1 scaling
} else {
}
}
PatternKnotHolderEntityScale::knot_get() const
{
a[4] = 0;
a[5] = 0;
return delta;
}
/*
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 :