Inkscape
Vector Graphics Editor
|
#include <sp-guide.h>
Public Member Functions | |
SPGuide () | |
~SPGuide () override=default | |
int | tag () const override |
void | set_color (const unsigned r, const unsigned g, const unsigned b, bool const commit) |
void | setColor (guint32 c) |
void | setHiColor (guint32 h) |
guint32 | getColor () const |
guint32 | getHiColor () const |
Geom::Point | getPoint () const |
Geom::Point | getNormal () const |
void | moveto (Geom::Point const point_on_line, bool const commit) |
void | set_normal (Geom::Point const normal_to_line, bool const commit) |
void | set_label (const char *label, bool const commit) |
char const * | getLabel () const |
void | set_locked (const bool locked, bool const commit) |
bool | getLocked () const |
void | fix_orientation () |
SPGuide * | duplicate () |
void | showSPGuide (Inkscape::CanvasItemGroup *group) |
void | hideSPGuide (Inkscape::UI::Widget::Canvas *canvas) |
void | showSPGuide () |
void | hideSPGuide () |
bool | remove (bool force=false) |
void | sensitize (Inkscape::UI::Widget::Canvas *canvas, bool sensitive) |
bool | isHorizontal () const |
bool | isVertical () const |
char * | description (bool const verbose=true) const |
Returns a human-readable description of the guideline for use in dialog boxes and status bar. | |
double | angle () const |
![]() | |
SPObject () | |
Constructor, sets all attributes to default values. | |
SPObject (SPObject const &)=delete | |
SPObject & | operator= (SPObject const &)=delete |
~SPObject () override | |
Destructor, frees the used memory and unreferences a potential successor of the object. | |
char const * | getId () const |
Returns the objects current ID string. | |
void | getIds (std::set< std::string > &ret) const |
Accumulate this id and all it's descendants ids. | |
std::string | getUrl () const |
Get the id in a URL format. | |
Inkscape::XML::Node * | getRepr () |
Returns the XML representation of tree. | |
Inkscape::XML::Node const * | getRepr () const |
Returns the XML representation of tree. | |
void | releaseReferences () |
Cleans up an SPObject, releasing its references and requesting that references to it be released. | |
sigc::connection | connectRelease (sigc::slot< void(SPObject *)> slot) |
Connects to the release request signal. | |
bool | isSiblingOf (SPObject const *object) const |
virtual void | getLinked (std::vector< SPObject * > &objects, LinkedObjectNature direction=LinkedObjectNature::ANY) const |
Get objects which are linked to this object as either a source or a target. | |
std::vector< SPObject * > | getLinked (LinkedObjectNature direction=LinkedObjectNature::ANY) const |
Get objects which are linked, like above. | |
bool | isAncestorOf (SPObject const *object) const |
True if object is non-NULL and this is some in/direct parent of object. | |
SPObject const * | nearestCommonAncestor (SPObject const *object) const |
Returns youngest object being parent to this and object. | |
SPObject const * | getTopAncestorNonLayer () const |
Returns ancestor non layer. | |
SPObject * | getNext () |
SPObject * | getPrev () |
Returns previous object in sibling list or NULL. | |
bool | hasChildren () const |
SPObject * | firstChild () |
SPObject const * | firstChild () const |
SPObject * | lastChild () |
SPObject const * | lastChild () const |
SPObject * | nthChild (unsigned index) |
SPObject const * | nthChild (unsigned index) const |
std::vector< SPObject * > | childList (bool add_ref, Action action=ActionGeneral) |
Retrieves the children as a std vector object, optionally ref'ing the children in the process, if add_ref is specified. | |
std::vector< SPObject * > | ancestorList (bool root_to_tip) |
Retrieves a list of ancestors of the object, as an easy to use vector. | |
SPObject * | appendChildRepr (Inkscape::XML::Node *repr) |
Append repr as child of this object. | |
char const * | label () const |
Gets the author-visible label property for the object or a default if no label is defined. | |
char const * | defaultLabel () const |
Returns a default label property for this object. | |
void | setLabel (char const *label) |
Sets the author-visible label for this object. | |
char * | title () const |
Returns the title of this object, or NULL if there is none. | |
bool | setTitle (char const *title, bool verbatim=false) |
Sets the title of this object. | |
char * | desc () const |
Returns the description of this object, or NULL if there is none. | |
bool | setDesc (char const *desc, bool verbatim=false) |
Sets the description of this object. | |
Glib::ustring | getExportFilename () const |
Get and set the exportable filename on this object. | |
void | setExportFilename (Glib::ustring filename) |
Geom::Point | getExportDpi () const |
Get and set the exported DPI for this objet, if available. | |
void | setExportDpi (Geom::Point dpi) |
CollectionPolicy | collectionPolicy () const |
Set the policy under which this object will be orphan-collected. | |
void | setCollectionPolicy (CollectionPolicy policy) |
Sets the orphan-collection policy in effect for this object. | |
void | requestOrphanCollection () |
Requests a later automatic call to collectOrphan(). | |
void | collectOrphan () |
Unconditionally delete the object if it is not referenced. | |
void | hrefObject (SPObject *owner=nullptr) |
Increase weak refcount. | |
void | unhrefObject (SPObject *owner=nullptr) |
Decrease weak refcount. | |
bool | isReferenced () |
Check if object is referenced by any other object. | |
void | deleteObject (bool propagate, bool propagate_descendants) |
Deletes an object, unparenting it from its parent. | |
void | deleteObject (bool propagate=true) |
Deletes on object. | |
void | cropToObject (SPObject *except) |
Removes all children except for the given object, it's children and it's ancesstors. | |
void | cropToObjects (std::vector< SPObject * > except_objects) |
Removes objects which are not related to given list of objects. | |
void | getObjectsExcept (std::vector< SPObject * > &objects, const std::vector< SPObject * > &except) |
Get all child objects except for any in the list. | |
void | getLinkedRecursive (std::vector< SPObject * > &objects, LinkedObjectNature direction=LinkedObjectNature::ANY) const |
Grows the input list with all linked items recursively in both child nodes and links of links. | |
sigc::connection | connectDelete (sigc::slot< void(SPObject *)> slot) |
Connects a slot to be called when an object is deleted. | |
sigc::connection | connectPositionChanged (sigc::slot< void(SPObject *)> slot) |
SPObject * | successor () |
Returns the object which supercedes this one (if any). | |
void | setSuccessor (SPObject *successor) |
Indicates that another object supercedes this one. | |
void | setTmpSuccessor (SPObject *tmpsuccessor) |
Indicates that another object supercedes temporaty this one. | |
void | unsetTmpSuccessor () |
Unset object supercedes. | |
void | fixTmpSuccessors () |
Fix temporary successors in duple stamp. | |
Inkscape::XML::Node * | updateRepr (unsigned int flags=SP_OBJECT_WRITE_EXT) |
Updates the object's repr based on the object's state. | |
Inkscape::XML::Node * | updateRepr (Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, unsigned int flags) |
Updates the given repr based on the object's state. | |
void | requestDisplayUpdate (unsigned int flags) |
Queues an deferred update of this object's display. | |
void | updateDisplay (SPCtx *ctx, unsigned int flags) |
Updates the object's display immediately. | |
void | requestModified (unsigned int flags) |
Requests that a modification notification signal be emitted later (e.g. | |
void | emitModified (unsigned int flags) |
Emits the MODIFIED signal with the object's flags. | |
sigc::connection | connectModified (sigc::slot< void(SPObject *, unsigned int)> slot) |
Connects to the modification notification signal. | |
void | _sendDeleteSignalRecursive () |
Sends the delete signal to all children of this object recursively. | |
void | _updateTotalHRefCount (int increment) |
Adds increment to _total_hrefcount of object and its parents. | |
void | _requireSVGVersion (unsigned major, unsigned minor) |
void | _requireSVGVersion (Inkscape::Version version) |
Lifts SVG version of all root objects to version. | |
void | attach (SPObject *object, SPObject *prev) |
Put object into object tree, under parent, and behind prev; also update object's XML space. | |
void | reorder (SPObject *obj, SPObject *prev) |
In list of object's children, move object behind prev. | |
void | detach (SPObject *object) |
Remove object from parent's children, release and unref it. | |
SPObject * | get_child_by_repr (Inkscape::XML::Node *repr) |
Return object's child whose node pointer equals repr. | |
void | invoke_build (SPDocument *document, Inkscape::XML::Node *repr, unsigned int cloned) |
int | getIntAttribute (char const *key, int def) |
unsigned | getPosition () |
char const * | getAttribute (char const *name) const |
void | appendChild (Inkscape::XML::Node *child) |
void | addChild (Inkscape::XML::Node *child, Inkscape::XML::Node *prev=nullptr) |
void | setKeyValue (SPAttr key, char const *value) |
Call virtual set() function of object. | |
void | setAttribute (Inkscape::Util::const_char_ptr key, Inkscape::Util::const_char_ptr value) |
void | setAttributeDouble (Inkscape::Util::const_char_ptr key, double value) |
void | setAttributeOrRemoveIfEmpty (Inkscape::Util::const_char_ptr key, Inkscape::Util::const_char_ptr value) |
void | readAttr (char const *key) |
Read value of key attribute from XML node into object. | |
void | readAttr (SPAttr keyid) |
char const * | getTagName () const |
void | removeAttribute (char const *key) |
void | setCSS (SPCSSAttr *css, char const *attr) |
void | changeCSS (SPCSSAttr *css, char const *attr) |
bool | storeAsDouble (char const *key, double *val) const |
virtual void | read_content () |
void | recursivePrintTree (unsigned level=0) |
void | objectTrace (std::string const &, bool in=true, unsigned flags=0) |
std::string | generate_unique_id (char const *default_id=nullptr) const |
Generate a document-wide unique id for this object. | |
Static Public Member Functions | |
static SPGuide * | createSPGuide (SPDocument *doc, Geom::Point const &pt1, Geom::Point const &pt2) |
Protected Member Functions | |
void | build (SPDocument *doc, Inkscape::XML::Node *repr) override |
void | release () override |
void | set (SPAttr key, const char *value) override |
![]() | |
virtual void | child_added (Inkscape::XML::Node *child, Inkscape::XML::Node *ref) |
virtual void | remove_child (Inkscape::XML::Node *child) |
virtual void | order_changed (Inkscape::XML::Node *child, Inkscape::XML::Node *old_repr, Inkscape::XML::Node *new_repr) |
virtual void | tag_name_changed (gchar const *oldname, gchar const *newname) |
virtual void | update (SPCtx *ctx, unsigned int flags) |
virtual void | modified (unsigned int flags) |
virtual Inkscape::XML::Node * | write (Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, unsigned int flags) |
Protected Attributes | |
char * | label |
std::vector< CanvasItemPtr< Inkscape::CanvasItemGuideLine > > | views |
bool | locked |
Geom::Point | normal_to_line |
Geom::Point | point_on_line |
guint32 | color |
guint32 | hicolor |
![]() | |
ListHook | _child_hook |
Additional Inherited Members | |
![]() | |
enum | CollectionPolicy { COLLECT_WITH_PARENT , ALWAYS_COLLECT } |
enum class | LinkedObjectNature { DEPENDENT = -1 , ANY = 0 , DEPENDENCY = 1 } |
enum | Action { ActionGeneral , ActionBBox , ActionUpdate , ActionShow } |
typedef Inkscape::Util::ForwardPointerIterator< SPObject, ParentIteratorStrategy > | ParentIterator |
typedef Inkscape::Util::ForwardPointerIterator< SPObject const, ParentIteratorStrategy > | ConstParentIterator |
using | ChildrenList = boost::intrusive::list< SPObject, boost::intrusive::member_hook< SPObject, ListHook, &SPObject::_child_hook > > |
![]() | |
unsigned int | cloned: 1 |
SPObject * | clone_original {nullptr} |
unsigned int | uflags: 16 |
unsigned int | mflags: 16 |
SPIXmlSpace | xml_space |
Glib::ustring | lang |
unsigned int | hrefcount {0} |
unsigned int | _total_hrefcount {0} |
SPDocument * | document {nullptr} |
SPObject * | parent {nullptr} |
int | refCount {1} |
std::list< SPObject * > | hrefList |
SPStyle * | style |
Represents the style properties, whether from presentation attributes, the style attribute, or inherited. | |
SPStyle * | context_style |
Represents the style that should be used to resolve 'context-fill' and 'context-stroke'. | |
sigc::signal< void(SPObject *)> | _release_signal |
sigc::signal< void(SPObject *)> | _delete_signal |
sigc::signal< void(SPObject *)> | _position_changed_signal |
sigc::signal< void(SPObject *, unsigned int)> | _modified_signal |
SPObject * | _successor {nullptr} |
SPObject * | _tmpsuccessor {nullptr} |
CollectionPolicy | _collection_policy {SPObject::COLLECT_WITH_PARENT} |
char * | _label {nullptr} |
char * | _default_label {nullptr} |
ChildrenList | children |
![]() | |
typedef boost::intrusive::list_member_hook | ListHook |
Definition at line 42 of file sp-guide.h.
SPGuide::SPGuide | ( | ) |
Definition at line 45 of file sp-guide.cpp.
|
overridedefault |
|
inline |
Definition at line 84 of file sp-guide.h.
References normal_to_line, Geom::X, and Geom::Y.
Referenced by description(), and sp_dt_guide_event().
|
overrideprotectedvirtual |
Reimplemented from SPObject.
Definition at line 63 of file sp-guide.cpp.
References SPDocument::addResource(), SPObject::build(), SPObject::document, INKSCAPE_COLOR, INKSCAPE_LABEL, INKSCAPE_LOCKED, ORIENTATION, POSITION, SPObject::readAttr(), and SPObject::repr.
|
static |
Definition at line 209 of file sp-guide.cpp.
References SPObject::appendChild(), Geom::are_near(), Inkscape::XML::Document::createElement(), Geom::EPSILON, SPDocument::getHeight(), SPDocument::getNamedView(), SPDocument::getObjectByRepr(), SPDocument::getReprDoc(), SPDocument::getRoot(), SPDocument::is_yaxisdown(), SPNamedView::lockguides, Inkscape::GC::release(), SPObject::repr, root, Geom::rot90(), Inkscape::XML::Node::setAttribute(), Inkscape::XML::Node::setAttributePoint(), Inkscape::Util::Quantity::value(), Geom::X, Geom::Point::x(), and Geom::Point::y().
Referenced by SPLine::convert_to_guides(), Inkscape::UI::Dialog::create_guide(), duplicate(), and sp_guide_pt_pairs_to_guides().
char * SPGuide::description | ( | bool const | verbose = true | ) | const |
Returns a human-readable description of the guideline for use in dialog boxes and status bar.
If verbose is false, only positioning information is included (useful for dialogs).
The caller is responsible for freeing the string.
Definition at line 482 of file sp-guide.cpp.
References angle(), SPNamedView::display_units, SPObject::document, SPDocument::getNamedView(), normal_to_line, point_on_line, Inkscape::Util::Quantity::string(), Geom::X, and Geom::Y.
Referenced by Inkscape::UI::Dialog::GuidelinePropertiesDialog::_setup().
SPGuide * SPGuide::duplicate | ( | ) |
Definition at line 257 of file sp-guide.cpp.
References createSPGuide(), SPObject::document, normal_to_line, point_on_line, Geom::X, and Geom::Y.
Referenced by Inkscape::UI::Dialog::GuidelinePropertiesDialog::_onDuplicate().
void SPGuide::fix_orientation | ( | ) |
Definition at line 200 of file sp-guide.cpp.
References SPObject::document, ORIENTATION, POSITION, and SPObject::readAttr().
|
inline |
Definition at line 52 of file sp-guide.h.
References color.
Referenced by Inkscape::UI::Dialog::GuidelinePropertiesDialog::_setup().
|
inline |
Definition at line 53 of file sp-guide.h.
References hicolor.
|
inline |
Definition at line 61 of file sp-guide.h.
References label.
Referenced by Inkscape::UI::Dialog::GuidelinePropertiesDialog::_setup().
|
inline |
Definition at line 64 of file sp-guide.h.
References locked.
Referenced by Inkscape::UI::Dialog::GuidelinePropertiesDialog::_setup().
|
inline |
Definition at line 55 of file sp-guide.h.
References normal_to_line.
Referenced by Inkscape::UI::Dialog::GuidelinePropertiesDialog::_setup(), SnapManager::guideConstrainedSnap(), and sp_dt_guide_event().
|
inline |
Definition at line 54 of file sp-guide.h.
References point_on_line.
Referenced by Inkscape::UI::Dialog::GuidelinePropertiesDialog::_setup(), SnapManager::guideConstrainedSnap(), sp_dt_guide_event(), and SPNamedView::translateGuides().
void SPGuide::hideSPGuide | ( | ) |
Definition at line 341 of file sp-guide.cpp.
References views.
void SPGuide::hideSPGuide | ( | Inkscape::UI::Widget::Canvas * | canvas | ) |
Definition at line 328 of file sp-guide.cpp.
References views.
Referenced by SPNamedView::setShowGuideSingle().
|
inline |
Definition at line 79 of file sp-guide.h.
References normal_to_line, and Geom::X.
Referenced by Inkscape::UI::Dialog::GuidelinePropertiesDialog::_setup().
|
inline |
Definition at line 80 of file sp-guide.h.
References normal_to_line, and Geom::Y.
Referenced by Inkscape::UI::Dialog::GuidelinePropertiesDialog::_setup().
void SPGuide::moveto | ( | Geom::Point const | point_on_line, |
bool const | commit | ||
) |
Definition at line 367 of file sp-guide.cpp.
References Geom::are_near(), SPObject::document, Geom::EPSILON, SPDocument::getHeight(), SPObject::getRepr(), SPDocument::getRoot(), SPDocument::is_yaxisdown(), locked, point_on_line, root, Inkscape::XML::Node::setAttributePoint(), Inkscape::Util::Quantity::value(), SPViewBox::viewBox, views, Geom::GenericRect< C >::width(), Geom::Point::x(), and Geom::Point::y().
Referenced by Inkscape::UI::Dialog::GuidelinePropertiesDialog::_onOKimpl(), set(), sp_dt_guide_event(), and SPNamedView::translateGuides().
|
overrideprotectedvirtual |
Reimplemented from SPObject.
Definition at line 77 of file sp-guide.cpp.
References SPObject::document, SPObject::release(), SPDocument::removeResource(), and views.
bool SPGuide::remove | ( | bool | force = false | ) |
Definition at line 529 of file sp-guide.cpp.
References SPObject::getRepr(), locked, and sp_repr_unparent().
Referenced by Inkscape::UI::Dialog::GuidelinePropertiesDialog::_onDelete().
void SPGuide::sensitize | ( | Inkscape::UI::Widget::Canvas * | canvas, |
bool | sensitive | ||
) |
Definition at line 348 of file sp-guide.cpp.
References views.
|
overrideprotectedvirtual |
Reimplemented from SPObject.
Definition at line 89 of file sp-guide.cpp.
References Geom::are_near(), Inkscape::XML::Node::attribute(), c, SVGLength::computed, SPObject::document, Geom::EPSILON, SPDocument::getHeight(), SPObject::getRepr(), SPDocument::getRoot(), INKSCAPE_COLOR, INKSCAPE_LABEL, INKSCAPE_LOCKED, SPDocument::is_yaxisdown(), key, label, moveto(), normal_to_line, Geom::Point::normalize(), ORIENTATION, point_on_line, POSITION, Inkscape::Util::read_bool(), root, SPObject::set(), set_label(), set_locked(), set_normal(), setColor(), sp_svg_number_read_d(), Inkscape::Util::Quantity::value(), SPDimensions::width, Geom::X, and Geom::Y.
void SPGuide::set_color | ( | const unsigned | r, |
const unsigned | g, | ||
const unsigned | b, | ||
bool const | commit | ||
) |
Definition at line 436 of file sp-guide.cpp.
References color, SPObject::setAttribute(), and views.
Referenced by Inkscape::UI::Dialog::GuidelinePropertiesDialog::_onOKimpl().
void SPGuide::set_label | ( | const char * | label, |
bool const | commit | ||
) |
Definition at line 464 of file sp-guide.cpp.
References label, SPObject::setAttribute(), and views.
Referenced by Inkscape::UI::Dialog::GuidelinePropertiesDialog::_onOKimpl(), and set().
void SPGuide::set_locked | ( | const bool | locked, |
bool const | commit | ||
) |
Definition at line 452 of file sp-guide.cpp.
References locked, SPObject::setAttribute(), and views.
Referenced by Inkscape::UI::Dialog::GuidelinePropertiesDialog::_onOKimpl(), and set().
void SPGuide::set_normal | ( | Geom::Point const | normal_to_line, |
bool const | commit | ||
) |
Definition at line 412 of file sp-guide.cpp.
References SPObject::document, SPObject::getRepr(), SPDocument::is_yaxisdown(), locked, normal_to_line, Inkscape::XML::Node::setAttributePoint(), views, and Geom::X.
Referenced by Inkscape::UI::Dialog::GuidelinePropertiesDialog::_onOKimpl(), set(), and sp_dt_guide_event().
void SPGuide::setColor | ( | guint32 | c | ) |
|
inline |
Definition at line 50 of file sp-guide.h.
References hicolor.
void SPGuide::showSPGuide | ( | ) |
Definition at line 320 of file sp-guide.cpp.
References views.
void SPGuide::showSPGuide | ( | Inkscape::CanvasItemGroup * | group | ) |
Definition at line 303 of file sp-guide.cpp.
References color, dot(), item, label, locked, normal_to_line, point_on_line, sp_dt_guide_event(), and views.
Referenced by SPNamedView::setShowGuideSingle().
|
inlineoverridevirtual |
|
protected |
Definition at line 97 of file sp-guide.h.
Referenced by getColor(), set_color(), setColor(), and showSPGuide().
|
protected |
Definition at line 98 of file sp-guide.h.
Referenced by getHiColor(), and setHiColor().
|
protected |
Definition at line 91 of file sp-guide.h.
Referenced by getLabel(), set(), set_label(), and showSPGuide().
|
protected |
Definition at line 93 of file sp-guide.h.
Referenced by getLocked(), moveto(), remove(), set_locked(), set_normal(), and showSPGuide().
|
protected |
Definition at line 94 of file sp-guide.h.
Referenced by angle(), description(), duplicate(), getNormal(), isHorizontal(), isVertical(), set(), set_normal(), and showSPGuide().
|
protected |
Definition at line 95 of file sp-guide.h.
Referenced by description(), duplicate(), getPoint(), moveto(), set(), and showSPGuide().
|
protected |
Definition at line 92 of file sp-guide.h.
Referenced by hideSPGuide(), hideSPGuide(), moveto(), release(), sensitize(), set_color(), set_label(), set_locked(), set_normal(), setColor(), showSPGuide(), and showSPGuide().