1
#ifndef __SHAPE_EDITOR_H__
2
#define __SHAPE_EDITOR_H__
5
* Inkscape::ShapeEditor
7
* This is a container class which contains either knotholder (for shapes) or nodepath (for
8
* paths). It is attached to a single item so only one of these is active at a time.
11
* bulia byak <buliabyak@users.sf.net>
16
#include <2geom/forward.h>
18
namespace Inkscape { namespace NodePath { class Path; } }
19
namespace Inkscape { namespace XML { class Node; } }
24
class ShapeEditorsCollective;
25
class LivePathEffectObject;
27
#include "libnr/nr-path-code.h"
28
#include <2geom/point.h>
29
#include <boost/optional.hpp>
40
ShapeEditor(SPDesktop *desktop);
43
void set_item (SPItem *item, SubType type, bool keep_knotholder = false);
44
void set_item_lpe_path_parameter(SPItem *item, LivePathEffectObject *lpeobject, const char * key);
45
void unset_item (SubType type, bool keep_knotholder = false);
47
bool has_nodepath (); //((deprecated))
48
void update_knotholder (); //((deprecated))
50
bool has_local_change (SubType type);
51
void decrement_local_change (SubType type);
53
GList *save_nodepath_selection ();
54
void restore_nodepath_selection (GList *saved);
56
void nodepath_destroyed ();
58
void update_statusbar ();
60
bool is_over_stroke (Geom::Point event_p, bool remember);
62
void add_node_near_point(); // uses the shapeeditor's remembered point, if any
64
void select_segment_near_point(bool toggle); // uses the shapeeditor's remembered point, if any
70
void curve_drag (gdouble eventx, gdouble eventy);
74
void select_rect (Geom::Rect const &rect, bool add);
76
bool has_selection ();
79
Inkscape::NodePath::Path *get_nodepath() {return nodepath;} //((deprecated))
80
ShapeEditorsCollective *get_container() {return container;}
85
void delete_nodes_preserving_shape();
86
void delete_segment();
88
void set_node_type(int type);
90
void break_at_nodes();
94
void duplicate_nodes();
96
void set_type_of_segments(NRPathcode code);
98
void move_nodes(gdouble dx, gdouble dy);
99
void move_nodes_screen(SPDesktop *desktop, gdouble dx, gdouble dy);
101
void rotate_nodes(gdouble angle, int which, bool screen);
103
void scale_nodes(gdouble const grow, int const which);
104
void scale_nodes_screen(gdouble const grow, int const which);
106
void select_all (bool invert);
107
void select_all_from_subpath (bool invert);
111
void show_handles (bool show);
112
void show_helperpath (bool show);
114
void flip (Geom::Dim2 axis, boost::optional<Geom::Point> center = boost::optional<Geom::Point>());
116
void distribute (Geom::Dim2 axis);
117
void align (Geom::Dim2 axis);
119
bool nodepath_edits_repr_key(gchar const *name);
121
// this one is only public because it's called from non-C++ repr changed callback
122
void shapeeditor_event_attr_changed(gchar const *name);
125
bool has_knotholder ();
126
void reset_item (SubType type, bool keep_knotholder = true);
127
const SPItem *get_item (SubType type);
131
Inkscape::NodePath::Path *nodepath;
133
// TODO: std::list<KnotHolder *> knotholders;
134
KnotHolder *knotholder;
136
ShapeEditorsCollective *container;
138
//Inkscape::XML::Node *lidtened_repr;
141
int grab_node; // number of node grabbed by sp_node_context_is_over_stroke
143
Geom::Point curvepoint_event; // int coords from event
144
Geom::Point curvepoint_doc; // same, in doc coords
146
Inkscape::XML::Node *listener_attached_for;
150
/* As the next stage, this will be a collection of multiple ShapeEditors,
151
with the same interface as the single ShapeEditor, passing the actions to all its
152
contained ShapeEditors. Thus it should be easy to switch node context from
153
using a single ShapeEditor to using a ShapeEditorsCollective. */
155
class ShapeEditorsCollective {
158
ShapeEditorsCollective(SPDesktop *desktop);
159
~ShapeEditorsCollective();
161
void update_statusbar();
164
std::vector<ShapeEditor> editors;
166
SPNodeContext *nc; // who holds us
175
c-file-style:"stroustrup"
176
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
181
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :