b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson#ifndef SEEN_INKSCAPE_LAYER_MODEL_H
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson#define SEEN_INKSCAPE_LAYER_MODEL_H
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson/*
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson * Authors:
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson * Lauris Kaplinski <lauris@kaplinski.com>
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson * Frank Felfe <innerspace@iname.com>
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson * bulia byak <buliabyak@users.sf.net>
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson * Ralf Stephan <ralf@ark.in-berlin.de>
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson * John Bintz <jcoswell@coswellproductions.org>
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson * Johan Engelen <j.b.c.engelen@ewi.utwente.nl>
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson * Jon A. Cruz <jon@joncruz.org>get
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson * Abhishek Sharma
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson * Eric Greveson <eric@greveson.co.uk>
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson *
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson * Copyright (C) 2007 Johan Engelen
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson * Copyright (C) 2006 John Bintz
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson * Copyright (C) 1999-2013 authors
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson * Copyright (C) 2000-2001 Ximian, Inc.
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson *
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson * Released under GNU GPL, read the file 'COPYING' for more information
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson *
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson */
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson#include <sigc++/sigc++.h>
11f343b8117dbf56931f537820c2749a8232fec2Liam P. White#include <cstddef>
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson
b3b2006a625d3deea5b11cff7257544805c178a6Eric Grevesonclass SPDocument;
b3b2006a625d3deea5b11cff7257544805c178a6Eric Grevesonclass SPObject;
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson
b3b2006a625d3deea5b11cff7257544805c178a6Eric Grevesonnamespace Inkscape {
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson
b3b2006a625d3deea5b11cff7257544805c178a6Eric Grevesonclass ObjectHierarchy;
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson
b3b2006a625d3deea5b11cff7257544805c178a6Eric Grevesonnamespace XML {
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson class Node;
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson}
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson/**
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson * The layer model for a document.
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson *
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson * This class represents the layer model for a document, typically (but
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson * not necessarily) displayed in an SPDesktop.
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson *
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson * It also implements its own asynchronous notification signals that
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson * UI elements can listen to.
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson */
b3b2006a625d3deea5b11cff7257544805c178a6Eric Grevesonclass LayerModel
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson{
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson SPDocument *_doc;
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson Inkscape::ObjectHierarchy *_layer_hierarchy;
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson unsigned int _display_key;
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson
b3b2006a625d3deea5b11cff7257544805c178a6Eric Grevesonpublic:
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson /** Construct a layer model */
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson LayerModel();
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson /** Destructor */
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson ~LayerModel();
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson // Set document
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson void setDocument(SPDocument *doc);
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson // Set display key. For GUI apps.
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson void setDisplayKey(unsigned int display_key);
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson // Get the document that this layer model refers to. May be NULL.
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson SPDocument *getDocument();
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson // TODO look into making these return a more specific subclass:
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson SPObject *currentRoot() const;
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson SPObject *currentLayer() const;
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson void reset();
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson void setCurrentLayer(SPObject *object);
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson void toggleLayerSolo(SPObject *object);
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson void toggleHideAllLayers(bool hide);
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson void toggleLockAllLayers(bool lock);
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson void toggleLockOtherLayers(SPObject *object);
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson SPObject *layerForObject(SPObject *object);
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson bool isLayer(SPObject *object) const;
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson sigc::signal<void, SPObject *> _layer_activated_signal;
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson sigc::signal<void, SPObject *> _layer_deactivated_signal;
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson sigc::signal<void, SPObject *, SPObject *> _layer_changed_signal;
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson};
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson} // namespace Inkscape
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson#endif
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson/*
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson Local Variables:
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson mode:c++
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson c-file-style:"stroustrup"
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson indent-tabs-mode:nil
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson fill-column:99
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson End:
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson*/
b3b2006a625d3deea5b11cff7257544805c178a6Eric Greveson// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :