Code

Base implementation of a layers dialog.
authorjoncruz <joncruz@users.sourceforge.net>
Mon, 15 May 2006 08:34:06 +0000 (08:34 +0000)
committerjoncruz <joncruz@users.sourceforge.net>
Mon, 15 May 2006 08:34:06 +0000 (08:34 +0000)
ChangeLog
src/Makefile_insert
src/desktop.cpp
src/desktop.h
src/dialogs/Makefile_insert
src/dialogs/layers-panel.cpp [new file with mode: 0644]
src/dialogs/layers-panel.h [new file with mode: 0644]
src/layer-manager.cpp
src/menus-skeleton.h
src/verbs.cpp
src/verbs.h

index dccb8ca5fee80b26e6e83c34672f5aa9324f95f4..66c74833441ceba44ef6eceb86231f0a85bdfd41 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-05-15  Jon A. Cruz  <jon@joncruz.org>
+       * src/Makefile_insert, src/desktop.cpp, src/desktop.h,
+         src/layer-manager.cpp, src/menus-skeleton.h, src/verbs.cpp,
+         src/verbs.h, src/dialogs/layers-panel.cpp,
+         src/dialogs/layers-panel.h, src/dialogs/Makefile_insert:
+         Base implementation of a layers dialog.
+
 2006-05-14  Colin Marquardt  <colin@marquardt-home.de>
 
        * src/ui/dialog/inkscape-preferences.cpp (initPageTools): 
index 531882f8d295cef41ebc666e4fba60fbdac030bd..aaaca15266c1580e418f872df1e3edb682a39188 100644 (file)
@@ -83,6 +83,7 @@ libinkpre_a_SOURCES = \
        knot.cpp knot.h \
        knotholder.cpp knotholder.h     \
        layer-fns.cpp layer-fns.h       \
+       layer-manager.cpp layer-manager.h       \
        macros.h        \
        marker-status.cpp marker-status.h       \
        media.cpp media.h       \
index 05d20b31b9ab10652c910f4d5606512e01816a97..b1dbae1187b5284b00e05cfc85cd8b8b62fb186f 100644 (file)
@@ -75,6 +75,7 @@
 #include "ui/dialog/dialog-manager.h"
 #include "xml/repr.h"
 #include "message-context.h"
+#include "layer-manager.h"
 
 #ifdef WITH_INKBOARD
 #include "jabber_whiteboard/session-manager.h"
@@ -112,6 +113,7 @@ SPDesktop::SPDesktop()
     sketch = NULL;
     controls = NULL;
     event_context = 0;
+    layer_manager = 0;
 
     _d2w.set_identity();
     _w2d.set_identity();
@@ -289,6 +291,10 @@ SPDesktop::init (SPNamedView *nv, SPCanvas *aCanvas)
         )
     );
 
+
+    /* setup LayerManager */
+    //   (Setting up after the connections are all in place, as it may use some of them)
+    layer_manager = new Inkscape::LayerManager( this );
 }
 
 
