diff options
| author | Ted Gould <ted@gould.cx> | 2009-11-29 19:01:07 +0000 |
|---|---|---|
| committer | Ted Gould <ted@gould.cx> | 2009-11-29 19:01:07 +0000 |
| commit | 29d3c0b15028e61f176df3a75189bf0959d0d03e (patch) | |
| tree | 727afe596c693a9bdd098d72618abd9ceb0d1969 /src/ui/dialog/layers.cpp | |
| parent | Add the build dir dbus directory to grab some headerfiles for distcheck. (diff) | |
| parent | hopefully fix build on linux (diff) | |
| download | inkscape-29d3c0b15028e61f176df3a75189bf0959d0d03e.tar.gz inkscape-29d3c0b15028e61f176df3a75189bf0959d0d03e.zip | |
Merging in from trunk
(bzr r8254.1.37)
Diffstat (limited to 'src/ui/dialog/layers.cpp')
| -rw-r--r-- | src/ui/dialog/layers.cpp | 51 |
1 files changed, 28 insertions, 23 deletions
diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp index d79f18801..a06b6c9b6 100644 --- a/src/ui/dialog/layers.cpp +++ b/src/ui/dialog/layers.cpp @@ -73,12 +73,12 @@ public: SPObject* _target; }; -static gboolean layers_panel_activated( GtkObject */*object*/, GdkEvent * /*event*/, gpointer data ) +static gboolean layers_panel_activated(Inkscape::Application * /*inkscape*/, SPDesktop *desktop, gpointer data ) { if ( data ) { LayersPanel* panel = reinterpret_cast<LayersPanel*>(data); - panel->setDesktop(panel->getDesktop()); + panel->setDesktop(desktop); } return FALSE; @@ -95,7 +95,6 @@ static gboolean layers_panel_deactivated( GtkObject */*object*/, GdkEvent * /*ev return FALSE; } - void LayersPanel::_styleButton( Gtk::Button& btn, SPDesktop *desktop, unsigned int code, char const* iconName, char const* fallback ) { bool set = false; @@ -349,20 +348,22 @@ bool LayersPanel::_checkForSelected(const Gtk::TreePath &path, const Gtk::TreeIt void LayersPanel::_layersChanged() { // g_message("_layersChanged()"); - SPDocument* document = _desktop->doc(); - SPObject* root = document->root; - if ( root ) { - _selectedConnection.block(); - if ( _mgr && _mgr->includes( root ) ) { - SPObject* target = _desktop->currentLayer(); - _store->clear(); - -#if DUMP_LAYERS - g_message("root:%p {%s} [%s]", root, root->id, root->label() ); -#endif // DUMP_LAYERS - _addLayer( document, root, 0, target, 0 ); + if(_desktop) { + SPDocument* document = _desktop->doc(); + SPObject* root = document->root; + if ( root ) { + _selectedConnection.block(); + if ( _mgr && _mgr->includes( root ) ) { + SPObject* target = _desktop->currentLayer(); + _store->clear(); + + #if DUMP_LAYERS + g_message("root:%p {%s} [%s]", root, root->id, root->label() ); + #endif // DUMP_LAYERS + _addLayer( document, root, 0, target, 0 ); + } + _selectedConnection.unblock(); } - _selectedConnection.unblock(); } } @@ -414,9 +415,9 @@ SPObject* LayersPanel::_selectedLayer() void LayersPanel::_pushTreeSelectionToCurrent() { - SPObject* inTree = _selectedLayer(); // TODO hunt down the possible API abuse in getting NULL - if ( _desktop->currentRoot() ) { + if ( _desktop && _desktop->currentRoot() ) { + SPObject* inTree = _selectedLayer(); if ( inTree ) { SPObject* curr = _desktop->currentLayer(); if ( curr != inTree ) { @@ -459,6 +460,7 @@ void LayersPanel::_checkTreeSelection() void LayersPanel::_preToggle( GdkEvent const *event ) { + if ( _toggleEvent ) { gdk_event_free(_toggleEvent); _toggleEvent = 0; @@ -472,6 +474,8 @@ void LayersPanel::_preToggle( GdkEvent const *event ) void LayersPanel::_toggled( Glib::ustring const& str, int targetCol ) { + g_return_if_fail(_desktop != NULL); + Gtk::TreeModel::Children::iterator iter = _tree.get_model()->get_iter(str); Gtk::TreeModel::Row row = *iter; @@ -642,9 +646,7 @@ LayersPanel::LayersPanel() : _layersPage.pack_end(_compositeSettings, Gtk::PACK_SHRINK); _layersPage.pack_end(_buttonsRow, Gtk::PACK_SHRINK); - _notebook.append_page(_layersPage, _("Layers")); - - _getContents()->pack_start(_notebook, Gtk::PACK_EXPAND_WIDGET); + _getContents()->pack_start(_layersPage, Gtk::PACK_EXPAND_WIDGET); SPDesktop* targetDesktop = getDesktop(); @@ -656,7 +658,9 @@ LayersPanel::LayersPanel() : _buttonsRow.add( *btn ); btn = manage( new Gtk::Button() ); - _styleButton( *btn, targetDesktop, SP_VERB_LAYER_TO_TOP, GTK_STOCK_GOTO_TOP, _("Top") ); + //TRANSLATORS: only translate "string" in "context|string". + // For more details, see http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html#Q-:CAPS + _styleButton( *btn, targetDesktop, SP_VERB_LAYER_TO_TOP, GTK_STOCK_GOTO_TOP, Q_("layers|Top") ); btn->signal_clicked().connect( sigc::bind( sigc::mem_fun(*this, &LayersPanel::_takeAction), (int)BUTTON_TOP) ); _watchingNonTop.push_back( btn ); _buttonsRow.add( *btn ); @@ -722,6 +726,7 @@ LayersPanel::LayersPanel() : g_signal_connect( G_OBJECT(INKSCAPE), "activate_desktop", G_CALLBACK( layers_panel_activated ), this ); g_signal_connect( G_OBJECT(INKSCAPE), "deactivate_desktop", G_CALLBACK( layers_panel_deactivated ), this ); + setDesktop( targetDesktop ); show_all_children(); @@ -763,7 +768,7 @@ void LayersPanel::setDesktop( SPDesktop* desktop ) _desktop = 0; } - _desktop = getDesktop(); + _desktop = Panel::getDesktop(); if ( _desktop ) { //setLabel( _desktop->doc()->name ); |
