From: JucaBlues Date: Sat, 12 Jul 2008 10:41:34 +0000 (+0000) Subject: glyph-kerning setup user interface (not functional yet, just the gtk UI sketch) X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=d4c33c0ce4469babf6bd589aeeb7d0988f8daacc;p=inkscape.git glyph-kerning setup user interface (not functional yet, just the gtk UI sketch) --- diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp index 24bd7ae28..53fd8cd0f 100644 --- a/src/ui/dialog/svg-fonts-dialog.cpp +++ b/src/ui/dialog/svg-fonts-dialog.cpp @@ -53,6 +53,20 @@ namespace Dialog { /*** SvgFontsDialog ***/ +GlyphComboBox::GlyphComboBox(){ +} + +void GlyphComboBox::update(SPFont* spfont){ + if (spfont) { + for(SPObject* node = spfont->children; node; node=node->next){ + if (SP_IS_GLYPH(node)){ + g_warning("glyphCombo unicode='%s'", ((SPGlyph*)node)->unicode); + } + } + } +} + + /* Add all fonts in the document to the combobox. */ void SvgFontsDialog::update_fonts() { @@ -64,7 +78,7 @@ void SvgFontsDialog::update_fonts() for(const GSList *l = fonts; l; l = l->next) { Gtk::TreeModel::Row row = *_model->append(); SPFont* f = (SPFont*)l->data; - row[_columns.font] = f; + row[_columns.spfont] = f; row[_columns.svgfont] = new SvgFont(f); const gchar* lbl = f->label(); const gchar* id = SP_OBJECT_ID(f); @@ -79,6 +93,8 @@ void SvgFontsDialog::on_preview_text_changed(){ } void SvgFontsDialog::on_font_selection_changed(){ + first_glyph.update(this->get_selected_spfont()); + second_glyph.update(this->get_selected_spfont()); _font_da.set_svgfont(this->get_selected_svgfont()); _font_da.redraw(); } @@ -91,6 +107,14 @@ SvgFont* SvgFontsDialog::get_selected_svgfont() return NULL; } +SPFont* SvgFontsDialog::get_selected_spfont() +{ + Gtk::TreeModel::iterator i = _font_list.get_selection()->get_selected(); + if(i) + return (*i)[_columns.spfont]; + return NULL; +} + SvgFontsDialog::SvgFontsDialog() : UI::Widget::Panel("", "dialogs.svgfonts", SP_VERB_DIALOG_SVG_FONTS) { @@ -107,6 +131,19 @@ SvgFontsDialog::SvgFontsDialog() this->update_fonts(); +//kerning setup: + Gtk::VBox* kernvbox = Gtk::manage(new Gtk::VBox()); + _font_settings.add(*kernvbox); + kernvbox->add(*Gtk::manage(new Gtk::Label("Kerning Setup:"))); + Gtk::HBox* kerning_selector = Gtk::manage(new Gtk::HBox()); + kerning_selector->add(first_glyph); + kerning_selector->add(second_glyph); + + Gtk::SpinButton* kerning_spin = Gtk::manage(new Gtk::SpinButton()); + kernvbox->add(*kerning_selector); + kernvbox->add((Gtk::Widget&) kerning_preview); + kernvbox->add(*kerning_spin); + //Text Preview: _preview_entry.signal_changed().connect(sigc::mem_fun(*this, &SvgFontsDialog::on_preview_text_changed)); _getContents()->add(*Gtk::manage(new Gtk::Label("Preview Text:"))); diff --git a/src/ui/dialog/svg-fonts-dialog.h b/src/ui/dialog/svg-fonts-dialog.h index 789ccafcf..7efa380fb 100644 --- a/src/ui/dialog/svg-fonts-dialog.h +++ b/src/ui/dialog/svg-fonts-dialog.h @@ -45,6 +45,12 @@ namespace Inkscape { namespace UI { namespace Dialog { +class GlyphComboBox : public Gtk::Combo { +public: + GlyphComboBox(); + void update(SPFont*); +}; + class SvgFontsDialog : public UI::Widget::Panel { public: SvgFontsDialog(); @@ -55,6 +61,7 @@ public: void update_fonts(); SvgFont* get_selected_svgfont(); + SPFont* get_selected_spfont(); void on_font_selection_changed(); void on_preview_text_changed(); private: @@ -63,12 +70,12 @@ private: public: Columns() { - add(font); + add(spfont); add(svgfont); add(label); } - Gtk::TreeModelColumn font; + Gtk::TreeModelColumn spfont; Gtk::TreeModelColumn svgfont; Gtk::TreeModelColumn label; }; @@ -77,7 +84,8 @@ private: Gtk::TreeView _font_list; Gtk::VBox _font_settings; Gtk::Entry _preview_entry; - SvgFontDrawingArea _font_da; + SvgFontDrawingArea _font_da, kerning_preview; + GlyphComboBox first_glyph, second_glyph; class EntryWidget : public Gtk::HBox {