summaryrefslogtreecommitdiffstats
path: root/src/selection.cpp
diff options
context:
space:
mode:
authorEric Greveson <eric@greveson.co.uk>2013-07-01 20:04:32 +0000
committerEric Greveson <eric@greveson.co.uk>2013-07-01 20:04:32 +0000
commitc3a160589a9cb41c70a56e5e7b66a65857a0d10e (patch)
tree46860c161eda2e11687aff38141e04b40185798b /src/selection.cpp
parentCorrectly ignore symbolic link to ltmain.sh (diff)
downloadinkscape-c3a160589a9cb41c70a56e5e7b66a65857a0d10e.tar.gz
inkscape-c3a160589a9cb41c70a56e5e7b66a65857a0d10e.zip
Factored layer model out into new Inkscape::LayerModel class. This allows
Inkscape::Selection to use a LayerModel that is not associated with a UI. Changed the interface of verbs (SPAction) to use a new ActionContext rather than UI::View::View, again so that verbs may be used in a console mode. Modified boolean operation verbs to work in console-only mode. Fixed up DESKTOP_IS_ACTIVE macro to work in the case of no desktops. Modified main.cpp to process selections and verbs in no-GUI mode. Other changes are all consequences of the SPDesktop, Selection and LayerModel interface changes. (bzr r12387.1.1)
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..76f49f544 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 *layer_model, SPDesktop *desktop) :
_objs(NULL),
_reprs(NULL),
_items(NULL),
+ _layer_model(layer_model),
_desktop(desktop),
_selection_context(NULL),
_flags(0),
@@ -55,7 +55,7 @@ Selection::Selection(SPDesktop *desktop) :
Selection::~Selection() {
_clear();
- _desktop = NULL;
+ _layer_model = 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 = _layer_model->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 _layer_model->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=_layer_model->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 = _layer_model->layerForObject(SP_OBJECT(iter->data));
if (g_slist_find (layers, layer) == NULL) {
layers = g_slist_prepend (layers, layer);
}