From: bryce Date: Tue, 20 Feb 2007 08:57:15 +0000 (+0000) Subject: Completes fix for 980157. Markers in current document's defs is now X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=3668bd8a339cb33d71c3ce1a1c6520374fc70147;p=inkscape.git Completes fix for 980157. Markers in current document's defs is now shown in top of the marker dropdown menu. When you select a marker from the dropdown, all three menus are updated to show what you selected at the top. Note that to implement this, a marker cache is introduced, because otherwise the regeneration of the menus would be noticeably too slow. There is still a modest pause during the regeneration, but it's fairly reasonable on my machine. --- diff --git a/src/dialogs/stroke-style.cpp b/src/dialogs/stroke-style.cpp index a488c1533..5504b9273 100644 --- a/src/dialogs/stroke-style.cpp +++ b/src/dialogs/stroke-style.cpp @@ -79,6 +79,7 @@ static GtkWidget * marker_start_menu = NULL; static GtkWidget * marker_mid_menu = NULL; static GtkWidget * marker_end_menu = NULL; +static Inkscape::UI::Cache::SvgPreview svg_preview_cache; /** * Create the stroke style widget, and hook up all the signals. @@ -602,7 +603,15 @@ sp_marker_prev_new(unsigned psize, gchar const *mname, /* Update to renderable state */ double sf = 0.8; - GdkPixbuf* pixbuf = render_pixbuf(root, sf, dbox, psize); + GdkPixbuf* pixbuf = NULL; + + Glib::ustring key = svg_preview_cache.cache_key(mname, psize); + pixbuf = svg_preview_cache.get_preview_from_cache(key); + + if (pixbuf == NULL) { + pixbuf = render_pixbuf(root, sf, dbox, psize); + svg_preview_cache.set_preview_in_cache(key, pixbuf); + } // Create widget GtkWidget *pb = gtk_image_new_from_pixbuf(pixbuf); @@ -700,7 +709,9 @@ sp_marker_list_from_doc (GtkWidget *m, SPDocument *current_doc, SPDocument *sour NRArena const *arena = NRArena::create(); /* Create ArenaItem and set transform */ unsigned const visionkey = sp_item_display_key_new(1); +/* NRArenaItem *root = sp_item_invoke_show( SP_ITEM(SP_DOCUMENT_ROOT (sandbox)), (NRArena *) arena, visionkey, SP_ITEM_SHOW_DISPLAY ); +*/ for (; ml != NULL; ml = ml->next) { if (!SP_IS_MARKER(ml->data)) @@ -771,6 +782,57 @@ gchar const *buffer = "