index 55d824e0af3f49f0a091115920763cb6e617c679..0a2d932f8628c709d17eef930efeb2cb80b2e18b 100644 (file)
@@ -49,6 +49,7 @@ namespace Inkscape {
   class MessageContext;
   class Selection; 
   class ObjectHierarchy;
+  class LayerManager;
   namespace UI { 
       namespace Dialog { 
           class DialogManager; 
@@ -72,6 +73,7 @@ struct SPDesktop : public Inkscape::UI::View::View
     /// current selection; will never generally be NULL
     Inkscape::Selection       *selection;
     SPEventContext            *event_context;
+    Inkscape::LayerManager    *layer_manager;
 
     SPCanvasItem  *acetate;
     SPCanvasGroup *main;
index 3442ef66a1e904c9f9035a1ce3cb92e55277baa7..c1133014ca99a9a6ee44d2ad0ad23b9d3d159c05 100644 (file)
@@ -40,6 +40,8 @@ dialogs_libspdialogs_a_SOURCES = \
        dialogs/item-properties.h       \
        dialogs/layer-properties.cpp    \
        dialogs/layer-properties.h      \
+       dialogs/layers-panel.cpp        \
+       dialogs/layers-panel.h  \
        dialogs/object-attributes.cpp   \
        dialogs/object-attributes.h     \
        dialogs/object-properties.cpp   \
diff --git a/src/dialogs/layers-panel.cpp b/src/dialogs/layers-panel.cpp
new file mode 100644 (file)
index 0000000..b0959f4
--- /dev/null
@@ -0,0 +1,487 @@
+/*
+ * A simple panel for layers
+ *
+ * Authors:
+ *   Jon A. Cruz
+ *
+ * Copyright (C) 2006 Jon A. Cruz
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "inkscape.h"
+
+#include "layers-panel.h"
+
+#include "layer-manager.h"
+#include "verbs.h"
+#include "helper/action.h"
+
+#include "document.h"
+#include "desktop.h"
+#include "sp-object.h"
+#include "sp-item.h"
+#include "src/widgets/icon.h"
+#include <gtkmm/widget.h>
+
+//#define DUMP_LAYERS 1
+
+namespace Inkscape {
+namespace UI {
+namespace Dialogs {
+
+LayersPanel* LayersPanel::instance = 0;
+
+LayersPanel& LayersPanel::getInstance()
+{
+    if ( !instance ) {
+        instance = new LayersPanel();
+    }
+
+    return *instance;
+}
+
+enum {
+    COL_VISIBLE = 1,
+    COL_LOCKED
+};
+
+enum {
+    BUTTON_NEW = 0,
+    BUTTON_TOP,
+    BUTTON_BOTTOM,
+    BUTTON_UP,
+    BUTTON_DOWN,
+//    BUTTON_DUPLICATE,
+    BUTTON_DELETE
+};
+
+void LayersPanel::_styleButton( Gtk::Button& btn, SPDesktop *desktop, unsigned int code, char const* fallback )
+{
+    bool set = false;
+    if ( desktop ) {
+        Verb *verb = Verb::get( code );
+        if ( verb ) {
+            SPAction *action = verb->get_action(desktop);
+            if ( action && action->image ) {
+                GtkWidget *child = sp_icon_new( Inkscape::ICON_SIZE_SMALL_TOOLBAR, action->image );
+                gtk_widget_show( child );
+                btn.add( *manage(Glib::wrap(child)) );
+                set = true;
+            }
+
+            if ( action && action->tip ) {
+                _tips.set_tip( btn, action->tip );
+            }
+        }
+    }
+    if ( !set && fallback ) {
+        btn.set_label( fallback );
+    }
+}
+
+void LayersPanel::_fireAction( unsigned int code )
+{
+    if ( _desktop ) {
+        Verb *verb = Verb::get( code );
+        if ( verb ) {
+            SPAction *action = verb->get_action(_desktop);
+            if ( action ) {
+                sp_action_perform( action, NULL );
+//             } else {
+//                 g_message("no action");
+            }
+//         } else {
+//             g_message("no verb for %u", code);
+        }
+//     } else {
+//         g_message("no active desktop");
+    }
+}
+
+//     SP_VERB_LAYER_NEXT,
+//     SP_VERB_LAYER_PREV,
+void LayersPanel::_takeAction( int val )
+{
+    switch ( val ) {
+        case BUTTON_NEW:
+        {
+            _fireAction( SP_VERB_LAYER_NEW );
+        }
+        break;
+        case BUTTON_TOP:
+        {
+            _fireAction( SP_VERB_LAYER_TO_TOP );
+        }
+        break;
+        case BUTTON_BOTTOM:
+        {
+            _fireAction( SP_VERB_LAYER_TO_BOTTOM );
+        }
+        break;
+        case BUTTON_UP:
+        {
+            _fireAction( SP_VERB_LAYER_RAISE );
+        }
+        break;
+        case BUTTON_DOWN:
+        {
+            _fireAction( SP_VERB_LAYER_LOWER );
+        }
+        break;
+        case BUTTON_DELETE:
+        {
+            _fireAction( SP_VERB_LAYER_DELETE );
+        }
+        break;
+    }
+
+    if ( _desktop && _desktop->currentLayer() ) {
+        _selectLayer( _desktop->currentLayer() );
+    }
+}
+
+class LayersPanel::ModelColumns : public Gtk::TreeModel::ColumnRecord
+{
+public:
+
+    ModelColumns()
+    {
+        add(_colObject);
+        add(_colVisible);
+        add(_colLocked);
+        add(_colLabel);
+    }
+    virtual ~ModelColumns() {}
+
+    Gtk::TreeModelColumn<SPObject*> _colObject;
+    Gtk::TreeModelColumn<Glib::ustring> _colLabel;
+    Gtk::TreeModelColumn<bool> _colVisible;
+    Gtk::TreeModelColumn<bool> _colLocked;
+};
+
+
+static gboolean layers_panel_activated( GtkObject *object, GdkEvent * /*event*/, gpointer data )
+{
+    if ( data )
+    {
+        LayersPanel* panel = reinterpret_cast<LayersPanel*>(data);
+        panel->setDesktop( SP_ACTIVE_DESKTOP );
+    }
+
+    return FALSE;
+}
+
+void LayersPanel::_selectLayer( SPObject *layer ) {
+    _store->foreach( sigc::bind<SPObject*>(sigc::mem_fun(*this, &LayersPanel::_checkForSelected), layer) );
+}
+
+bool LayersPanel::_checkForSelected(const Gtk::TreePath &path, const Gtk::TreeIter& iter, SPObject* layer)
+{
+    bool stopGoing = false;
+
+    Gtk::TreeModel::Row row = *iter;
+    Glib::ustring tmp = row[_model->_colLabel];
+    if ( layer == row[_model->_colObject] )
+    {
+        _tree.expand_to_path( path );
+
+        Glib::RefPtr<Gtk::TreeSelection> select = _tree.get_selection();
+        select->select(iter);
+
+        stopGoing = true;
+    }
+
+    return stopGoing;
+}
+
+void LayersPanel::_layersChanged()
+{
+//    g_message("_layersChanged()");
+    SPDocument* document = _desktop->doc();
+    SPObject* root = document->root;
+    if ( root ) {
+        if ( _mgr && _mgr->includes( root ) ) {
+            _store->clear();
+
+#if DUMP_LAYERS
+            g_message("root:%p  {%s}   [%s]", root, root->id, root->label() );
+#endif // DUMP_LAYERS
+            unsigned int counter = _mgr->childCount(root);
+            for ( unsigned int i = 0; i < counter; i++ ) {
+                SPObject *child = _mgr->nthChildOf(root, i);
+                if ( child ) {
+#if DUMP_LAYERS
+                    g_message("    layer:%p  {%s}   [%s]", child, child->id, child->label() );
+#endif // DUMP_LAYERS
+
+                    Gtk::TreeModel::Row row = *(_store->append());
+                    row[_model->_colObject] = child;
+                    row[_model->_colLabel] = child->label() ? child->label() : SP_OBJECT_ID(child);
+                    row[_model->_colVisible] = SP_IS_ITEM(child) ? !SP_ITEM(child)->isHidden() : false;
+                    row[_model->_colLocked] = SP_IS_ITEM(child) ? SP_ITEM(child)->isLocked() : false;
+
+                    // TODO - implement walking deeper, not hardcoded
+
+                    unsigned int counter2 = _mgr->childCount(child);
+                    for ( unsigned int i2 = 0; i2 < counter2; i2++ ) {
+                        SPObject *child2 = _mgr->nthChildOf(child, i2);
+                        if ( child2 ) {
+#if DUMP_LAYERS
+                            g_message("        layer:%p  {%s}   [%s]", child, child->id, child->label() );
+#endif // DUMP_LAYERS
+                            Gtk::TreeModel::Row row2 = *(_store->append(row.children()));
+                            row2[_model->_colObject] = child2;
+                            row2[_model->_colLabel] = child2->label() ? child2->label() : SP_OBJECT_ID(child2);
+                            row2[_model->_colVisible] = SP_IS_ITEM(child2) ? !SP_ITEM(child2)->isHidden() : false;
+                            row2[_model->_colLocked] = SP_IS_ITEM(child2) ? SP_ITEM(child2)->isLocked() : false;
+                        }
+                    }
+
+                }
+            }
+        }
+    }
+
+}
+
+SPObject* LayersPanel::_selectedLayer()
+{
+    SPObject* obj = 0;
+
+    Gtk::TreeModel::iterator iter = _tree.get_selection()->get_selected();
+    if ( iter ) {
+        Gtk::TreeModel::Row row = *iter;
+        obj = row[_model->_colObject];
+    }
+
+    return obj;
+}
+
+void LayersPanel::_checkTreeSelection()
+{
+    bool sensitive = false;
+    if ( _tree.get_selection()->count_selected_rows() > 0 ) {
+        sensitive = true;
+
+        SPObject* inTree = _selectedLayer();
+        if ( inTree ) {
+            SPObject* curr = _desktop->currentLayer();
+            if ( curr != inTree ) {
+                _layerChangedConnection.block();
+                _desktop->setCurrentLayer(inTree);
+                _layerChangedConnection.unblock();
+                if ( _tree.get_selection()->count_selected_rows() < 1 ) {
+                    _selectLayer( inTree );
+                }
+            }
+        }
+    } else {
+        sensitive = false;
+    }
+
+    for ( std::vector<Gtk::Button*>::iterator it = _watching.begin(); it != _watching.end(); ++it ) {
+        (*it)->set_sensitive( sensitive );
+    }
+}
+
+void LayersPanel::_toggled( Glib::ustring const& str, int targetCol )
+{
+    Gtk::TreeModel::Children::iterator iter = _tree.get_model()->get_iter(str);
+    Gtk::TreeModel::Row row = *iter;
+
+    Glib::ustring tmp = row[_model->_colLabel];
+
+    SPObject* obj = row[_model->_colObject];
+    SPItem* item = ( obj && SP_IS_ITEM(obj) ) ? SP_ITEM(obj) : 0;
+    if ( item ) {
+        switch ( targetCol ) {
+            case COL_VISIBLE:
+            {
+                bool newValue = !row[_model->_colVisible];
+                row[_model->_colVisible] = newValue;
+                item->setHidden( !newValue  );
+                item->updateRepr();
+                sp_document_done( _desktop->doc() );
+            }
+            break;
+
+            case COL_LOCKED:
+            {
+                bool newValue = !row[_model->_colLocked];
+                row[_model->_colLocked] = newValue;
+                item->setLocked( newValue );
+                item->updateRepr();
+                sp_document_done( _desktop->doc() );
+            }
+            break;
+        }
+    }
+}
+
+
+/**
+ * Constructor
+ */
+LayersPanel::LayersPanel() :
+    Inkscape::UI::Widget::Panel( "dialogs.layers" ),
+    _mgr(0),
+    _desktop(0),
+    _model(0)
+{
+    ModelColumns *zoop = new ModelColumns();
+    _model = zoop;
+
+    _store = Gtk::TreeStore::create( *zoop );
+
+    Gtk::CellRendererToggle* cell = 0;
+    _tree.set_model( _store );
+    int visibleColNum = _tree.append_column("vis", _model->_colVisible) - 1;
+    int lockedColNum = _tree.append_column("lock", _model->_colLocked) - 1;
+    int nameColNum = _tree.append_column("Name", _model->_colLabel) - 1;
+
+    _tree.set_expander_column( *_tree.get_column(nameColNum) );
+
+    cell = dynamic_cast<Gtk::CellRendererToggle*>(_tree.get_column_cell_renderer(visibleColNum));
+    if ( cell ) {
+        cell->signal_toggled().connect( sigc::bind( sigc::mem_fun(*this, &LayersPanel::_toggled), (int)COL_VISIBLE) );
+        cell->property_activatable() = true;
+    }
+
+    cell = dynamic_cast<Gtk::CellRendererToggle*>(_tree.get_column_cell_renderer(lockedColNum));
+    if ( cell ) {
+        cell->signal_toggled().connect( sigc::bind( sigc::mem_fun(*this, &LayersPanel::_toggled), (int)COL_LOCKED) );
+        cell->property_activatable() = true;
+    }
+
+    _tree.get_selection()->signal_changed().connect( sigc::mem_fun(*this, &LayersPanel::_checkTreeSelection) );
+
+    _getContents()->pack_start(_tree, Gtk::PACK_EXPAND_WIDGET);
+
+
+    _getContents()->pack_end(_buttonsRow, Gtk::PACK_SHRINK);
+
+    SPDesktop* targetDesktop = SP_ACTIVE_DESKTOP;
+
+    Gtk::Button* btn = manage( new Gtk::Button() );
+    _styleButton( *btn, targetDesktop, SP_VERB_LAYER_NEW, "Ne" );
+    btn->signal_clicked().connect( sigc::bind( sigc::mem_fun(*this, &LayersPanel::_takeAction), (int)BUTTON_NEW) );
+    _buttonsRow.pack_start( *btn );
+
+    btn = manage( new Gtk::Button() );
+    _styleButton( *btn, targetDesktop, SP_VERB_LAYER_TO_TOP, "Top" );
+    btn->signal_clicked().connect( sigc::bind( sigc::mem_fun(*this, &LayersPanel::_takeAction), (int)BUTTON_TOP) );
+    _watching.push_back( btn );
+    _buttonsRow.pack_start( *btn );
+
+    btn = manage( new Gtk::Button() );
+    _styleButton( *btn, targetDesktop, SP_VERB_LAYER_RAISE, "Up" );
+    btn->signal_clicked().connect( sigc::bind( sigc::mem_fun(*this, &LayersPanel::_takeAction), (int)BUTTON_UP) );
+    _watching.push_back( btn );
+    _buttonsRow.pack_start( *btn );
+
+    btn = manage( new Gtk::Button() );
+    _styleButton( *btn, targetDesktop, SP_VERB_LAYER_LOWER, "Dn" );
+    btn->signal_clicked().connect( sigc::bind( sigc::mem_fun(*this, &LayersPanel::_takeAction), (int)BUTTON_DOWN) );
+    _watching.push_back( btn );
+    _buttonsRow.pack_start( *btn );
+
+    btn = manage( new Gtk::Button() );
+    _styleButton( *btn, targetDesktop, SP_VERB_LAYER_TO_BOTTOM, "Btm" );
+    btn->signal_clicked().connect( sigc::bind( sigc::mem_fun(*this, &LayersPanel::_takeAction), (int)BUTTON_BOTTOM) );
+    _watching.push_back( btn );
+    _buttonsRow.pack_start( *btn );
+
+//     btn = manage( new Gtk::Button("Dup") );
+//     btn->signal_clicked().connect( sigc::bind( sigc::mem_fun(*this, &LayersPanel::_takeAction), (int)BUTTON_DUPLICATE) );
+//     _buttonsRow.pack_start( *btn );
+
+    btn = manage( new Gtk::Button() );
+    _styleButton( *btn, targetDesktop, SP_VERB_LAYER_DELETE, "X" );
+    btn->signal_clicked().connect( sigc::bind( sigc::mem_fun(*this, &LayersPanel::_takeAction), (int)BUTTON_DELETE) );
+    _watching.push_back( btn );
+    _buttonsRow.pack_start( *btn );
+
+
+    for ( std::vector<Gtk::Button*>::iterator it = _watching.begin(); it != _watching.end(); ++it ) {
+        (*it)->set_sensitive( false );
+    }
+
+    g_signal_connect( G_OBJECT(INKSCAPE), "activate_desktop", G_CALLBACK( layers_panel_activated ), this );
+
+
+    setDesktop( targetDesktop );
+
+
+
+    show_all_children();
+
+    restorePanelPrefs();
+}
+
+LayersPanel::~LayersPanel()
+{
+    if ( _model )
+    {
+        delete _model;
+    }
+}
+
+
+void LayersPanel::setDesktop( SPDesktop* desktop )
+{
+    if ( desktop != _desktop ) {
+        _layerChangedConnection.disconnect();
+        _changedConnection.disconnect();
+        if ( _mgr ) {
+            _mgr = 0;
+        }
+        if ( _desktop ) {
+            _desktop = 0;
+        }
+
+        _desktop = SP_ACTIVE_DESKTOP;
+        if ( _desktop ) {
+            _layerChangedConnection = _desktop->connectCurrentLayerChanged( sigc::mem_fun(*this, &LayersPanel::_selectLayer) );
+
+            setLabel( _desktop->doc()->name );
+
+            _mgr = _desktop->layer_manager;
+            if ( _mgr ) {
+                _mgr->connectChanged( sigc::mem_fun(*this, &LayersPanel::_layersChanged) );
+            }
+
+            _layersChanged();
+            _selectLayer( _desktop->currentLayer() );
+        }
+    }
+/*
+    GSList const *layers=sp_document_get_resource_list( _desktop->doc(), "layer" );
+    g_message( "layers list starts at %p", layers );
+    for ( GSList const *iter=layers ; iter ; iter = iter->next ) {
+        SPObject *layer=static_cast<SPObject *>(iter->data);
+        g_message("  {%s}   [%s]", layer->id, layer->label() );
+    }
+*/
+}
+
+
+
+} //namespace Dialogs
+} //namespace UI
+} //namespace Inkscape
+
+
+/*
+  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:encoding=utf-8:textwidth=99 :
diff --git a/src/dialogs/layers-panel.h b/src/dialogs/layers-panel.h
new file mode 100644 (file)
index 0000000..e931e3b
--- /dev/null
@@ -0,0 +1,111 @@
+
+#ifndef SEEN_LAYERS_PANEL_H
+#define SEEN_LAYERS_PANEL_H
+/*
+ * A simple dialog for layer UI.
+ *
+ * Authors:
+ *   Jon A. Cruz
+ *
+ * Copyright (C) 2006 Jon A. Cruz
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#include <gtkmm/treeview.h>
+#include <gtkmm/treestore.h>
+#include <gtkmm/tooltips.h>
+
+#include "ui/widget/panel.h"
+//#include "ui/previewholder.h"
+
+class SPObject;
+
+namespace Inkscape {
+
+class LayerManager;
+
+namespace UI {
+namespace Dialogs {
+
+
+/**
+ * A panel that displays layers.
+ */
+class LayersPanel : public Inkscape::UI::Widget::Panel
+{
+public:
+    LayersPanel();
+    virtual ~LayersPanel();
+
+    static LayersPanel& getInstance();
+    //virtual void setOrientation( Gtk::AnchorType how );
+
+    void setDesktop( SPDesktop* desktop );
+
+protected:
+    //virtual void _handleAction( int setId, int itemId );
+
+private:
+    class ModelColumns;
+
+    LayersPanel(LayersPanel const &); // no copy
+    LayersPanel &operator=(LayersPanel const &); // no assign
+
+    static LayersPanel* instance;
+
+    void _styleButton( Gtk::Button& btn, SPDesktop *desktop, unsigned int code, char const* fallback );
+    void _fireAction( unsigned int code );
+
+    void _toggled( Glib::ustring const& str, int targetCol );
+
+    void _checkTreeSelection();
+
+    void _takeAction( int val );
+
+    void _selectLayer(SPObject *layer);
+    bool _checkForSelected(const Gtk::TreePath& path, const Gtk::TreeIter& iter, SPObject* layer);
+
+    void _layersChanged();
+
+    SPObject* _selectedLayer();
+
+    // Hooked to the desktop:
+    sigc::connection _layerChangedConnection;
+
+    // Hooked to the layer manager:
+    sigc::connection _changedConnection;
+    sigc::connection _addedConnection;
+    sigc::connection _removedConnection;
+
+    Inkscape::LayerManager* _mgr;
+    SPDesktop* _desktop;
+    ModelColumns* _model;
+    Glib::RefPtr<Gtk::TreeStore> _store;
+    std::vector<Gtk::Button*> _watching;
+
+    Gtk::Tooltips _tips;
+    Gtk::TreeView _tree;
+    Gtk::HBox _buttonsRow;
+};
+
+
+
+} //namespace Dialogs
+} //namespace UI
+} //namespace Inkscape
+
+
+
+#endif // SEEN_LAYERS_PANEL_H
+
+/*
+  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:encoding=utf-8:textwidth=99 :
index 2e09ff472403f2c45cfad6d8a97ba2871555d12f..090c967146312f2e7b342e370341f5b08131f4b3 100644 (file)
@@ -62,6 +62,9 @@ void LayerManager::_rebuild() {
             for ( SPObject* curr = layer; curr && (curr != root) ; curr = SP_OBJECT_PARENT(curr) ) {
                 if ( (curr != root) && root->isAncestorOf(curr) && !includes(curr) ) {
                     // Filter out objects in the middle of being deleted
+
+                    // Such may have been the cause of bug 1339397.
+                    // See http://sourceforge.net/tracker/index.php?func=detail&aid=1339397&group_id=93438&atid=604306
                     SPObject const *higher = curr;
                     while ( higher && (SP_OBJECT_PARENT(higher) != root) ) {
                         higher = SP_OBJECT_PARENT(higher);
index ca9240cf6b9a9c77123ea511e09648e77b980936..7d516ec1a9cbdbdd7b7362c88317d5c0dbf3412c 100644 (file)
@@ -129,6 +129,7 @@ static char const menus_skeleton[] =
 "       <verb verb-id=\"NextWindow\" />\n"
 "       <separator/>\n"
 "       <verb verb-id=\"ViewNew\" />\n"
+"       <verb verb-id=\"DialogLayers\" />\n"
 "       <verb verb-id=\"ViewIconPreview\" />\n"
 "   </submenu>\n"
 "   <submenu name=\"" N_("_Layer") "\">\n"
index a5b76d7cfc34ef87ca65d51286771cd7d42b8799..a046372fc0a7fac513d4384daff24d5e6b1b500f 100644 (file)
@@ -45,7 +45,7 @@
 #include "dialogs/iconpreview.h"
 #include "dialogs/extensions.h"
 #include "dialogs/swatches.h"
-//#include "dialogs/layers-panel.h"
+#include "dialogs/layers-panel.h"
 #include "dialogs/input.h"
 
 #ifdef WITH_INKBOARD
@@ -1625,9 +1625,9 @@ DialogVerb::perform(SPAction *action, void *data, void *pdata)
         case SP_VERB_DIALOG_EXTENSIONEDITOR:
             dt->_dlg_mgr->showDialog("ExtensionEditor");
             break;
-//         case SP_VERB_DIALOG_LAYERS:
-//             show_panel( Inkscape::UI::Dialogs::LayersPanel::getInstance(), "dialogs.layers", SP_VERB_DIALOG_LAYERS );
-//             break;
+        case SP_VERB_DIALOG_LAYERS:
+            show_panel( Inkscape::UI::Dialogs::LayersPanel::getInstance(), "dialogs.layers", SP_VERB_DIALOG_LAYERS );
+            break;
         default:
             break;
     }
@@ -2314,8 +2314,8 @@ Verb *Verb::_base_verbs[] = {
                    N_("Configure extended input devices, such as a graphics tablet"), NULL),
     new DialogVerb(SP_VERB_DIALOG_EXTENSIONEDITOR, "org.inkscape.dialogs.extensioneditor", N_("_Extensions..."),
                    N_("Query information about extensions"), NULL),
-//     new DialogVerb(SP_VERB_DIALOG_LAYERS, "DialogLayers", N_("_Layers..."),
-//                    N_("View Layers"), NULL),
+    new DialogVerb(SP_VERB_DIALOG_LAYERS, "DialogLayers", N_("_Layers..."),
+                   N_("View Layers"), NULL),
 
     /* Help */
     new HelpVerb(SP_VERB_HELP_KEYS, "HelpKeys", N_("_Keys and Mouse"),
index 15ea2f2e843a15117defd3ce084bf379883174e8..5d364c53bdf6823bcf310b3e3ad812f7cf0cfa8c 100644 (file)
@@ -207,7 +207,7 @@ enum {
 #endif
     SP_VERB_DIALOG_INPUT,
     SP_VERB_DIALOG_EXTENSIONEDITOR,
-    //SP_VERB_DIALOG_LAYERS,
+    SP_VERB_DIALOG_LAYERS,
     /* Help */
     SP_VERB_HELP_KEYS,
     SP_VERB_HELP_ABOUT_EXTENSIONS,