/*
* Inkscape::LayerManager - a view of a document's layers, relative
* to a particular desktop
*
* Copyright 2006 MenTaLguY <mental@rydia.net>
* Abhishek Sharma
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include <set>
#include "inkgc/gc-managed.h"
#include "gc-finalized.h"
#include "document.h"
#include "desktop.h"
#include "layer-manager.h"
#include "preferences.h"
#include "selection.h"
#include "sp-object.h"
#include "sp-item-group.h"
#include "xml/node-observer.h"
// #include "debug/event-tracker.h"
// #include "debug/simple-event.h"
namespace Inkscape {
public:
_connection(c),
{}
virtual void notifyChildOrderChanged( Node &/*node*/, Node &/*child*/, Node */*old_prev*/, Node */*new_prev*/ ) {}
virtual void notifyContentChanged( Node &/*node*/, Util::ptr_shared<char> /*old_content*/, Util::ptr_shared<char> /*new_content*/ ) {}
virtual void notifyAttributeChanged( Node &/*node*/, GQuark name, Util::ptr_shared<char> /*old_value*/, Util::ptr_shared<char> /*new_value*/ ) {
}
}
}
};
/*
namespace {
Util::ptr_shared<char> stringify_node(Node const &node);
Util::ptr_shared<char> stringify_obj(SPObject const &obj) {
gchar *string;
if (obj.id) {
string = g_strdup_printf("SPObject(%p)=%s repr(%p)", &obj, obj.id, obj.repr);
} else {
string = g_strdup_printf("SPObject(%p) repr(%p)", &obj, obj.repr);
}
Util::ptr_shared<char> result=Util::share_string(string);
g_free(string);
return result;
}
typedef Debug::SimpleEvent<Debug::Event::OTHER> DebugLayer;
class DebugLayerNote : public DebugLayer {
public:
DebugLayerNote(Util::ptr_shared<char> descr)
: DebugLayer(Util::share_static_string("layer-note"))
{
_addProperty("descr", descr);
}
};
class DebugLayerRebuild : public DebugLayer {
public:
DebugLayerRebuild()
: DebugLayer(Util::share_static_string("rebuild-layers"))
{
}
};
class DebugLayerObj : public DebugLayer {
public:
DebugLayerObj(SPObject const& obj, Util::ptr_shared<char> name)
: DebugLayer(name)
{
_addProperty("layer", stringify_obj(obj));
}
};
class DebugAddLayer : public DebugLayerObj {
public:
DebugAddLayer(SPObject const &obj)
: DebugLayerObj(obj, Util::share_static_string("add-layer"))
{
}
};
} // end of namespace
*/
{
_layer_connection = desktop->connectCurrentLayerChanged( sigc::mem_fun(*this, &LayerManager::_selectedLayerChanged) );
sigc::bound_mem_functor1<void, Inkscape::LayerManager, SPDocument*> first = sigc::mem_fun(*this, &LayerManager::_setDocument);
// This next line has problems on gcc 4.0.2
}
{
}
{
//g_return_if_fail( _desktop->currentRoot() );
if ( _desktop->currentRoot() ) {
}
}
}
/*
* Return a unique layer name similar to param label
* A unique name is made by substituting or appending the label's number suffix with
* the next unique larger number suffix not already used for any layer name
*/
{
pos-- ;
}
if ( numpart ) {
split = "";
}
}
if ( root ) {
}
}
// Not sure if we need to cap it, but we'll just be paranoid for the moment
// Intentionally unsigned
for ( guint i = startNum; (i < endNum) && (currentNames.find(result) != currentNames.end()); i++ ) {
}
return result;
}
{
if (uniquify) {
}
}
if (_document) {
}
if (document) {
_resource_connection = document->connectResourcesChanged("layer", sigc::mem_fun(*this, &LayerManager::_rebuild));
}
_rebuild();
}
{
}
// Debug::EventTracker<DebugLayerRebuild> tracker1();
if ( node ) {
}
}
}
_clear();
if (!_document) // http://sourceforge.net/mailarchive/forum.php?thread_name=5747bce9a7ed077c1b4fc9f0f4f8a5e0%40localhost&forum_name=inkscape-devel
return;
if ( root ) {
// Debug::EventTracker<DebugLayerNote> tracker(Util::format("Examining %s", layer->label()));
bool needsAdd = false;
needsAdd = true;
if ( SP_IS_GROUP(curr) ) {
// If we have a layer-group as the one or a parent, ensure it is listed as a valid layer.
// XML Tree being used here directly while it shouldn't be...
needsAdd = false;
}
} else {
// If a non-layer group is a parent of layer groups, then show it also as a layer.
// TODO add the magic Inkscape group mode?
// XML Tree being used directly while it shouldn't be...
} else {
needsAdd = false;
}
}
}
}
}
if ( needsAdd ) {
}
}
}
}
}
// Filter out objects in the middle of being deleted
// Such may have been the cause of bug 1339397.
}
// Debug::EventTracker<DebugAddLayer> tracker(*layer);
sigc::connection connection = layer->connectModified(sigc::mem_fun(*this, &LayerManager::_objectModified));
}
}
}
}
// Connected to the desktop's CurrentLayerChanged signal
{
// notify anyone who's listening to this instead of directly to the desktop
}
}
/*
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 :