From: johncoswell Date: Sun, 13 Aug 2006 17:45:18 +0000 (+0000) Subject: added functions to allow update events to process during long-running operations X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=e59ade72d43f975a967823362ce085d6b72dda7e;p=inkscape.git added functions to allow update events to process during long-running operations --- diff --git a/src/desktop.cpp b/src/desktop.cpp index 189ab9866..04328e84d 100644 --- a/src/desktop.cpp +++ b/src/desktop.cpp @@ -1054,6 +1054,12 @@ SPDesktop::onRedrawRequested () } } +void +SPDesktop::updateCanvasNow() +{ + _widget->requestCanvasUpdateAndWait(); +} + /** * Associate document with desktop. */ diff --git a/src/desktop.h b/src/desktop.h index e499358c7..5e0b1f3a8 100644 --- a/src/desktop.h +++ b/src/desktop.h @@ -224,6 +224,7 @@ struct SPDesktop : public Inkscape::UI::View::View void setToolboxAdjustmentValue (gchar const* id, double val); bool isToolboxButtonActive (gchar const *id); void updateNow(); + void updateCanvasNow(); void fullscreen(); diff --git a/src/ui/view/edit-widget-interface.h b/src/ui/view/edit-widget-interface.h index 689eff4a7..605c72b59 100644 --- a/src/ui/view/edit-widget-interface.h +++ b/src/ui/view/edit-widget-interface.h @@ -70,6 +70,9 @@ struct EditWidgetInterface /// Queue a redraw request with the canvas virtual void requestCanvasUpdate() = 0; + /// Force a redraw of the canvas + virtual void requestCanvasUpdateAndWait() = 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 626c30941..6a4306147 100644 --- a/src/ui/view/edit-widget.cpp +++ b/src/ui/view/edit-widget.cpp @@ -1293,6 +1293,15 @@ EditWidget::requestCanvasUpdate() _svg_canvas.widget().queue_draw(); } +void +EditWidget::requestCanvasUpdateAndWait() +{ + requestCanvasUpdate(); + + while (gtk_events_pending()) + gtk_main_iteration_do(FALSE); +} + void EditWidget::activateDesktop() { diff --git a/src/ui/view/edit-widget.h b/src/ui/view/edit-widget.h index 0beb77b53..096137c2a 100644 --- a/src/ui/view/edit-widget.h +++ b/src/ui/view/edit-widget.h @@ -108,6 +108,7 @@ public: virtual bool shutdown(); virtual void destroy(); virtual void requestCanvasUpdate(); + virtual void requestCanvasUpdateAndWait(); virtual void activateDesktop(); virtual void deactivateDesktop(); virtual void viewSetPosition (NR::Point p); diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index 9590af94c..795fdb0f8 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -660,6 +660,15 @@ SPDesktopWidget::requestCanvasUpdate() { gtk_widget_queue_draw (GTK_WIDGET (SP_CANVAS_ITEM (this->desktop->main)->canvas)); } +void +SPDesktopWidget::requestCanvasUpdateAndWait() { + requestCanvasUpdate(); + + while (gtk_events_pending()) + gtk_main_iteration_do(FALSE); + +} + void SPDesktopWidget::setCoordinateStatus(NR::Point p) { diff --git a/src/widgets/desktop-widget.h b/src/widgets/desktop-widget.h index cc66bf180..409f38a8d 100644 --- a/src/widgets/desktop-widget.h +++ b/src/widgets/desktop-widget.h @@ -133,6 +133,8 @@ struct SPDesktopWidget { virtual void requestCanvasUpdate() { _dtw->requestCanvasUpdate(); } + virtual void requestCanvasUpdateAndWait() + { _dtw->requestCanvasUpdateAndWait(); } virtual void activateDesktop() { sp_dtw_desktop_activate (_dtw); } virtual void deactivateDesktop() @@ -183,6 +185,7 @@ struct SPDesktopWidget { bool isToolboxButtonActive (gchar const *id); void setCoordinateStatus(NR::Point p); void requestCanvasUpdate(); + void requestCanvasUpdateAndWait(); void updateTitle(gchar const *uri); };