diff options
| author | Felipe Corr??a da Silva Sanches <juca@members.fsf.org> | 2008-07-12 10:41:34 +0000 |
|---|---|---|
| committer | JucaBlues <JucaBlues@users.sourceforge.net> | 2008-07-12 10:41:34 +0000 |
| commit | a9ee6b7ef2eeffa3eb907bc9fdc8c5b772d21b9b (patch) | |
| tree | 8f96ff1985059eabbd2e1f3c19b5f46dd4abc1a3 /src | |
| parent | added comments to the SVGFonts example (diff) | |
| download | inkscape-a9ee6b7ef2eeffa3eb907bc9fdc8c5b772d21b9b.tar.gz inkscape-a9ee6b7ef2eeffa3eb907bc9fdc8c5b772d21b9b.zip | |
glyph-kerning setup user interface (not functional yet, just the gtk UI sketch)
(bzr r6267)
Diffstat (limited to 'src')
| -rw-r--r-- | src/ui/dialog/svg-fonts-dialog.cpp | 39 | ||||
| -rw-r--r-- | src/ui/dialog/svg-fonts-dialog.h | 14 |
2 files changed, 49 insertions, 4 deletions
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<SPFont*> font; + Gtk::TreeModelColumn<SPFont*> spfont; Gtk::TreeModelColumn<SvgFont*> svgfont; Gtk::TreeModelColumn<Glib::ustring> 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 { |
