summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 843dd3b)
raw | patch | inline | side by side (parent: 843dd3b)
author | bryce <bryce@users.sourceforge.net> | |
Wed, 21 Feb 2007 09:32:19 +0000 (09:32 +0000) | ||
committer | bryce <bryce@users.sourceforge.net> | |
Wed, 21 Feb 2007 09:32:19 +0000 (09:32 +0000) |
marker dropdown with the same preview image as the unmodified stock
marker. This adds the source document's uri to the cache index.
marker. This adds the source document's uri to the cache index.
src/dialogs/stroke-style.cpp | patch | blob | history | |
src/ui/cache/svg_preview_cache.cpp | patch | blob | history | |
src/ui/cache/svg_preview_cache.h | patch | blob | history |
index 334b01dd1aa1a70676a7bccfac171605236c01e7..0d22a90f7647ce3df824decbcf551ad40ffad750 100644 (file)
double sf = 0.8;
GdkPixbuf* pixbuf = NULL;
- Glib::ustring key = svg_preview_cache.cache_key(mname, psize);
+ Glib::ustring key = svg_preview_cache.cache_key(source->uri, mname, psize);
pixbuf = svg_preview_cache.get_preview_from_cache(key);
if (pixbuf == NULL) {
@@ -687,6 +687,7 @@ sp_marker_menu_build (GtkWidget *m, GSList *marker_list, SPDocument *source, SPD
gtk_widget_show(hb);
// generate preview
+
GtkWidget *prv = sp_marker_prev_new (22, markid, source, sandbox, menu_id, arena, visionkey, root);
gtk_widget_show(prv);
gtk_box_pack_start(GTK_BOX(hb), prv, FALSE, FALSE, 6);
index 4aa46af2b32088a365755f065881d6d3391f95ca..cee1db71504968a36c4bf6174ab0bbc9be26cb6d 100644 (file)
{
}
-Glib::ustring SvgPreview::cache_key(gchar const *name, unsigned psize) const {
- Glib::ustring key = name;
+Glib::ustring SvgPreview::cache_key(gchar const *uri, gchar const *name, unsigned psize) const {
+ Glib::ustring key;
+ key += (uri!=NULL) ? uri : "";
+ key += ":";
+ key += (name!=NULL) ? name : "unknown";
key += ":";
key += psize;
return key;
@@ -128,10 +131,10 @@ void SvgPreview::set_preview_in_cache(const Glib::ustring& key, GdkPixbuf* px) {
_pixmap_cache[key] = px;
}
-GdkPixbuf* SvgPreview::get_preview(const gchar* id, NRArenaItem *root,
+GdkPixbuf* SvgPreview::get_preview(const gchar* uri, const gchar* id, NRArenaItem *root,
double scale_factor, unsigned int psize) {
// First try looking up the cached preview in the cache map
- Glib::ustring key = cache_key(id, psize);
+ Glib::ustring key = cache_key(uri, id, psize);
GdkPixbuf* px = get_preview_from_cache(key);
if (px == NULL) {
set_preview_in_cache(key, px);
*/
}
+ return px;
}
};
index 14e05d2f8daa3ec9968feecc6f21a203db46de13..79ea80239808e51a32ae18ab41c47687d2065f47 100644 (file)
SvgPreview();
~SvgPreview();
- Glib::ustring cache_key(gchar const *name, unsigned psize) const;
+ Glib::ustring cache_key(gchar const *uri, gchar const *name, unsigned psize) const;
GdkPixbuf* get_preview_from_cache(const Glib::ustring& key);
void set_preview_in_cache(const Glib::ustring& key, GdkPixbuf* px);
- GdkPixbuf* get_preview(const gchar* id, NRArenaItem *root, double scale_factor, unsigned int psize);
+ GdkPixbuf* get_preview(const gchar* uri, const gchar* id, NRArenaItem *root, double scale_factor, unsigned int psize);
};
}; // namespace Cache