diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2013-02-12 19:47:42 +0000 |
|---|---|---|
| committer | Jabiertxo Arraiza Zenotz <jtx@jtx.marker.es> | 2013-02-12 19:47:42 +0000 |
| commit | cedc47b4fecef50c74c9e5fc56922450f81a53cf (patch) | |
| tree | f23ffee6f812b562cec7ef52d7d000ee1614dd6d /src/widgets/text-toolbar.cpp | |
| parent | Fix po files (diff) | |
| parent | Translations. Russian translation update by Alexandre Prokoudine. (diff) | |
| download | inkscape-cedc47b4fecef50c74c9e5fc56922450f81a53cf.tar.gz inkscape-cedc47b4fecef50c74c9e5fc56922450f81a53cf.zip | |
Update from trunk
(bzr r11950.2.1)
Diffstat (limited to 'src/widgets/text-toolbar.cpp')
| -rw-r--r-- | src/widgets/text-toolbar.cpp | 95 |
1 files changed, 2 insertions, 93 deletions
diff --git a/src/widgets/text-toolbar.cpp b/src/widgets/text-toolbar.cpp index 5ba2065b9..a01f950a6 100644 --- a/src/widgets/text-toolbar.cpp +++ b/src/widgets/text-toolbar.cpp @@ -133,97 +133,6 @@ static void sp_print_fontstyle( SPStyle *query ) { } #endif -// Format family drop-down menu. -static void cell_data_func(GtkCellLayout * /*cell_layout*/, - GtkCellRenderer *cell, - GtkTreeModel *model, - GtkTreeIter *iter, - gpointer /*data*/) -{ - gchar *family; - gboolean onSystem = false; - gtk_tree_model_get(model, iter, 0, &family, 2, &onSystem, -1); - Glib::ustring family_escaped = g_markup_escape_text(family, -1); - g_free(family); - Glib::ustring markup; - - if( !onSystem ) { - markup = "<span foreground='darkblue'>"; - - /* See if font-family on system */ - std::vector<Glib::ustring> tokens = Glib::Regex::split_simple("\\s*,\\s*", family_escaped ); - for( size_t i=0; i < tokens.size(); ++i ) { - - Glib::ustring token = tokens[i]; - - GtkTreeIter iter; - gboolean valid; - gchar *family = 0; - gboolean onSystem = true; - gboolean found = false; - for( valid = gtk_tree_model_get_iter_first( GTK_TREE_MODEL(model), &iter ); - valid; - valid = gtk_tree_model_iter_next( GTK_TREE_MODEL(model), &iter ) ) { - - gtk_tree_model_get(model, &iter, 0, &family, 2, &onSystem, -1); - if( onSystem && token.compare( family ) == 0 ) { - found = true; - break; - } - } - if( found ) { - markup += g_markup_escape_text(token.c_str(), -1); - markup += ", "; - } else { - markup += "<span strikethrough=\"true\" strikethrough_color=\"red\">"; - markup += g_markup_escape_text(token.c_str(), -1); - markup += "</span>"; - markup += ", "; - } - } - // Remove extra comma and space from end. - if( markup.size() >= 2 ) { - markup.resize( markup.size()-2 ); - } - markup += "</span>"; - // std::cout << markup << std::endl; - } else { - markup = family_escaped; - } - - 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"); - Glib::ustring sample_escaped = g_markup_escape_text(sample.data(), -1); - - markup += " <span foreground='gray' font_family='"; - markup += family_escaped; - markup += "'>"; - markup += sample_escaped; - markup += "</span>"; - } - - g_object_set (G_OBJECT (cell), "markup", markup.c_str(), NULL); - - // This doesn't work for two reasons... it set both selected and not selected backgrounds - // to white.. which means that white foreground text is invisible. It also only effects - // the text region, leaving the padding untouched. - // g_object_set (G_OBJECT (cell), "cell-background", "white", "cell-background-set", true, NULL); - -} - -// Separator function (if true, a separator will be drawn) -static gboolean separator_func(GtkTreeModel *model, - GtkTreeIter *iter, - gpointer /*data*/) -{ - gchar* text = 0; - gtk_tree_model_get(model, iter, 0, &text, -1 ); // Column 0 - return (text && strcmp(text,"#") == 0); -} - /* * Fill the font style combobox with the available font styles for the selected font family * Set the selected style to that in font @@ -1613,8 +1522,8 @@ void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje GTK_TREE_MODEL(model), -1, // Entry width 50, // Extra list width - (gpointer)cell_data_func, // Cell layout - (gpointer)separator_func, + (gpointer)font_lister_cell_data_func, // Cell layout + (gpointer)font_lister_separator_func, GTK_WIDGET(desktop->canvas)); // Focus widget ink_comboboxentry_action_popup_enable( act ); // Enable entry completion gchar *const warning = _("Font not found on system"); |
