diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ui/dialog/object-properties.cpp | 69 | ||||
| -rw-r--r-- | src/ui/dialog/object-properties.h | 29 |
2 files changed, 79 insertions, 19 deletions
diff --git a/src/ui/dialog/object-properties.cpp b/src/ui/dialog/object-properties.cpp index a28fbfb40..cfc976284 100644 --- a/src/ui/dialog/object-properties.cpp +++ b/src/ui/dialog/object-properties.cpp @@ -1,6 +1,5 @@ /** - * @file - * Object properties dialog. + * @file Object properties dialog. */ /* Authors: * Lauris Kaplinski <lauris@kaplinski.com> @@ -9,7 +8,7 @@ * Abhishek Sharma * Kris De Gussem <Kris.DeGussem@gmail.com> * - * Copyright (C) 1999-2011 Authors + * Copyright (C) 1999-2012 Authors * Copyright (C) 2001 Ximian, Inc. * * Released under GNU GPL, read the file 'COPYING' for more information @@ -28,8 +27,6 @@ namespace Inkscape { namespace UI { namespace Dialog { -void on_selection_changed(Inkscape::Application */*inkscape*/, Inkscape::Selection */*selection*/, ObjectProperties *dial); - /** * Create a new static instance of the object properties dialog. */ @@ -48,7 +45,12 @@ ObjectProperties::ObjectProperties (void) : CBLock(_("L_ock"), 1), BSet (_("_Set"), 1), LabelInteractivity(_("_Interactivity"), 1), - attrTable() + attrTable(), + desktop(NULL), + deskTrack(), + selectChangedConn(), + subselChangedConn() + // selectModifiedConn() { //initialize labels for the table at the bottom of the dialog int_labels.push_back("onclick"); @@ -62,19 +64,23 @@ ObjectProperties::ObjectProperties (void) : int_labels.push_back("onfocusout"); int_labels.push_back("onload"); + desktopChangeConn = deskTrack.connectDesktopChanged( sigc::mem_fun(*this, &ObjectProperties::setTargetDesktop) ); + deskTrack.connect(GTK_WIDGET(gobj())); + MakeWidget(); } ObjectProperties::~ObjectProperties (void) { + // selectModifiedConn.disconnect(); + subselChangedConn.disconnect(); + selectChangedConn.disconnect(); + desktopChangeConn.disconnect(); + deskTrack.disconnect(); } void ObjectProperties::MakeWidget(void) { - // g_signal_connect (G_OBJECT (INKSCAPE), "modify_selection", G_CALLBACK (sp_item_widget_modify_selection), wd.win); - // g_signal_connect (G_OBJECT (INKSCAPE), "set_selection", G_CALLBACK (sp_item_widget_change_selection), wd.win); - g_signal_connect (G_OBJECT (INKSCAPE), "change_selection", G_CALLBACK (on_selection_changed), this); - Gtk::Box *contents = _getContents(); contents->set_spacing(0); @@ -184,7 +190,11 @@ void ObjectProperties::MakeWidget(void) void ObjectProperties::widget_setup(void) { - if (blocked) + if (blocked || !desktop) + { + return; + } + if (SP_ACTIVE_DESKTOP != desktop) { return; } @@ -367,14 +377,41 @@ void ObjectProperties::hidden_toggled(void) blocked = false; } -/** - * ObjectProperties callback for the selection of an other object. - */ -void on_selection_changed(Inkscape::Application */*inkscape*/, Inkscape::Selection */*selection*/, ObjectProperties *dial) +void ObjectProperties::setDesktop(SPDesktop *desktop) { - dial->widget_setup(); + Panel::setDesktop(desktop); + deskTrack.setBase(desktop); } +void ObjectProperties::setTargetDesktop(SPDesktop *desktop) +{ + if (this->desktop != desktop) { + if (this->desktop) { + // selectModifiedConn.disconnect(); + subselChangedConn.disconnect(); + selectChangedConn.disconnect(); + } + this->desktop = desktop; + if (desktop && desktop->selection) { + selectChangedConn = desktop->selection->connectChanged(sigc::hide(sigc::mem_fun(*this, &ObjectProperties::widget_setup))); + subselChangedConn = desktop->connectToolSubselectionChanged(sigc::hide(sigc::mem_fun(*this, &ObjectProperties::widget_setup))); + + //// Must check flags, so can't call widget_setup() directly. + // selectModifiedConn = desktop->selection->connectModified(sigc::hide<0>(sigc::mem_fun(*this, &ObjectProperties::selectionModifiedCB))); + } + widget_setup(); + } +} + +// void ObjectProperties::selectionModifiedCB( guint flags ) +// { + // if (flags & ( SP_OBJECT_MODIFIED_FLAG | + // SP_OBJECT_PARENT_MODIFIED_FLAG | + // SP_OBJECT_STYLE_MODIFIED_FLAG) ) { + // widget_setup(); + // } +// } + } } } diff --git a/src/ui/dialog/object-properties.h b/src/ui/dialog/object-properties.h index 47423651b..cdfc76dd4 100644 --- a/src/ui/dialog/object-properties.h +++ b/src/ui/dialog/object-properties.h @@ -1,12 +1,12 @@ -/** @file - * \brief Display settings dialog +/** + * @file Object properties dialog. */ /* Author: * Lauris Kaplinski <lauris@ximian.com> * Kris De Gussem <Kris.DeGussem@gmail.com> * * Copyright (C) 2001 Ximian, Inc. - * Copyright (C) 2011 Authors + * Copyright (C) 2012 Authors * Released under GNU GPL, read the file 'COPYING' for more information */ @@ -17,6 +17,8 @@ #include <gtkmm.h> #include <glibmm/i18n.h> +#include "desktop.h" +#include "ui/dialog/desktop-tracker.h" #include "ui/widget/panel.h" #include "widgets/sp-attribute-widget.h" @@ -70,6 +72,11 @@ private: Gtk::Expander EInteractivity; //the label for interactivity SPAttributeTable attrTable; //the widget for showing the on... names at the bottom + SPDesktop *desktop; + DesktopTracker deskTrack; + sigc::connection desktopChangeConn; + sigc::connection selectChangedConn; + sigc::connection subselChangedConn; /** * Constructor auxiliary function creating the child widgets. @@ -90,6 +97,22 @@ private: * Callback for checkbox Hide. */ void hidden_toggled(void); + + /* + * On signal modified, invokes an update. + */ + //void selectionModifiedCB( guint flags ); + + /** + * Can be invoked for setting the desktop. Currently not used. + */ + void setDesktop(SPDesktop *desktop); + + /** + * Is invoked by the desktop tracker when the desktop changes. + */ + void setTargetDesktop(SPDesktop *desktop); + }; } |
