shape-editor.cpp revision 72aa7310f3a87958233d5cb4bf1386ff999be0ac
#define __SHAPE_EDITOR_CPP__
/*
* Inkscape::ShapeEditor
*
* Authors:
* bulia byak <buliabyak@users.sf.net>
*
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <string.h>
#include "sp-object.h"
#include "sp-item.h"
#include "live_effects/lpeobject.h"
#include "selection.h"
#include "desktop.h"
#include "desktop-handles.h"
#include "knotholder.h"
#include "node-context.h"
#include "xml/node-event-vector.h"
#include "prefs-utils.h"
#include "object-edit.h"
#include "splivarot.h"
#include "style.h"
#include "shape-editor.h"
}
}
void ShapeEditorsCollective::update_statusbar() {
//!!! move from nodepath: sp_nodepath_update_statusbar but summing for all nodepaths
}
this->grab_node = -1;
this->knotholder = NULL;
this->hit = false;
}
ShapeEditor::~ShapeEditor() {
unset_item();
}
void ShapeEditor::unset_item() {
if (this->nodepath) {
}
if (!old_repr && this->knotholder) {
}
if (old_repr) { // remove old listener
}
if (this->nodepath) {
this->grab_node = -1;
sp_nodepath_destroy(this->nodepath);
}
if (this->knotholder) {
sp_knot_holder_destroy(this->knotholder);
this->knotholder = NULL;
}
}
bool ShapeEditor::has_nodepath () {
}
bool ShapeEditor::has_knotholder () {
return (this->knotholder != NULL);
}
bool ShapeEditor::has_local_change () {
if (this->nodepath)
return (this->nodepath->local_change != 0);
else if (this->knotholder)
return (this->knotholder->local_change != 0);
else
return false;
}
void ShapeEditor::decrement_local_change () {
if (this->nodepath) {
if (this->nodepath->local_change > 0)
this->nodepath->local_change--;
} else if (this->knotholder) {
}
}
if (this->has_nodepath()) {
} else if (this->has_knotholder()) {
}
return item;
}
if (this->nodepath)
return ::save_nodepath_selection (this->nodepath);
return NULL;
}
}
}
return false;
}
{
{
}
if (changed) {
if (sh->has_nodepath()) {
}
sh->reset_item ();
g_list_free (saved);
}
}
}
NULL, /* child_added */
NULL, /* child_removed */
NULL, /* content_changed */
NULL /* order_changed */
};
unset_item();
this->grab_node = -1;
if (item) {
this->nodepath = sp_nodepath_new(desktop, item, (prefs_get_int_attribute("tools.nodes", "show_handles", 1) != 0));
if (this->nodepath) {
this->nodepath->shape_editor = this;
}
if (this->nodepath || this->knotholder) {
// setting new listener
if (this->knotholder)
else
if (repr) {
}
}
}
}
/** Please note that this function only works for path parameters.
* All other parameters probably will crash Inkscape!
* Fortunately, there are no other on-canvas edittable objects at this moment :)
*/
void ShapeEditor::set_item_livepatheffect_parameter(SPItem *item, SPObject *lpeobject, const char * key) {
unset_item();
this->grab_node = -1;
if (lpeobject) {
if (this->nodepath) {
this->nodepath->shape_editor = this;
// setting new listener
if (repr) {
}
}
}
}
/** FIXME: think about this. Is this thing only called when the item needs to be updated?
Why not make a reload function in NodePath and in KnotHolder? */
void ShapeEditor::reset_item ()
{
} else {
}
}
void ShapeEditor::nodepath_destroyed () {
}
void ShapeEditor::update_statusbar () {
if (this->nodepath)
sp_nodepath_update_statusbar(this->nodepath);
}
if (!this->nodepath)
return false; // no stroke in knotholder
//Translate click point into proper coord system
NR::Maybe<Path::cut_position> position = get_nearest_position_on_Path(this->nodepath->livarot_path, this->curvepoint_doc);
if (!position) {
return false;
}
double stroke_tolerance =
desktop->current_zoom() *
: 0.0)
+ prefs_get_int_attribute_limited("options.dragtolerance", "value", 0, 0, 100)) /sp_item_i2d_affine (item).expansion();
this->hit = true;
}
return close;
}
void ShapeEditor::add_node_near_point() {
if (this->nodepath) {
} else if (this->knotholder) {
// we do not add nodes in knotholder... yet
}
}
if (this->nodepath) {
} else if (this->knotholder) {
// we do not select segments in knotholder... yet?
}
}
void ShapeEditor::cancel_hit() {
this->hit = false;
}
bool ShapeEditor::hits_curve() {
return (this->hit);
}
return;
// We round off the extra precision in the motion coordinates provided
// by some input devices (like tablets). As we'll store the coordinates
// as integers in curvepoint_event we need to do this rounding before
// comparing them with the last coordinates from curvepoint_event.
// See bug #1593499 for details.
// The coordinates hasn't changed since the last motion event, abort
if (this->curvepoint_event[NR::X] == x &&
this->curvepoint_event[NR::Y] == y)
return;
sp_nodepath_curve_drag (this->grab_node, this->grab_t, delta_dt); //!!! FIXME: which nodepath?!!! also uses current!!!
this->curvepoint_event[NR::X] = x;
this->curvepoint_event[NR::Y] = y;
} else if (this->knotholder) {
// we do not drag curve in knotholder
}
}
void ShapeEditor::finish_drag() {
}
}
if (this->nodepath) {
}
}
bool ShapeEditor::has_selection() {
if (this->nodepath)
return false; // so far, knotholder cannot have selection
}
void ShapeEditor::deselect() {
if (this->nodepath)
sp_nodepath_deselect(this->nodepath);
}
void ShapeEditor::add_node () {
sp_node_selected_add_node(this->nodepath);
}
void ShapeEditor::delete_nodes () {
sp_node_selected_delete(this->nodepath);
}
void ShapeEditor::delete_nodes_preserving_shape () {
}
}
void ShapeEditor::delete_segment () {
}
}
void ShapeEditor::break_at_nodes() {
sp_node_selected_break(this->nodepath);
}
void ShapeEditor::join_nodes() {
sp_node_selected_join(this->nodepath);
}
void ShapeEditor::join_segments() {
}
void ShapeEditor::duplicate_nodes() {
sp_node_selected_duplicate(this->nodepath);
}
}
}
}
if (this->nodepath)
}
}
}
if (this->nodepath)
}
if (this->nodepath)
}
void ShapeEditor::select_next () {
if (this->nodepath) {
sp_nodepath_select_next (this->nodepath);
}
}
}
void ShapeEditor::select_prev () {
if (this->nodepath) {
sp_nodepath_select_prev (this->nodepath);
}
}
}
}
if (this->nodepath)
}
if (this->nodepath)
}
if (this->nodepath)
}
if (this->nodepath)
}
/*
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 :