summaryrefslogtreecommitdiffstats
path: root/src/widgets/toolbox.cpp
diff options
context:
space:
mode:
authorbuliabyak <>2009-12-01 17:49:17 +0000
committerbuliabyak <>2009-12-01 17:49:17 +0000
commit542c229bba54c1cca6f02c86c09edf5de6582bb1 (patch)
treed8cc2ce00fa6adfeaf2ce930772c5be39b9c6955 /src/widgets/toolbox.cpp
parentSpray Tool by the students at Ecole Centrale de Lyon, Lyon, France (diff)
parentmerge (diff)
downloadinkscape-542c229bba54c1cca6f02c86c09edf5de6582bb1.tar.gz
inkscape-542c229bba54c1cca6f02c86c09edf5de6582bb1.zip
add an option for displaying font previews in the text tool's font list; also limit the width of the list by 500 pixels
(bzr r8852)
Diffstat (limited to 'src/widgets/toolbox.cpp')
-rw-r--r--src/widgets/toolbox.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp
index 41a70f08a..5f163d138 100644
--- a/src/widgets/toolbox.cpp
+++ b/src/widgets/toolbox.cpp
@@ -6733,17 +6733,25 @@ cell_data_func (GtkCellLayout */*cell_layout*/,
gtk_tree_model_get(tree_model, iter, 0, &family, -1);
gchar *const family_escaped = g_markup_escape_text(family, -1);
- static char const *const sample = _("AaBbCcIiPpQq12369$\342\202\254\302\242?.;/()");
- gchar *const sample_escaped = g_markup_escape_text(sample, -1);
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ int show_sample = prefs->getInt("/tools/text/show_sample_in_list", 1);
+ if (show_sample) {
+
+ Glib::ustring sample = prefs->getString("/tools/text/font_sample");
+ gchar *const sample_escaped = g_markup_escape_text(sample.data(), -1);
std::stringstream markup;
markup << family_escaped << " <span foreground='darkgray' font_family='"
<< family_escaped << "'>" << sample_escaped << "</span>";
g_object_set (G_OBJECT (cell), "markup", markup.str().c_str(), NULL);
+ g_free(sample_escaped);
+ } else {
+ g_object_set (G_OBJECT (cell), "markup", family_escaped, NULL);
+ }
+
g_free(family);
g_free(family_escaped);
- g_free(sample_escaped);
}
gboolean text_toolbox_completion_match_selected (GtkEntryCompletion *widget,
@@ -6873,7 +6881,7 @@ sp_text_toolbox_new (SPDesktop *desktop)
// expand the field a bit so as to view more of the previews in the drop-down
GtkRequisition req;
gtk_widget_size_request (GTK_WIDGET (font_sel->gobj()), &req);
- gtk_widget_set_size_request (GTK_WIDGET (font_sel->gobj()), req.width + 40, -1);
+ gtk_widget_set_size_request (GTK_WIDGET (font_sel->gobj()), MIN(req.width + 50, 500), -1);
GtkWidget* entry = (GtkWidget*) font_sel->get_entry()->gobj();
g_signal_connect (G_OBJECT (entry), "activate", G_CALLBACK (sp_text_toolbox_family_changed), tbl);