Code

first crack at enabling blend for layers dialog
[inkscape.git] / src / ui / widget / panel.cpp
index 1e868191d80eee02bf7070acb842048adcb45280..a591e76640acd8ec51b69f63d4c79327079483c9 100644 (file)
@@ -4,9 +4,11 @@
  * Authors:
  *   Bryce Harrington <bryce@bryceharrington.org>
  *   Jon A. Cruz <jon@joncruz.org>
+ *   Gustav Broberg <broberg@kth.se>
  *
  * Copyright (C) 2004 Bryce Harrington
  * Copyright (C) 2005 Jon A. Cruz
+ * Copyright (C) 2007 Gustav Broberg
  *
  * Released under GNU GPL.  Read the file 'COPYING' for more information
  */
@@ -39,11 +41,12 @@ static const int PANEL_SETTING_NEXTFREE = 3;
  *    Construct a Panel
  */
 
-Panel::Panel(Glib::ustring const &label, gchar const *prefs_path, 
+Panel::Panel(Glib::ustring const &label, gchar const *prefs_path,
              int verb_num, Glib::ustring const &apply_label,
              bool menu_desired) :
     _prefs_path(prefs_path),
     _menu_desired(menu_desired),
+    _desktop(SP_ACTIVE_DESKTOP),
     _label(label),
     _apply_label(apply_label),
     _verb_num(verb_num),
@@ -181,6 +184,8 @@ void Panel::_init()
 
     signalResponse().connect(sigc::mem_fun(*this, &Panel::_handleResponse));
 
+    signalActivateDesktop().connect(sigc::hide<0>(sigc::mem_fun(*this, &Panel::setDesktop)));
+
     show_all_children();
 
     _bounceCall(PANEL_SETTING_SIZE, panel_size);
@@ -383,6 +388,11 @@ Glib::ustring const &Panel::getApplyLabel() const
     return _apply_label;
 }
 
+void Panel::setDesktop(SPDesktop *desktop)
+{
+    _desktop = desktop;
+}
+
 void Panel::_setTargetFillable(PreviewFillable *target)
 {
     _fillable = target;
@@ -395,7 +405,7 @@ void Panel::_regItem(Gtk::MenuItem* item, int group, int id)
     item->show();
 }
 
-void Panel::_handleAction(int set_id, int item_id)
+void Panel::_handleAction(int /*set_id*/, int /*item_id*/)
 {
 // for subclasses to override
 }
@@ -406,7 +416,7 @@ Panel::_apply()
     g_warning("Apply button clicked for panel [Panel::_apply()]");
 }
 
-Gtk::Button * 
+Gtk::Button *
 Panel::addResponseButton(const Glib::ustring &button_text, int response_id)
 {
     Gtk::Button *button = new Gtk::Button(button_text);
@@ -461,6 +471,24 @@ Panel::setResponseSensitive(int response_id, bool setting)
         _response_map[response_id]->set_sensitive(setting);
 }
 
+sigc::signal<void, SPDesktop *, SPDocument *> &
+Panel::signalDocumentReplaced()
+{
+    return _signal_document_replaced;
+}
+
+sigc::signal<void, Inkscape::Application *, SPDesktop *> &
+Panel::signalActivateDesktop()
+{
+    return _signal_activate_desktop;
+}
+
+sigc::signal<void, Inkscape::Application *, SPDesktop *> &
+Panel::signalDeactiveDesktop()
+{
+    return _signal_deactive_desktop;
+}
+
 void
 Panel::_handleResponse(int response_id)
 {
@@ -474,7 +502,7 @@ Panel::_handleResponse(int response_id)
 
 Inkscape::Selection *Panel::_getSelection()
 {
-    return sp_desktop_selection(SP_ACTIVE_DESKTOP);
+    return sp_desktop_selection(_desktop);
 }
 
 } // namespace Widget