summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorchr <chr>2017-05-18 17:58:59 +0000
committerchr <chr>2017-05-18 17:58:59 +0000
commitff2d6ce5f8ed0d8fb9bcf014d9c00c4e71b83e5b (patch)
treef8cac587fcf181f0091ca7d7c0711324346a6003 /src
parentfix a brunch of memory leaks (diff)
downloadinkscape-ff2d6ce5f8ed0d8fb9bcf014d9c00c4e71b83e5b.tar.gz
inkscape-ff2d6ce5f8ed0d8fb9bcf014d9c00c4e71b83e5b.zip
stroke-style: fix preloading no-marker
speed up inkscape startup (bzr r15698.1.3)
Diffstat (limited to 'src')
-rw-r--r--src/widgets/stroke-marker-selector.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/widgets/stroke-marker-selector.cpp b/src/widgets/stroke-marker-selector.cpp
index b0c23a88c..3f81bef5c 100644
--- a/src/widgets/stroke-marker-selector.cpp
+++ b/src/widgets/stroke-marker-selector.cpp
@@ -54,8 +54,13 @@ MarkerComboBox::MarkerComboBox(gchar const *id, int l) :
set_cell_data_func(image_renderer, sigc::mem_fun(*this, &MarkerComboBox::prepareImageRenderer));
gtk_combo_box_set_row_separator_func(GTK_COMBO_BOX(gobj()), MarkerComboBox::separator_cb, NULL, NULL);
+ Glib::ustring no_marker("no-marker");
+ Glib::RefPtr<Gtk::IconTheme> iconTheme = Gtk::IconTheme::get_default();
+ if (!iconTheme->has_icon(no_marker)) {
+ Inkscape::queueIconPrerender( INKSCAPE_ICON(no_marker.data()), Inkscape::ICON_SIZE_SMALL_TOOLBAR );
+ }
empty_image = new Gtk::Image( Glib::wrap(
- sp_pixbuf_new( Inkscape::ICON_SIZE_SMALL_TOOLBAR, INKSCAPE_ICON("no-marker") ) ) );
+ sp_pixbuf_new( Inkscape::ICON_SIZE_SMALL_TOOLBAR, INKSCAPE_ICON(no_marker.data()) ) ) );
sandbox = ink_markers_preview_doc ();
desktop = SP_ACTIVE_DESKTOP;
@@ -71,6 +76,7 @@ MarkerComboBox::MarkerComboBox(gchar const *id, int l) :
MarkerComboBox::~MarkerComboBox() {
delete combo_id;
delete sandbox;
+ delete empty_image;
if (doc) {
modified_connection.disconnect();
@@ -393,7 +399,7 @@ void MarkerComboBox::add_markers (GSList *marker_list, SPDocument *source, gbool
gchar const *markid = repr->attribute("inkscape:stockid") ? repr->attribute("inkscape:stockid") : repr->attribute("id");
// generate preview
- Gtk::Image *prv = create_marker_image (22, repr->attribute("id"), source, drawing, visionkey);
+ Gtk::Image *prv = create_marker_image (24, repr->attribute("id"), source, drawing, visionkey);
prv->show();
// Add history before separator, others after
@@ -424,14 +430,14 @@ void
MarkerComboBox::update_marker_image(gchar const *mname)
{
gchar *cache_name = g_strconcat(combo_id, mname, NULL);
- Glib::ustring key = svg_preview_cache.cache_key(doc->getURI(), cache_name, 22);
+ Glib::ustring key = svg_preview_cache.cache_key(doc->getURI(), cache_name, 24);
g_free (cache_name);
svg_preview_cache.remove_preview_from_cache(key);
Inkscape::Drawing drawing;
unsigned const visionkey = SPItem::display_key_new(1);
drawing.setRoot(sandbox->getRoot()->invoke_show(drawing, visionkey, SP_ITEM_SHOW_DISPLAY));
- Gtk::Image *prv = create_marker_image(22, mname, doc, drawing, visionkey);
+ Gtk::Image *prv = create_marker_image(24, mname, doc, drawing, visionkey);
if (prv) {
prv->show();
}