From: jucablues Date: Mon, 4 May 2009 11:49:18 +0000 (+0000) Subject: add "Reset missing glyph" button to svgfonts dialog X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=cbffe310300d15d435ad99b787ecef187975cdf3;p=inkscape.git add "Reset missing glyph" button to svgfonts dialog --- diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp index 98b59d790..a662ff1d1 100644 --- a/src/ui/dialog/svg-fonts-dialog.cpp +++ b/src/ui/dialog/svg-fonts-dialog.cpp @@ -555,6 +555,25 @@ void SvgFontsDialog::missing_glyph_description_from_selected_path(){ update_glyphs(); } +void SvgFontsDialog::reset_missing_glyph_description(){ + SPDesktop* desktop = this->getDesktop(); + if (!desktop) { + g_warning("SvgFontsDialog: No active desktop"); + return; + } + + SPDocument* doc = sp_desktop_document(desktop); + SPObject* obj; + for (obj = get_selected_spfont()->children; obj; obj=obj->next){ + if (SP_IS_MISSING_GLYPH(obj)){ + obj->repr->setAttribute("d", (char*) "M0,0h1000v1024h-1000z"); + sp_document_done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Reset missing-glyph")); + } + } + + update_glyphs(); +} + void SvgFontsDialog::glyph_name_edit(const Glib::ustring&, const Glib::ustring& str){ Gtk::TreeModel::iterator i = _GlyphsList.get_selection()->get_selected(); if (!i) return; @@ -629,8 +648,12 @@ Gtk::VBox* SvgFontsDialog::glyphs_tab(){ Gtk::Label* missing_glyph_label = Gtk::manage(new Gtk::Label(_("Missing Glyph:"))); missing_glyph_hbox->pack_start(*missing_glyph_label, false,false); missing_glyph_hbox->pack_start(missing_glyph_button, false,false); + missing_glyph_hbox->pack_start(missing_glyph_reset_button, false,false); missing_glyph_button.set_label(_("From selection...")); missing_glyph_button.signal_clicked().connect(sigc::mem_fun(*this, &SvgFontsDialog::missing_glyph_description_from_selected_path)); + missing_glyph_reset_button.set_label(_("Reset")); + missing_glyph_reset_button.signal_clicked().connect(sigc::mem_fun(*this, &SvgFontsDialog::reset_missing_glyph_description)); + glyphs_vbox.pack_start(*missing_glyph_hbox, false,false); glyphs_vbox.add(_GlyphsListScroller); @@ -771,7 +794,7 @@ SPFont *new_font(SPDocument *document) //create a missing glyph Inkscape::XML::Node *mg; mg = xml_doc->createElement("svg:missing-glyph"); - mg->setAttribute("d", "M0,0h1020v1024h-1020z"); + mg->setAttribute("d", "M0,0h1000v1024h-1000z"); repr->appendChild(mg); // get corresponding object diff --git a/src/ui/dialog/svg-fonts-dialog.h b/src/ui/dialog/svg-fonts-dialog.h index 83851de91..e6042ed42 100644 --- a/src/ui/dialog/svg-fonts-dialog.h +++ b/src/ui/dialog/svg-fonts-dialog.h @@ -99,6 +99,7 @@ private: void populate_kerning_pairs_box(); void set_glyph_description_from_selected_path(); void missing_glyph_description_from_selected_path(); + void reset_missing_glyph_description(); void add_glyph(); void glyph_unicode_edit(const Glib::ustring&, const Glib::ustring&); void glyph_name_edit(const Glib::ustring&, const Glib::ustring&); @@ -131,6 +132,7 @@ private: Gtk::Button add_glyph_button; Gtk::Button glyph_from_path_button; Gtk::Button missing_glyph_button; + Gtk::Button missing_glyph_reset_button; class Columns : public Gtk::TreeModel::ColumnRecord {