summaryrefslogtreecommitdiffstats
path: root/src
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
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')
-rw-r--r--src/preferences-skeleton.h1
-rw-r--r--src/ui/dialog/inkscape-preferences.cpp11
-rw-r--r--src/widgets/toolbox.cpp16
3 files changed, 21 insertions, 7 deletions
diff --git a/src/preferences-skeleton.h b/src/preferences-skeleton.h
index 80a1bd5ea..70d1140ba 100644
--- a/src/preferences-skeleton.h
+++ b/src/preferences-skeleton.h
@@ -111,6 +111,7 @@ static char const preferences_skeleton[] =
" </eventcontext>\n"
" <eventcontext id=\"text\" usecurrent=\"0\" gradientdrag=\"1\"\n"
" font_sample=\"AaBbCcIiPpQq12369$\342\202\254\302\242?.;/()\"\n"
+" show_sample_in_list=\"1\"\n"
" style=\"fill:black;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;font-style:normal;font-weight:normal;font-size:40px;\" selcue=\"1\"/>\n"
" <eventcontext id=\"nodes\" selcue=\"1\" gradientdrag=\"1\" highlight_color=\"4278190335\" pathflash_enabled=\"1\" pathflash_unselected=\"0\" pathflash_timeout=\"500\" show_handles=\"1\" show_helperpath=\"0\" sculpting_profile=\"1\" />\n"
" <eventcontext id=\"tweak\" selcue=\"0\" gradientdrag=\"0\" show_handles=\"0\" width=\"0.2\" force=\"0.2\" fidelity=\"0.5\" usepressure=\"1\" style=\"fill:red;stroke:none;\" usecurrent=\"0\"/>\n"
diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp
index 6e30ef61a..b217f8695 100644
--- a/src/ui/dialog/inkscape-preferences.cpp
+++ b/src/ui/dialog/inkscape-preferences.cpp
@@ -476,15 +476,15 @@ void InkscapePreferences::initPageTools()
this->AddNewObjectsStyle(_page_3dbox, "/tools/shapes/3dbox");
this->AddConvertGuidesCheckbox(_page_3dbox, "/tools/shapes/3dbox", true);
- //ellipse
+ //Ellipse
this->AddPage(_page_ellipse, _("Ellipse"), iter_shapes, PREFS_PAGE_TOOLS_SHAPES_ELLIPSE);
this->AddNewObjectsStyle(_page_ellipse, "/tools/shapes/arc");
- //star
+ //Star
this->AddPage(_page_star, _("Star"), iter_shapes, PREFS_PAGE_TOOLS_SHAPES_STAR);
this->AddNewObjectsStyle(_page_star, "/tools/shapes/star");
- //spiral
+ //Spiral
this->AddPage(_page_spiral, _("Spiral"), iter_shapes, PREFS_PAGE_TOOLS_SHAPES_SPIRAL);
this->AddNewObjectsStyle(_page_spiral, "/tools/shapes/spiral");
@@ -528,6 +528,11 @@ void InkscapePreferences::initPageTools()
this->AddPage(_page_text, _("Text"), iter_tools, PREFS_PAGE_TOOLS_TEXT);
this->AddSelcueCheckbox(_page_text, "/tools/text", true);
this->AddGradientCheckbox(_page_text, "/tools/text", true);
+ {
+ PrefCheckButton* cb = Gtk::manage( new PrefCheckButton);
+ cb->init ( _("Show font samples in the drop-down list"), "/tools/text/show_sample_in_list", 1);
+ _page_text.add_line( false, "", *cb, "", _("Show font samples alongside font names in the drop-down list in Text bar"));
+ }
this->AddNewObjectsStyle(_page_text, "/tools/text");
//Gradient
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);