diff options
| author | Matthew Petroff <matthew@mpetroff.net> | 2013-07-17 05:13:49 +0000 |
|---|---|---|
| committer | Matthew Petroff <matthew@mpetroff.net> | 2013-07-17 05:13:49 +0000 |
| commit | dd59aa3bb2cab030296a4622e5166f0e3f8d5445 (patch) | |
| tree | a86612c94d3ddce3edf696ea17fefb58b0accccf /src/selection.h | |
| parent | Temporary fixes/kludges. (diff) | |
| parent | Shape calculations. re-introduce grid of a smaller size. (http://article.gman... (diff) | |
| download | inkscape-dd59aa3bb2cab030296a4622e5166f0e3f8d5445.tar.gz inkscape-dd59aa3bb2cab030296a4622e5166f0e3f8d5445.zip | |
Merge from trunk.
(bzr r12380.1.17)
Diffstat (limited to 'src/selection.h')
| -rw-r--r-- | src/selection.h | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/src/selection.h b/src/selection.h index 10775dcb5..32eade21f 100644 --- a/src/selection.h +++ b/src/selection.h @@ -27,12 +27,14 @@ #include "sp-item.h" #include "snapped-point.h" + class SPDesktop; class SPItem; class SPBox3D; struct Persp3D; namespace Inkscape { +class LayerModel; namespace XML { class Node; } @@ -41,10 +43,10 @@ class Node; namespace Inkscape { /** - * The set of selected SPObjects for a given desktop. + * The set of selected SPObjects for a given document and layer model. * * This class represents the set of selected SPItems for a given - * SPDesktop. + * document (referenced in LayerModel). * * An SPObject and its parent cannot be simultaneously selected; * selecting an SPObjects has the side-effect of unselecting any of @@ -62,19 +64,29 @@ class Selection : public Inkscape::GC::Managed<>, public Inkscape::GC::Anchored { public: + enum CompareSize { HORIZONTAL, VERTICAL, AREA }; /** * Constructs an selection object, bound to a particular - * SPDesktop + * layer model * - * @param desktop the desktop in question + * @param layers the layer model (for the SPDesktop, if GUI) + * @param desktop the desktop associated with the layer model, or NULL if in console mode */ - Selection(SPDesktop *desktop); + Selection(LayerModel *layers, SPDesktop *desktop); ~Selection(); /** + * Returns the layer model the selection is bound to (works in console or GUI mode) + * + * @return the layer model the selection is bound to, which is the same as the desktop + * layer model for GUI mode + */ + LayerModel *layers() { return _layers; } + + /** * Returns the desktop the selection is bound to * - * @return the desktop the selection is bound to + * @return the desktop the selection is bound to, or NULL if in console mode */ SPDesktop *desktop() { return _desktop; } @@ -210,6 +222,16 @@ public: SPItem *singleItem(); /** + * Returns the smallest item from this selection. + */ + SPItem *smallestItem(CompareSize compare); + + /** + * Returns the largest item from this selection. + */ + SPItem *largestItem(CompareSize compare); + + /** * Returns a single selected object's xml node. * * @return NULL unless exactly one object is selected @@ -339,9 +361,11 @@ private: void add_3D_boxes_recursively(SPObject *obj); void remove_box_perspective(SPBox3D *box); void remove_3D_boxes_recursively(SPObject *obj); + SPItem *_sizeistItem(bool sml, CompareSize compare); std::list<SPBox3D *> _3dboxes; + LayerModel *_layers; GC::soft_ptr<SPDesktop> _desktop; SPObject* _selection_context; guint _flags; |
