~danieljabailey/inkscape/arc_node_editor

« back to all changes in this revision

Viewing changes to src/ui/tool/node.h

  • Committer: tavmjong-free
  • Date: 2016-05-08 07:44:05 UTC
  • mfrom: (14873.1.1 gtk3)
  • Revision ID: tavmjong@free.fr-20160508074405-rm6tiapoq1ugamph
Start of GTK3 external style sheet support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
 
30
30
#include <boost/enable_shared_from_this.hpp>
31
31
#include <boost/shared_ptr.hpp>
32
 
#include <2geom/elliptical-arc.h>
33
32
#include "ui/tool/selectable-control-point.h"
34
33
#include "snapped-point.h"
35
34
#include "ui/tool/node-types.h"
101
100
    virtual ~Handle();
102
101
    inline Geom::Point relativePos() const;
103
102
    inline double length() const;
104
 
    inline Geom::Angle angle() const;
105
103
    bool isDegenerate() const { return _degenerate; } // True if the handle is retracted, i.e. has zero length.
106
104
 
107
105
    virtual void setVisible(bool);
109
107
 
110
108
    virtual void setPosition(Geom::Point const &p);
111
109
    inline void setRelativePos(Geom::Point const &p);
112
 
    virtual void setOffset(Geom::Point const &offset);
113
110
    void setLength(double len);
114
 
    void setAngle(Geom::Angle a);
115
 
    void setAngleAndLength(Geom::Angle a, double len);
116
111
    void retract();
117
112
    void setDirection(Geom::Point const &from, Geom::Point const &to);
118
113
    void setDirection(Geom::Point const &dir);
145
140
    SPCtrlLine *_handle_line;
146
141
    bool _degenerate; // True if the handle is retracted, i.e. has zero length. This is used often internally so it makes sense to cache this
147
142
 
148
 
    Geom::Point _offset;
149
 
 
150
143
    /**
151
144
     * Control point of a cubic Bezier curve in a path.
152
145
     *
190
183
    void showHandles(bool v);
191
184
 
192
185
    void updateHandles();
193
 
    void updateArcHandleConstriants(Handle *constraint);
194
 
    void moveArcHandles(Geom::Point lineBetweenNodes, double lenX, double lenY, Geom::Angle rotX, Geom::Angle rotY);
195
 
 
196
 
    void retractArcHandles();
197
186
 
198
187
 
199
188
    /**
206
195
    bool isEndNode() const;
207
196
    Handle *front() { return &_front; }
208
197
    Handle *back()  { return &_back;  }
209
 
    Handle *arc_rx() { return &_arc_rx; }
210
 
    Handle *arc_ry() { return &_arc_ry; }
211
 
    bool *arc_large() { return &_arc_large; }
212
 
    bool *arc_sweep() { return &_arc_sweep; }
213
 
    Geom::EllipticalArc getEllipticalArc();
214
198
 
215
199
    /**
216
200
     * Gets the handle that faces the given adjacent node.
294
278
    // as a line segment
295
279
    Handle _front; ///< Node handle in the backward direction of the path
296
280
    Handle _back; ///< Node handle in the forward direction of the path
297
 
    // The arc control points and flags relate to an arc starting at this node and ending at the next node
298
 
    Handle _arc_rx; ///< Handle for controling the x radius and rotation of the elipse (in eliptical arc mode)
299
 
    Handle _arc_ry; ///< Handle for controling the y radius and rotation of the elipse (in eliptical arc mode)
300
 
    bool _arc_large; ///< Flag that determines if arc mode is shallow or bulge
301
 
    bool _arc_sweep; ///< Flag that determines the direction of an arc's sweep
302
281
    NodeType _type; ///< Type of node - cusp, smooth...
303
282
    bool _handles_shown;
304
283
    static ColorSet node_colors;
510
489
 
511
490
// define inline Handle funcs after definition of Node
512
491
inline Geom::Point Handle::relativePos() const {
513
 
    return position() - (_parent->position() + _offset);
 
492
    return position() - _parent->position();
514
493
}
515
494
inline void Handle::setRelativePos(Geom::Point const &p) {
516
 
    setPosition(_parent->position() + _offset + p);
 
495
    setPosition(_parent->position() + p);
517
496
}
518
497
inline double Handle::length() const {
519
498
    return relativePos().length();
520
499
}
521
 
inline Geom::Angle Handle::angle() const {
522
 
    return Geom::Angle(position() - _parent->position() - _offset);
523
 
}
524
500
inline PathManipulator &Handle::_pm() {
525
501
    return _parent->_pm();
526
502
}