From: glimmer07 Date: Wed, 22 Jul 2009 22:40:00 +0000 (+0000) Subject: Experimental pause updating scheme. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=605f7fa17f07754ccf23b434d0e85723edaba6a8;p=inkscape.git Experimental pause updating scheme. --- diff --git a/src/display/sp-canvas.cpp b/src/display/sp-canvas.cpp index e0d885d36..664713582 100644 --- a/src/display/sp-canvas.cpp +++ b/src/display/sp-canvas.cpp @@ -1028,6 +1028,8 @@ sp_canvas_init (SPCanvas *canvas) // See comment at in sp-canvas.h. canvas->gen_all_enter_events = false; + + canvas->drawing_disabled = false; canvas->tiles=NULL; canvas->tLeft=canvas->tTop=canvas->tRight=canvas->tBottom=0; @@ -2085,6 +2087,9 @@ do_update (SPCanvas *canvas) { if (!canvas->root || !canvas->pixmap_gc) // canvas may have already be destroyed by closing desktop durring interrupted display! return TRUE; + + if (canvas->drawing_disabled) + return TRUE; /* Cause the update if necessary */ if (canvas->need_update) { diff --git a/src/display/sp-canvas.h b/src/display/sp-canvas.h index 35e3fb5de..a17e2e086 100644 --- a/src/display/sp-canvas.h +++ b/src/display/sp-canvas.h @@ -181,6 +181,9 @@ struct SPCanvas { // connector tool). If so, they may temporarily set this flag to // 'true'. bool gen_all_enter_events; + + /* For scripting, sometimes we want to delay drawing. */ + bool drawing_disabled; int rendermode; diff --git a/src/extension/dbus/document-interface.cpp b/src/extension/dbus/document-interface.cpp index 664655f0e..76eeec509 100644 --- a/src/extension/dbus/document-interface.cpp +++ b/src/extension/dbus/document-interface.cpp @@ -161,8 +161,8 @@ finish_create_shape (DocumentInterface *object, GError **error, Inkscape::XML::N if (object->updates) sp_document_done(sp_desktop_document(object->desk), 0, (gchar *)desc); - else - document_interface_pause_updates(object, error); + //else + //document_interface_pause_updates(object, error); return strdup(newNode->attribute("id")); } @@ -178,10 +178,13 @@ dbus_call_verb (DocumentInterface *object, int verbid, GError **error) if ( verb ) { SPAction *action = verb->get_action(desk2); if ( action ) { + //if (!object->updates) + //document_interface_pause_updates (object, error); sp_action_perform( action, NULL ); - if (object->updates) { + if (object->updates) sp_document_done(sp_desktop_document(desk2), verb->get_code(), g_strdup(verb->get_tip())); - } + //if (!object->updates) + //document_interface_pause_updates (object, error); return TRUE; } } @@ -433,8 +436,8 @@ document_interface_node (DocumentInterface *object, gchar *type, GError **error) if (object->updates) sp_document_done(sp_desktop_document(object->desk), 0, (gchar *)"created empty node"); - else - document_interface_pause_updates(object, error); + //else + //document_interface_pause_updates(object, error); return strdup(newNode->attribute("id")); } @@ -699,6 +702,7 @@ document_interface_get_node_coordinates (DocumentInterface *object, gchar *shape Geom::parse_svg_path (path); return NULL; */ + return NULL; } @@ -813,16 +817,22 @@ void document_interface_pause_updates (DocumentInterface *object, GError **error) { object->updates = FALSE; - sp_desktop_document(object->desk)->root->uflags = FALSE; - sp_desktop_document(object->desk)->root->mflags = FALSE; + object->desk->canvas->drawing_disabled = 1; + //object->desk->canvas->need_redraw = 0; + //object->desk->canvas->need_repick = 0; + //sp_desktop_document(object->desk)->root->uflags = FALSE; + //sp_desktop_document(object->desk)->root->mflags = FALSE; } void document_interface_resume_updates (DocumentInterface *object, GError **error) { object->updates = TRUE; - sp_desktop_document(object->desk)->root->uflags = TRUE; - sp_desktop_document(object->desk)->root->mflags = TRUE; + object->desk->canvas->drawing_disabled = 0; + //object->desk->canvas->need_redraw = 1; + //object->desk->canvas->need_repick = 1; + //sp_desktop_document(object->desk)->root->uflags = TRUE; + //sp_desktop_document(object->desk)->root->mflags = TRUE; //sp_desktop_document(object->desk)->_updateDocument(); //FIXME: use better verb than rect. sp_document_done(sp_desktop_document(object->desk), SP_VERB_CONTEXT_RECT, "Multiple actions"); @@ -833,7 +843,9 @@ document_interface_update (DocumentInterface *object, GError **error) { sp_desktop_document(object->desk)->root->uflags = TRUE; sp_desktop_document(object->desk)->root->mflags = TRUE; + object->desk->enableInteraction(); sp_desktop_document(object->desk)->_updateDocument(); + object->desk->disableInteraction(); sp_desktop_document(object->desk)->root->uflags = FALSE; sp_desktop_document(object->desk)->root->mflags = FALSE; //sp_document_done(sp_desktop_document(object->desk), SP_VERB_CONTEXT_RECT, "Multiple actions"); @@ -989,12 +1001,23 @@ document_interface_selection_copy (DocumentInterface *object, GError **error) //sp_selection_copy (); return dbus_call_verb (object, SP_VERB_EDIT_COPY, error); } - +/* +gboolean +document_interface_selection_paste (DocumentInterface *object, GError **error) +{ + desktop_ensure_active (object->desk); + if (!object->updates) + document_interface_pause_updates (object, error); + sp_selection_paste (object->desk, TRUE); + if (!object->updates) + document_interface_pause_updates (object, error); + return TRUE; + //return dbus_call_verb (object, SP_VERB_EDIT_PASTE, error); +} +*/ gboolean document_interface_selection_paste (DocumentInterface *object, GError **error) { - //desktop_ensure_active (object->desk); - //sp_selection_paste (object->desk, TRUE); return dbus_call_verb (object, SP_VERB_EDIT_PASTE, error); }