shape-editor.cpp revision 2f8a505c173a704ab6fb25538bb3c1afe5ce9e4e
#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) {
}
}
}
}
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);
NR::Point nearest = get_point_on_Path(this->nodepath->livarot_path, position.assume().piece, position.assume().t);
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);
}
if (this->nodepath) {
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(); // FIXME fix that function by removing nodepath_current lookup, and pass it this->nodepath instead (needs fixing verbs/buttons first)
}
void ShapeEditor::delete_nodes () {
sp_node_selected_delete(); // FIXME fix that function by removing nodepath_current lookup, and pass it this->nodepath instead (needs fixing verbs/buttons first)
}
void ShapeEditor::delete_nodes_preserving_shape () {
}
}
sp_node_selected_set_type(type); // FIXME fix that function by removing nodepath_current lookup, and pass it this->nodepath instead (needs fixing verbs/buttons first)
}
void ShapeEditor::break_at_nodes() {
sp_node_selected_break(); // FIXME fix that function by removing nodepath_current lookup, and pass it this->nodepath instead (needs fixing verbs/buttons first)
}
void ShapeEditor::join_nodes() {
sp_node_selected_join(); // FIXME fix that function by removing nodepath_current lookup, and pass it this->nodepath instead (needs fixing verbs/buttons first)
}
void ShapeEditor::duplicate_nodes() {
sp_node_selected_duplicate(); // FIXME fix that function by removing nodepath_current lookup, and pass it this->nodepath instead (needs fixing verbs/buttons first)
}
sp_node_selected_set_line_type(code); // FIXME fix that function by removing nodepath_current lookup, and pass it this->nodepath instead (needs fixing verbs/buttons first)
}
sp_node_selected_move_screen(dx, dy); // FIXME fix that function by removing nodepath_current lookup, and pass it this->nodepath instead (needs fixing verbs/buttons first)
}
sp_node_selected_move(dx, dy); // FIXME fix that function by removing nodepath_current lookup, and pass it this->nodepath instead (needs fixing verbs/buttons first)
}
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)
}
/*
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 :