summaryrefslogtreecommitdiffstats
path: root/src/selection.cpp
diff options
context:
space:
mode:
authorMartin Owens <doctormo@gmail.com>2013-07-05 11:28:36 +0000
committerMartin Owens <doctormo@gmail.com>2013-07-05 11:28:36 +0000
commitead55a54d3ca8f822969180cadcb2b14f78aec93 (patch)
tree6422564d837d9d4b8aa4762703c9eb8ef2bc44ae /src/selection.cpp
parentMake handle colour a configurable property. (diff)
parentFix for builds without --enable-dbusapi (missing #ifdef) (diff)
downloadinkscape-ead55a54d3ca8f822969180cadcb2b14f78aec93.tar.gz
inkscape-ead55a54d3ca8f822969180cadcb2b14f78aec93.zip
Merge: Command-line and DBus refactoring to improve inkscapes ability to be run headless.
(bzr r12402)
Diffstat (limited to 'src/selection.cpp')
-rw-r--r--src/selection.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/selection.cpp b/src/selection.cpp
index 564f1fdd3..d018aba0c 100644
--- a/src/selection.cpp
+++ b/src/selection.cpp
@@ -21,9 +21,8 @@
#endif
#include "macros.h"
#include "inkscape-private.h"
-#include "desktop.h"
-#include "desktop-handles.h"
#include "document.h"
+#include "layer-model.h"
#include "selection.h"
#include <2geom/rect.h>
#include "xml/repr.h"
@@ -42,10 +41,11 @@
namespace Inkscape {
-Selection::Selection(SPDesktop *desktop) :
+Selection::Selection(LayerModel *layers, SPDesktop *desktop) :
_objs(NULL),
_reprs(NULL),
_items(NULL),
+ _layers(layers),
_desktop(desktop),
_selection_context(NULL),
_flags(0),
@@ -55,7 +55,7 @@ Selection::Selection(SPDesktop *desktop) :
Selection::~Selection() {
_clear();
- _desktop = NULL;
+ _layers = NULL;
if (_idle) {
g_source_remove(_idle);
_idle = 0;
@@ -96,7 +96,7 @@ void Selection::_emitModified(guint flags) {
void Selection::_emitChanged(bool persist_selection_context/* = false */) {
if (persist_selection_context) {
if (NULL == _selection_context) {
- _selection_context = desktop()->currentLayer();
+ _selection_context = _layers->currentLayer();
sp_object_ref(_selection_context, NULL);
_context_release_connection = _selection_context->connectRelease(sigc::mem_fun(*this, &Selection::_releaseContext));
}
@@ -139,7 +139,7 @@ void Selection::_clear() {
SPObject *Selection::activeContext() {
if (NULL != _selection_context)
return _selection_context;
- return desktop()->currentLayer();
+ return _layers->currentLayer();
}
bool Selection::includes(SPObject *obj) const {
@@ -487,7 +487,7 @@ SPObject *Selection::_objectForXMLNode(Inkscape::XML::Node *repr) const {
g_return_val_if_fail(repr != NULL, NULL);
gchar const *id = repr->attribute("id");
g_return_val_if_fail(id != NULL, NULL);
- SPObject *object=sp_desktop_document(_desktop)->getObjectById(id);
+ SPObject *object=_layers->getDocument()->getObjectById(id);
g_return_val_if_fail(object != NULL, NULL);
return object;
}
@@ -496,7 +496,7 @@ guint Selection::numberOfLayers() {
GSList const *items = const_cast<Selection *>(this)->itemList();
GSList *layers = NULL;
for (GSList const *iter = items; iter != NULL; iter = iter->next) {
- SPObject *layer = desktop()->layerForObject(SP_OBJECT(iter->data));
+ SPObject *layer = _layers->layerForObject(SP_OBJECT(iter->data));
if (g_slist_find (layers, layer) == NULL) {
layers = g_slist_prepend (layers, layer);
}