From: JucaBlues Date: Mon, 29 Dec 2008 13:12:07 +0000 (+0000) Subject: added a "remove" context menu option for removing kerning pairs X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=9eaf26d35152f36f4ac8b37e4d13e87b020dc01e;p=inkscape.git added a "remove" context menu option for removing kerning pairs --- diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp index e2a5c196a..a29a01510 100644 --- a/src/ui/dialog/svg-fonts-dialog.cpp +++ b/src/ui/dialog/svg-fonts-dialog.cpp @@ -184,6 +184,20 @@ void SvgFontsDialog::glyphs_list_button_release(GdkEventButton* event) } } +void SvgFontsDialog::kerning_pairs_list_button_release(GdkEventButton* event) +{ + if((event->type == GDK_BUTTON_RELEASE) && (event->button == 3)) { + _KerningPairsContextMenu.popup(event->button, event->time); + } +} + +void SvgFontsDialog::fonts_list_button_release(GdkEventButton* event) +{ + if((event->type == GDK_BUTTON_RELEASE) && (event->button == 3)) { + _FontsContextMenu.popup(event->button, event->time); + } +} + void SvgFontsDialog::create_glyphs_popup_menu(Gtk::Widget& parent, sigc::slot rem) { Gtk::MenuItem* mi = Gtk::manage(new Gtk::ImageMenuItem(Gtk::Stock::REMOVE)); @@ -193,12 +207,13 @@ void SvgFontsDialog::create_glyphs_popup_menu(Gtk::Widget& parent, sigc::slot rem) { - if((event->type == GDK_BUTTON_RELEASE) && (event->button == 3)) { - _FontsContextMenu.popup(event->button, event->time); - } + Gtk::MenuItem* mi = Gtk::manage(new Gtk::ImageMenuItem(Gtk::Stock::REMOVE)); + _KerningPairsContextMenu.append(*mi); + mi->signal_activate().connect(rem); + mi->show(); + _KerningPairsContextMenu.accelerate(parent); } void SvgFontsDialog::create_fonts_popup_menu(Gtk::Widget& parent, sigc::slot rem) @@ -547,6 +562,21 @@ void SvgFontsDialog::remove_selected_glyph(){ update_glyphs(); } +void SvgFontsDialog::remove_selected_kerning_pair(){ + if(!_KerningPairsList.get_selection()) return; + + Gtk::TreeModel::iterator i = _KerningPairsList.get_selection()->get_selected(); + if(!i) return; + + SPGlyphKerning* pair = (*i)[_KerningPairsListColumns.spnode]; + sp_repr_unparent(pair->repr); + + SPDocument* doc = sp_desktop_document(this->getDesktop()); + sp_document_done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Remove kerning pair")); + + update_glyphs(); +} + Gtk::VBox* SvgFontsDialog::glyphs_tab(){ _GlyphsList.signal_button_release_event().connect_notify(sigc::mem_fun(*this, &SvgFontsDialog::glyphs_list_button_release)); create_glyphs_popup_menu(_GlyphsList, sigc::mem_fun(*this, &SvgFontsDialog::remove_selected_glyph)); @@ -630,6 +660,9 @@ void SvgFontsDialog::add_kerning_pair(){ } Gtk::VBox* SvgFontsDialog::kerning_tab(){ + _KerningPairsList.signal_button_release_event().connect_notify(sigc::mem_fun(*this, &SvgFontsDialog::kerning_pairs_list_button_release)); + 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:")))); Gtk::HBox* kerning_selector = Gtk::manage(new Gtk::HBox()); diff --git a/src/ui/dialog/svg-fonts-dialog.h b/src/ui/dialog/svg-fonts-dialog.h index d1d6b440d..83851de91 100644 --- a/src/ui/dialog/svg-fonts-dialog.h +++ b/src/ui/dialog/svg-fonts-dialog.h @@ -104,6 +104,7 @@ private: void glyph_name_edit(const Glib::ustring&, const Glib::ustring&); void remove_selected_glyph(); void remove_selected_font(); + void remove_selected_kerning_pair(); void add_kerning_pair(); @@ -113,6 +114,9 @@ private: void create_fonts_popup_menu(Gtk::Widget& parent, sigc::slot rem); void fonts_list_button_release(GdkEventButton* event); + void create_kerning_pairs_popup_menu(Gtk::Widget& parent, sigc::slot rem); + void kerning_pairs_list_button_release(GdkEventButton* event); + Inkscape::XML::SignalObserver _defs_observer; //in order to update fonts Inkscape::XML::SignalObserver _glyphs_observer; @@ -195,6 +199,7 @@ private: Gtk::Menu _FontsContextMenu; Gtk::Menu _GlyphsContextMenu; + Gtk::Menu _KerningPairsContextMenu; SvgFontDrawingArea _font_da, kerning_preview; GlyphComboBox first_glyph, second_glyph;