X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fui%2Fdialog%2Fsvg-fonts-dialog.cpp;h=042acb6e1b3e16a4e22620d16115998f2b164d20;hb=9dc68827cbd515262ecb8d5ae8547d9e82c72e00;hp=9f9f91bd1d83c0a92ec8737af675d5ccc8832e86;hpb=072de79e6270f4137fa48a8a73491e8a0904d8f8;p=inkscape.git diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp index 9f9f91bd1..042acb6e1 100644 --- a/src/ui/dialog/svg-fonts-dialog.cpp +++ b/src/ui/dialog/svg-fonts-dialog.cpp @@ -3,6 +3,8 @@ */ /* Authors: * Felipe C. da S. Sanches + * Jon A. Cruz + * Abhishek Sharma * * Copyright (C) 2008 Authors * Released under GNU GPLv2 (or later). Read the file 'COPYING' for more information. @@ -117,8 +119,8 @@ void SvgFontsDialog::AttrEntry::on_attr_changed(){ Glib::ustring undokey = "svgfonts:"; undokey += name; - SPDocumentUndo::maybe_done(o->document, undokey.c_str(), SP_VERB_DIALOG_SVG_FONTS, - _("Set SVG Font attribute")); + DocumentUndo::maybeDone(o->document, undokey.c_str(), SP_VERB_DIALOG_SVG_FONTS, + _("Set SVG Font attribute")); } } @@ -171,9 +173,9 @@ void SvgFontsDialog::on_kerning_value_changed(){ //slider values increase from right to left so that they match the kerning pair preview - //XML Tree being directly used here while it shouldn't be. + //XML Tree being directly used here while it shouldn't be. this->kerning_pair->getRepr()->setAttribute("k", Glib::Ascii::dtostr(get_selected_spfont()->horiz_adv_x - kerning_slider.get_value()).c_str()); - SPDocumentUndo::maybe_done(document, undokey.c_str(), SP_VERB_DIALOG_SVG_FONTS, _("Adjust kerning value")); + DocumentUndo::maybeDone(document, undokey.c_str(), SP_VERB_DIALOG_SVG_FONTS, _("Adjust kerning value")); //populate_kerning_pairs_box(); kerning_preview.redraw(); @@ -245,7 +247,7 @@ void SvgFontsDialog::update_fonts() { SPDesktop* desktop = this->getDesktop(); SPDocument* document = sp_desktop_document(desktop); - const GSList* fonts = document->get_resource_list("font"); + const GSList* fonts = document->getResourceList("font"); _model->clear(); for(const GSList *l = fonts; l; l = l->next) { @@ -425,7 +427,7 @@ SvgFontsDialog::populate_kerning_pairs_box() SPGlyph *new_glyph(SPDocument* document, SPFont *font, const int count) { g_return_val_if_fail(font != NULL, NULL); - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document); + Inkscape::XML::Document *xml_doc = document->getReprDoc(); // create a new glyph Inkscape::XML::Node *repr; @@ -464,7 +466,7 @@ void SvgFontsDialog::add_glyph(){ SPDocument* doc = sp_desktop_document(this->getDesktop()); /* SPGlyph* glyph =*/ new_glyph(doc, get_selected_spfont(), count+1); - SPDocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Add glyph")); + DocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Add glyph")); update_glyphs(); } @@ -509,7 +511,7 @@ void SvgFontsDialog::set_glyph_description_from_selected_path(){ } //XML Tree being directly used here while it shouldn't be. glyph->getRepr()->setAttribute("d", (char*) sp_svg_write_path (pathv)); - SPDocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Set glyph curves")); + DocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Set glyph curves")); update_glyphs(); } @@ -551,9 +553,9 @@ void SvgFontsDialog::missing_glyph_description_from_selected_path(){ for (obj = get_selected_spfont()->children; obj; obj=obj->next){ if (SP_IS_MISSING_GLYPH(obj)){ - //XML Tree being directly used here while it shouldn't be. + //XML Tree being directly used here while it shouldn't be. obj->getRepr()->setAttribute("d", (char*) sp_svg_write_path (pathv)); - SPDocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Set glyph curves")); + DocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Set glyph curves")); } } @@ -571,9 +573,9 @@ void SvgFontsDialog::reset_missing_glyph_description(){ SPObject* obj; for (obj = get_selected_spfont()->children; obj; obj=obj->next){ if (SP_IS_MISSING_GLYPH(obj)){ - //XML Tree being directly used here while it shouldn't be. + //XML Tree being directly used here while it shouldn't be. obj->getRepr()->setAttribute("d", (char*) "M0,0h1000v1024h-1000z"); - SPDocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Reset missing-glyph")); + DocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Reset missing-glyph")); } } @@ -585,11 +587,11 @@ void SvgFontsDialog::glyph_name_edit(const Glib::ustring&, const Glib::ustring& if (!i) return; SPGlyph* glyph = (*i)[_GlyphsListColumns.glyph_node]; - //XML Tree being directly used here while it shouldn't be. + //XML Tree being directly used here while it shouldn't be. glyph->getRepr()->setAttribute("glyph-name", str.c_str()); SPDocument* doc = sp_desktop_document(this->getDesktop()); - SPDocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Edit glyph name")); + DocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Edit glyph name")); update_glyphs(); } @@ -599,22 +601,23 @@ void SvgFontsDialog::glyph_unicode_edit(const Glib::ustring&, const Glib::ustrin if (!i) return; SPGlyph* glyph = (*i)[_GlyphsListColumns.glyph_node]; - //XML Tree being directly used here while it shouldn't be. + //XML Tree being directly used here while it shouldn't be. glyph->getRepr()->setAttribute("unicode", str.c_str()); SPDocument* doc = sp_desktop_document(this->getDesktop()); - SPDocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Set glyph unicode")); + DocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Set glyph unicode")); update_glyphs(); } void SvgFontsDialog::remove_selected_font(){ SPFont* font = get_selected_spfont(); + if (!font) return; - //XML Tree being directly used here while it shouldn't be. + //XML Tree being directly used here while it shouldn't be. sp_repr_unparent(font->getRepr()); SPDocument* doc = sp_desktop_document(this->getDesktop()); - SPDocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Remove font")); + DocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Remove font")); update_fonts(); } @@ -631,7 +634,7 @@ void SvgFontsDialog::remove_selected_glyph(){ sp_repr_unparent(glyph->getRepr()); SPDocument* doc = sp_desktop_document(this->getDesktop()); - SPDocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Remove glyph")); + DocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Remove glyph")); update_glyphs(); } @@ -648,7 +651,7 @@ void SvgFontsDialog::remove_selected_kerning_pair(){ sp_repr_unparent(pair->getRepr()); SPDocument* doc = sp_desktop_document(this->getDesktop()); - SPDocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Remove kerning pair")); + DocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Remove kerning pair")); update_glyphs(); } @@ -719,11 +722,10 @@ void SvgFontsDialog::add_kerning_pair(){ if (this->kerning_pair) return; //We already have this kerning pair SPDocument* document = sp_desktop_document(this->getDesktop()); - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document); + Inkscape::XML::Document *xml_doc = document->getReprDoc(); // create a new hkern node - Inkscape::XML::Node *repr; - repr = xml_doc->createElement("svg:hkern"); + Inkscape::XML::Node *repr = xml_doc->createElement("svg:hkern"); repr->setAttribute("u1", first_glyph.get_active_text().c_str()); repr->setAttribute("u2", second_glyph.get_active_text().c_str()); @@ -736,7 +738,7 @@ void SvgFontsDialog::add_kerning_pair(){ // get corresponding object this->kerning_pair = SP_HKERN( document->getObjectByRepr(repr) ); - SPDocumentUndo::done(document, SP_VERB_DIALOG_SVG_FONTS, _("Add kerning pair")); + DocumentUndo::done(document, SP_VERB_DIALOG_SVG_FONTS, _("Add kerning pair")); } Gtk::VBox* SvgFontsDialog::kerning_tab(){ @@ -744,7 +746,7 @@ Gtk::VBox* SvgFontsDialog::kerning_tab(){ create_kerning_pairs_popup_menu(_KerningPairsList, sigc::mem_fun(*this, &SvgFontsDialog::remove_selected_kerning_pair)); //Kerning Setup: - kerning_vbox.add(*Gtk::manage(new Gtk::Label(_("Kerning Setup:")))); + kerning_vbox.add(*Gtk::manage(new Gtk::Label(_("Kerning Setup")))); Gtk::HBox* kerning_selector = Gtk::manage(new Gtk::HBox()); kerning_selector->add(*Gtk::manage(new Gtk::Label(_("1st Glyph:")))); kerning_selector->add(first_glyph); @@ -786,11 +788,10 @@ SPFont *new_font(SPDocument *document) SPDefs *defs = (SPDefs *) SP_DOCUMENT_DEFS(document); - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document); + Inkscape::XML::Document *xml_doc = document->getReprDoc(); // create a new font - Inkscape::XML::Node *repr; - repr = xml_doc->createElement("svg:font"); + Inkscape::XML::Node *repr = xml_doc->createElement("svg:font"); //By default, set the horizontal advance to 1024 units repr->setAttribute("horiz-adv-x", "1024"); @@ -825,12 +826,12 @@ void set_font_family(SPFont* font, char* str){ SPObject* obj; for (obj=font->children; obj; obj=obj->next){ if (SP_IS_FONTFACE(obj)){ - //XML Tree being directly used here while it shouldn't be. + //XML Tree being directly used here while it shouldn't be. obj->getRepr()->setAttribute("font-family", str); } } - SPDocumentUndo::done(font->document, SP_VERB_DIALOG_SVG_FONTS, _("Set font family")); + DocumentUndo::done(font->document, SP_VERB_DIALOG_SVG_FONTS, _("Set font family")); } void SvgFontsDialog::add_font(){ @@ -846,7 +847,7 @@ void SvgFontsDialog::add_font(){ SPObject* obj; for (obj=font->children; obj; obj=obj->next){ if (SP_IS_FONTFACE(obj)){ - //XML Tree being directly used here while it shouldn't be. + //XML Tree being directly used here while it shouldn't be. obj->getRepr()->setAttribute("font-family", os2.str().c_str()); } } @@ -854,7 +855,7 @@ void SvgFontsDialog::add_font(){ update_fonts(); // select_font(font); - SPDocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Add font")); + DocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Add font")); } SvgFontsDialog::SvgFontsDialog() @@ -925,4 +926,4 @@ SvgFontsDialog::~SvgFontsDialog(){} fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :