summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Bintz <me@johnbintz.com>2006-08-13 18:45:40 +0000
committerjohncoswell <johncoswell@users.sourceforge.net>2006-08-13 18:45:40 +0000
commite945f1a347023c8cc50165ed97a2295b85a3e75a (patch)
tree9255eb62c79f091fbbd18426b6592c035b933ebf
parentadded functions to allow update events to process during long-running operations (diff)
downloadinkscape-e945f1a347023c8cc50165ed97a2295b85a3e75a.tar.gz
inkscape-e945f1a347023c8cc50165ed97a2295b85a3e75a.zip
add interface for disabling interaction during long-running operations
(bzr r1596)
-rw-r--r--src/desktop.cpp13
-rw-r--r--src/desktop.h6
-rw-r--r--src/ui/view/edit-widget-interface.h8
-rw-r--r--src/ui/view/edit-widget.cpp27
-rw-r--r--src/ui/view/edit-widget.h5
-rw-r--r--src/widgets/desktop-widget.cpp26
-rw-r--r--src/widgets/desktop-widget.h9
7 files changed, 93 insertions, 1 deletions
diff --git a/src/desktop.cpp b/src/desktop.cpp
index 04328e84d..51580249e 100644
--- a/src/desktop.cpp
+++ b/src/desktop.cpp
@@ -8,7 +8,9 @@
* MenTaLguY <mental@rydia.net>
* bulia byak <buliabyak@users.sf.net>
* Ralf Stephan <ralf@ark.in-berlin.de>
+ * John Bintz <jcoswell@coswellproductions.org>
*
+ * Copyright (C) 2006 John Bintz
* Copyright (C) 2004 MenTaLguY
* Copyright (C) 1999-2002 Lauris Kaplinski
* Copyright (C) 2000-2001 Ximian, Inc.
@@ -1028,6 +1030,17 @@ SPDesktop::updateNow()
sp_canvas_update_now(canvas);
}
+void
+SPDesktop::enableInteraction()
+{
+ _widget->enableInteraction();
+}
+
+void SPDesktop::disableInteraction()
+{
+ _widget->disableInteraction();
+}
+
//----------------------------------------------------------------------
// Callback implementations. The virtual ones are connected by the view.
diff --git a/src/desktop.h b/src/desktop.h
index 5e0b1f3a8..c9484f2fe 100644
--- a/src/desktop.h
+++ b/src/desktop.h
@@ -9,7 +9,9 @@
* Frank Felfe <innerspace@iname.com>
* bulia byak <buliabyak@users.sf.net>
* Ralf Stephan <ralf@ark.in-berlin.de>
+ * John Bintz <jcoswell@coswellproductions.org>
*
+ * Copyright (C) 2006 John Bintz
* Copyright (C) 1999-2005 authors
* Copyright (C) 2000-2001 Ximian, Inc.
*
@@ -92,6 +94,7 @@ struct SPDesktop : public Inkscape::UI::View::View
unsigned int dkey;
unsigned int number;
bool is_fullscreen;
+ unsigned int interaction_disabled_counter;
/// \todo fixme: This has to be implemented in different way */
guint guides_active : 1;
@@ -226,6 +229,9 @@ struct SPDesktop : public Inkscape::UI::View::View
void updateNow();
void updateCanvasNow();
+ void enableInteraction();
+ void disableInteraction();
+
void fullscreen();
void registerEditWidget (Inkscape::UI::View::EditWidgetInterface *widget)
diff --git a/src/ui/view/edit-widget-interface.h b/src/ui/view/edit-widget-interface.h
index 605c72b59..7cc0133d3 100644
--- a/src/ui/view/edit-widget-interface.h
+++ b/src/ui/view/edit-widget-interface.h
@@ -5,7 +5,9 @@
*
* Authors:
* Ralf Stephan <ralf@ark.in-berlin.de>
+ * John Bintz <jcoswell@coswellproductions.org>
*
+ * Copyright (C) 2006 John Bintz
* Copyright (C) 2005 Ralf Stephan
*
* Released under GNU GPL. Read the file 'COPYING' for more information.
@@ -73,6 +75,12 @@ struct EditWidgetInterface
/// Force a redraw of the canvas
virtual void requestCanvasUpdateAndWait() = 0;
+ /// Enable interaction on this desktop
+ virtual void enableInteraction() = 0;
+
+ /// Disable interaction on this desktop
+ virtual void disableInteraction() = 0;
+
/// Update the "active desktop" indicator
virtual void activateDesktop() = 0;
diff --git a/src/ui/view/edit-widget.cpp b/src/ui/view/edit-widget.cpp
index 6a4306147..83566c199 100644
--- a/src/ui/view/edit-widget.cpp
+++ b/src/ui/view/edit-widget.cpp
@@ -16,7 +16,9 @@
* Derek P. Moore <derekm@hackunix.org>
* Lauris Kaplinski <lauris@kaplinski.com>
* Frank Felfe <innerspace@iname.com>
+ * John Bintz <jcoswell@coswellproductions.org>
*
+ * Copyright (C) 2006 John Bintz
* Copyright (C) 1999-2005 Authors
* Copyright (C) 2000-2001 Ximian, Inc.
*
@@ -74,7 +76,8 @@ EditWidget::EditWidget (SPDocument *doc)
_act_grp(Gtk::ActionGroup::create()),
_ui_mgr(Gtk::UIManager::create()),
_update_s_f(false),
- _update_a_f(false)
+ _update_a_f(false),
+ _interaction_disabled_counter(0)
{
g_warning("Creating new EditWidget");
@@ -1303,6 +1306,28 @@ EditWidget::requestCanvasUpdateAndWait()
}
void
+EditWidget::enableInteraction()
+{
+ g_return_if_fail(_interaction_disabled_counter > 0);
+
+ _interaction_disabled_counter--;
+
+ if (_interaction_disabled_counter == 0) {
+ this->set_sensitive(true);
+ }
+}
+
+void
+EditWidget::disableInteraction()
+{
+ if (_interaction_disabled_counter == 0) {
+ this->set_sensitive(false);
+ }
+
+ _interaction_disabled_counter++;
+}
+
+void
EditWidget::activateDesktop()
{
/// \todo active_desktop_indicator not implemented
diff --git a/src/ui/view/edit-widget.h b/src/ui/view/edit-widget.h
index 096137c2a..55a52be4c 100644
--- a/src/ui/view/edit-widget.h
+++ b/src/ui/view/edit-widget.h
@@ -6,7 +6,9 @@
* Bryce W. Harrington <bryce@bryceharrington.org>
* Derek P. Moore <derekm@hackunix.org>
* Ralf Stephan <ralf@ark.in-berlin.de>
+ * John Bintz <jcoswell@coswellproductions.org>
*
+ * Copyright (C) 2006 John Bintz
* Copyright (C) 2004 Bryce Harrington
*
* Released under GNU GPL. Read the file 'COPYING' for more information.
@@ -109,6 +111,8 @@ public:
virtual void destroy();
virtual void requestCanvasUpdate();
virtual void requestCanvasUpdateAndWait();
+ virtual void enableInteraction();
+ virtual void disableInteraction();
virtual void activateDesktop();
virtual void deactivateDesktop();
virtual void viewSetPosition (NR::Point p);
@@ -193,6 +197,7 @@ private:
void onAdjValueChanged();
bool _update_s_f, _update_a_f;
+ unsigned int _interaction_disabled_counter;
sigc::connection _namedview_modified_connection;
};
diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp
index 795fdb0f8..9ede6f27e 100644
--- a/src/widgets/desktop-widget.cpp
+++ b/src/widgets/desktop-widget.cpp
@@ -8,7 +8,9 @@
* MenTaLguY <mental@rydia.net>
* bulia byak <buliabyak@users.sf.net>
* Ralf Stephan <ralf@ark.in-berlin.de>
+ * John Bintz <jcoswell@coswellproductions.org>
*
+ * Copyright (C) 2006 John Bintz
* Copyright (C) 2004 MenTaLguY
* Copyright (C) 1999-2002 Lauris Kaplinski
* Copyright (C) 2000-2001 Ximian, Inc.
@@ -171,6 +173,8 @@ sp_desktop_widget_init (SPDesktopWidget *dtw)
dtw->desktop = NULL;
+ dtw->_interaction_disabled_counter = 0;
+
dtw->tt = gtk_tooltips_new ();
/* Main table */
@@ -669,6 +673,28 @@ SPDesktopWidget::requestCanvasUpdateAndWait() {
}
+void
+SPDesktopWidget::enableInteraction()
+{
+ g_return_if_fail(_interaction_disabled_counter > 0);
+
+ _interaction_disabled_counter--;
+
+ if (_interaction_disabled_counter == 0) {
+ gtk_widget_set_sensitive(GTK_WIDGET(this), TRUE);
+ }
+}
+
+void
+SPDesktopWidget::disableInteraction()
+{
+ if (_interaction_disabled_counter == 0) {
+ gtk_widget_set_sensitive(GTK_WIDGET(this), FALSE);
+ }
+
+ _interaction_disabled_counter++;
+}
+
void
SPDesktopWidget::setCoordinateStatus(NR::Point p)
{
diff --git a/src/widgets/desktop-widget.h b/src/widgets/desktop-widget.h
index 409f38a8d..0514dd393 100644
--- a/src/widgets/desktop-widget.h
+++ b/src/widgets/desktop-widget.h
@@ -5,6 +5,7 @@
* SPDesktopWidget: handling Gtk events on a desktop.
*
* Authors:
+ * John Bintz <jcoswell@coswellproductions.org> (c) 2006
* Ralf Stephan <ralf@ark.in-berlin.de> (c) 2005, distrib. under GPL2
* ? -2004
*/
@@ -92,6 +93,8 @@ struct SPDesktopWidget {
Inkscape::UI::Widget::SelectedStyle *selected_style;
gint coord_status_id, select_status_id;
+
+ unsigned int _interaction_disabled_counter;
SPCanvas *canvas;
NR::Point ruler_origin;
@@ -135,6 +138,10 @@ struct SPDesktopWidget {
{ _dtw->requestCanvasUpdate(); }
virtual void requestCanvasUpdateAndWait()
{ _dtw->requestCanvasUpdateAndWait(); }
+ virtual void enableInteraction()
+ { _dtw->enableInteraction(); }
+ virtual void disableInteraction()
+ { _dtw->disableInteraction(); }
virtual void activateDesktop()
{ sp_dtw_desktop_activate (_dtw); }
virtual void deactivateDesktop()
@@ -186,6 +193,8 @@ struct SPDesktopWidget {
void setCoordinateStatus(NR::Point p);
void requestCanvasUpdate();
void requestCanvasUpdateAndWait();
+ void enableInteraction();
+ void disableInteraction();
void updateTitle(gchar const *uri);
};