Code

add "Reset missing glyph" button to svgfonts dialog
authorjucablues <jucablues@users.sourceforge.net>
Mon, 4 May 2009 11:49:18 +0000 (11:49 +0000)
committerjucablues <jucablues@users.sourceforge.net>
Mon, 4 May 2009 11:49:18 +0000 (11:49 +0000)
src/ui/dialog/svg-fonts-dialog.cpp
src/ui/dialog/svg-fonts-dialog.h

index 98b59d7907c5f13ca5ce6cc16dc75a979210391a..a662ff1d1435e4ca1ce0dc0eacffefd08cf3c712 100644 (file)
@@ -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
index 83851de91bbb7ee878a9fd096d3860690c571826..e6042ed4299488420fbc24660cc2d849a8c5b88b 100644 (file)
@@ -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
         {