shape-editor.cpp revision 981b809bc6ed10a21e89444d9447e5475801874f
#define __SHAPE_EDITOR_CPP__
/*
* Inkscape::ShapeEditor
*
* Authors:
* bulia byak <buliabyak@users.sf.net>
*
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "sp-object.h"
#include "sp-item.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;
}
}
{
if (
((sh->has_nodepath()) && (!strcmp(name, "d") || !strcmp(name, "sodipodi:nodetypes"))) // With paths, we only need to act if one of the path-affecting attributes has changed.
|| sh->has_knotholder()) {
}
if (changed) {
if (sh->has_nodepath()) {
}
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) {
}
}
}
}
unset_item();
this->grab_node = -1;
if (lpeobject) {
key);
if (this->nodepath) {
this->nodepath->shape_editor = this;
}
//this->knotholder = sp_item_knot_holder(item, desktop);
g_message("create knotholder?");
if (this->nodepath || this->knotholder) {
// setting new listener
if (this->knotholder)
else
if (repr) {
}
}
}
}
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); //(double) SP_EVENT_CONTEXT(nc)->tolerance;
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 :