From: buliabyak <> Date: Tue, 1 Dec 2009 17:49:17 +0000 (-0400) Subject: add an option for displaying font previews in the text tool's font list; also limit... X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=88a2dc0cba7c55aafc253ca19572e9f5538df31f;p=inkscape.git add an option for displaying font previews in the text tool's font list; also limit the width of the list by 500 pixels --- 88a2dc0cba7c55aafc253ca19572e9f5538df31f diff --cc src/preferences-skeleton.h index 80a1bd5ea,80a1bd5ea..70d1140ba --- a/src/preferences-skeleton.h +++ b/src/preferences-skeleton.h @@@ -111,6 -111,6 +111,7 @@@ static char const preferences_skeleton[ " \n" " \n" " \n" " \n" diff --cc src/ui/dialog/inkscape-preferences.cpp index 6e30ef61a,6e30ef61a..b217f8695 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@@ -476,15 -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,6 +528,11 @@@ 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 --cc src/widgets/toolbox.cpp index 41a70f08a,41a70f08a..5f163d138 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@@ -6733,17 -6733,17 +6733,25 @@@ cell_data_func (GtkCellLayout */*cell_ 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 << " " << sample_escaped << ""; 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 -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);