summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 874eb32)
raw | patch | inline | side by side (parent: 874eb32)
author | buliabyak <buliabyak@users.sourceforge.net> | |
Thu, 10 Sep 2009 14:38:48 +0000 (14:38 +0000) | ||
committer | buliabyak <buliabyak@users.sourceforge.net> | |
Thu, 10 Sep 2009 14:38:48 +0000 (14:38 +0000) |
src/ui/dialog/layers.cpp | patch | blob | history |
index fa47ad88d979da656760262a406f588f284442c3..f0c4cd0dd4fa2d59043aeb5011da7173a4f2569a 100644 (file)
--- a/src/ui/dialog/layers.cpp
+++ b/src/ui/dialog/layers.cpp
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;
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();
}
}
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 ) {
void LayersPanel::_preToggle( GdkEvent const *event )
{
+
if ( _toggleEvent ) {
gdk_event_free(_toggleEvent);
_toggleEvent = 0;
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;
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();
_desktop = 0;
}
- _desktop = getDesktop();
+ _desktop = Panel::getDesktop();
if ( _desktop ) {
//setLabel( _desktop->doc()->name );