summaryrefslogtreecommitdiffstats
path: root/src/ui/widget
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/widget')
-rw-r--r--src/ui/widget/panel.cpp30
-rw-r--r--src/ui/widget/panel.h13
2 files changed, 42 insertions, 1 deletions
diff --git a/src/ui/widget/panel.cpp b/src/ui/widget/panel.cpp
index cad344e63..a591e7664 100644
--- a/src/ui/widget/panel.cpp
+++ b/src/ui/widget/panel.cpp
@@ -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
*/
@@ -44,6 +46,7 @@ Panel::Panel(Glib::ustring const &label, gchar const *prefs_path,
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;
@@ -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
diff --git a/src/ui/widget/panel.h b/src/ui/widget/panel.h
index 10f74cf2b..40760a4a2 100644
--- a/src/ui/widget/panel.h
+++ b/src/ui/widget/panel.h
@@ -27,6 +27,7 @@
#include <gtkmm/table.h>
#include <gtkmm/tooltips.h>
+#include "inkscape.h"
#include "ui/previewfillable.h"
#include "selection.h"
@@ -54,6 +55,9 @@ public:
void restorePanelPrefs();
+ virtual void setDesktop(SPDesktop *desktop);
+ SPDesktop *getDesktop() { return _desktop; }
+
/** Signal accessors */
virtual sigc::signal<void, int> &signalResponse();
virtual sigc::signal<void> &signalPresent();
@@ -65,6 +69,10 @@ public:
void setDefaultResponse(int response_id);
void setResponseSensitive(int response_id, bool setting);
+ virtual sigc::signal<void, SPDesktop *, SPDocument *> &signalDocumentReplaced();
+ virtual sigc::signal<void, Inkscape::Application *, SPDesktop *> &signalActivateDesktop();
+ virtual sigc::signal<void, Inkscape::Application *, SPDesktop *> &signalDeactiveDesktop();
+
protected:
Gtk::Box *_getContents() { return &_contents; }
void _setTargetFillable(PreviewFillable *target);
@@ -90,6 +98,9 @@ protected:
/** Signals */
sigc::signal<void, int> _signal_response;
sigc::signal<void> _signal_present;
+ sigc::signal<void, SPDesktop *, SPDocument *> _signal_document_replaced;
+ sigc::signal<void, Inkscape::Application *, SPDesktop *> _signal_activate_desktop;
+ sigc::signal<void, Inkscape::Application *, SPDesktop *> _signal_deactive_desktop;
private:
void _init();
@@ -98,6 +109,8 @@ private:
void _popper(GdkEventButton *btn);
void _wrapToggled(Gtk::CheckMenuItem *toggler);
+ SPDesktop *_desktop;
+
Glib::ustring _label;
Glib::ustring _apply_label;
int _verb_num;