Code

return plain rect for union in all situations where a plain rect is given
[inkscape.git] / src / shape-editor.h
1 #ifndef __SHAPE_EDITOR_H__
2 #define __SHAPE_EDITOR_H__
4 /*
5  * Inkscape::ShapeEditor
6  *
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.
9  *
10  * Authors:
11  *   bulia byak <buliabyak@users.sf.net>
12  *
13  */
15 #include <forward.h>
17 namespace Inkscape {
18 namespace NodePath {
19 class Path;
20 }
21 }
23 #include "libnr/nr-path-code.h"
24 #include "libnr/nr-point.h"
26 class SPKnotHolder;
27 class SPDesktop;
28 class SPNodeContext;
29 class ShapeEditorsCollective;
31 class ShapeEditor {
32 public:
34     ShapeEditor(SPDesktop *desktop);
35     ~ShapeEditor();
37     void set_item (SPItem *item);
38     void unset_item ();
40     SPItem *get_item ();
42     bool has_nodepath ();
43     bool has_knotholder ();
45     bool has_local_change ();
46     void decrement_local_change ();
48     GList *save_nodepath_selection ();
49     void restore_nodepath_selection (GList *saved);
51     void nodepath_destroyed ();
53     void update_statusbar ();
55     bool is_over_stroke (NR::Point event_p, bool remember);
57     void add_node_near_point(); // uses the shapeeditor's remembered point, if any
59     void select_segment_near_point(bool toggle); // uses the shapeeditor's remembered point, if any
61     void cancel_hit ();
63     bool hits_curve ();
65     void curve_drag (gdouble eventx, gdouble eventy);
67     void finish_drag ();
69     void select_rect (NR::Rect  const &rect, bool add);
71     bool has_selection ();
72     void deselect ();
74     Inkscape::NodePath::Path *get_nodepath() {return nodepath;} //((deprecated))
75     ShapeEditorsCollective *get_container() {return container;}
77     void add_node();
79     void delete_nodes();
80     void delete_nodes_preserving_shape();
82     void set_node_type(int type);
84     void break_at_nodes();
85     void join_nodes();
87     void duplicate_nodes();
89     void set_type_of_segments(NRPathcode code);
91     void move_nodes(gdouble dx, gdouble dy);
92     void move_nodes_screen(gdouble dx, gdouble dy);
94     void rotate_nodes(gdouble angle, int which, bool screen);
96     void scale_nodes(gdouble const grow, int const which);
97     void scale_nodes_screen(gdouble const grow, int const which);
99     void select_all (bool invert);
100     void select_all_from_subpath (bool invert);
101     void select_next ();
102     void select_prev ();
104     void flip (NR::Dim2 axis);
106     void distribute (NR::Dim2 axis);
107     void align (NR::Dim2 axis);
109 private:
110     SPDesktop *desktop;
112     Inkscape::NodePath::Path *nodepath;
113     SPKnotHolder *knotholder;
115     ShapeEditorsCollective *container;
117     //Inkscape::XML::Node *lidtened_repr;
119     double grab_t;
120     int grab_node; // number of node grabbed by sp_node_context_is_over_stroke
121     bool hit;
122     NR::Point curvepoint_event; // int coords from event
123     NR::Point curvepoint_doc; // same, in doc coords
124 };
127 /* As the next stage, this will be a collection of multiple ShapeEditors,
128 with the same interface as the single ShapeEditor, passing the actions to all its
129 contained ShapeEditors. Thus it should be easy to switch node context from 
130 using a single ShapeEditor to using a ShapeEditorsCollective. */
132 class ShapeEditorsCollective {
133 public:
135     ShapeEditorsCollective(SPDesktop *desktop);
136     ~ShapeEditorsCollective();
138     void update_statusbar();
140 private:
141     std::vector<ShapeEditor> editors;
143     SPNodeContext *nc; // who holds us
144 };
146 #endif
149 /*
150   Local Variables:
151   mode:c++
152   c-file-style:"stroustrup"
153   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
154   indent-tabs-mode:nil
155   fill-column:99
156   End:
157 */
158 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :