summaryrefslogtreecommitdiffstats
path: root/src/layer-manager.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:24:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:24:48 +0000
commitcca66b9ec4e494c1d919bff0f71a820d8afab1fa (patch)
tree146f39ded1c938019e1ed42d30923c2ac9e86789 /src/layer-manager.h
parentInitial commit. (diff)
downloadinkscape-cca66b9ec4e494c1d919bff0f71a820d8afab1fa.tar.xz
inkscape-cca66b9ec4e494c1d919bff0f71a820d8afab1fa.zip
Adding upstream version 1.2.2.upstream/1.2.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/layer-manager.h')
-rw-r--r--src/layer-manager.h104
1 files changed, 104 insertions, 0 deletions
diff --git a/src/layer-manager.h b/src/layer-manager.h
new file mode 100644
index 0000000..9e5f83d
--- /dev/null
+++ b/src/layer-manager.h
@@ -0,0 +1,104 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Inkscape::LayerManager - a view of a document's layers, relative
+ * to a particular desktop
+ *
+ * Copyright 2006 MenTaLguY <mental@rydia.net>
+ *
+ * Released under GNU GPL v2+, read the file 'COPYING' for more information.
+ */
+
+#ifndef SEEN_INKSCAPE_LAYER_MANAGER_H
+#define SEEN_INKSCAPE_LAYER_MANAGER_H
+
+#include <memory>
+#include <vector>
+#include <glibmm/ustring.h>
+
+#include "document-subset.h"
+#include "inkgc/gc-soft-ptr.h"
+#include "object/sp-item-group.h"
+
+class SPDesktop;
+class SPDocument;
+
+namespace Inkscape {
+ class ObjectHierarchy;
+
+class LayerManager : public DocumentSubset
+{
+public:
+ LayerManager(SPDesktop *desktop);
+ ~LayerManager() override;
+
+ void renameLayer( SPObject* obj, char const *label, bool uniquify );
+ Glib::ustring getNextLayerName( SPObject* obj, char const *label);
+
+ sigc::connection connectCurrentLayerChanged(const sigc::slot<void, SPGroup *> & slot) {
+ return _layer_changed_signal.connect(slot);
+ }
+
+ SPGroup *currentRoot() const;
+ SPGroup *currentLayer() const;
+
+ unsigned getLayerCount() const { return childCount(currentRoot()); }
+
+ void reset();
+ void setCurrentLayer(SPObject *object, bool clear=false);
+ void toggleLayerSolo(SPObject *object, bool force_hide = false);
+ void toggleHideAllLayers(bool hide);
+ void toggleLockAllLayers(bool lock);
+ void toggleLockOtherLayers(SPObject *object, bool force_lock = false);
+ SPObject *layerForObject(SPObject *object);
+ std::list<SPItem *> getAllLayers();
+ bool isLayer(SPObject *object) const;
+ static SPGroup *asLayer(SPObject *object);
+
+ bool isRoot() const { return currentLayer() == currentRoot(); }
+
+private:
+
+ void _objectModified( SPObject* obj, unsigned int flags );
+ void _setDocument(SPDesktop *, SPDocument *document);
+ void _rebuild();
+
+ void _selectedLayerChanged(SPObject *top, SPObject *bottom);
+ void _layer_activated(SPObject *layer);
+ void _layer_deactivated(SPObject *layer);
+
+ sigc::connection _layer_connection;
+ sigc::connection _activate_connection;
+ sigc::connection _deactivate_connection;
+ sigc::connection _document_connection;
+ sigc::connection _resource_connection;
+
+ SPDesktop *_desktop;
+ SPDocument *_document;
+
+ std::unique_ptr<Inkscape::ObjectHierarchy> _layer_hierarchy;
+ sigc::signal<void, SPGroup *> _layer_changed_signal;
+};
+
+enum LayerRelativePosition {
+ LPOS_ABOVE,
+ LPOS_BELOW,
+ LPOS_CHILD,
+};
+
+SPObject *create_layer(SPObject *root, SPObject *layer, LayerRelativePosition position);
+SPObject *next_layer(SPObject *root, SPObject *layer);
+SPObject *previous_layer(SPObject *root, SPObject *layer);
+
+}
+
+#endif
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :