1 /**
2 * \brief SVG Fonts dialog
3 *
4 * Authors:
5 * Felipe CorrĂȘa da Silva Sanches <felipe.sanches@gmail.com>
6 *
7 * Copyright (C) 2008 Authors
8 *
9 * Released under GNU GPLv2 (or later). Read the file 'COPYING' for more information.
10 */
12 #ifndef INKSCAPE_UI_DIALOG_SVG_FONTS_H
13 #define INKSCAPE_UI_DIALOG_SVG_FONTS_H
15 #include "ui/widget/panel.h"
16 #include "sp-font.h"
17 #include "verbs.h"
18 #include "document.h"
19 #include "desktop.h"
20 #include "desktop-handles.h"
22 #include <gtkmm.h>
23 #include <gtkmm/liststore.h>
24 #include <gtkmm/treeview.h>
25 #include <gtkmm/entry.h>
26 #include <gtkmm/box.h>
28 #include "display/nr-svgfonts.h"
30 class SvgFontDrawingArea : Gtk::DrawingArea{
31 public:
32 SvgFontDrawingArea();
33 void set_text(Glib::ustring);
34 void set_svgfont(SvgFont*);
35 void set_size(int x, int y);
36 void redraw();
37 private:
38 int x,y;
39 SvgFont* svgfont;
40 Glib::ustring text;
41 bool on_expose_event (GdkEventExpose *event);
42 };
44 struct SPFont;
46 namespace Inkscape {
47 namespace UI {
48 namespace Dialog {
50 class GlyphComboBox : public Gtk::ComboBoxText {
51 public:
52 GlyphComboBox();
53 void update(SPFont*);
54 };
56 class SvgFontsDialog : public UI::Widget::Panel {
57 public:
58 SvgFontsDialog();
59 ~SvgFontsDialog();
61 static SvgFontsDialog &getInstance()
62 { return *new SvgFontsDialog(); }
64 void update_fonts();
65 SvgFont* get_selected_svgfont();
66 SPFont* get_selected_spfont();
67 void on_font_selection_changed();
68 void on_preview_text_changed();
69 void on_glyphs_changed();
70 void on_kerning_changed();
71 void on_setwidth_changed();
73 private:
74 Gtk::VBox* global_settings_tab();
75 Gtk::VBox* kerning_tab();
76 Gtk::VBox* glyphs_tab();
78 class Columns : public Gtk::TreeModel::ColumnRecord
79 {
80 public:
81 Columns()
82 {
83 add(spfont);
84 add(svgfont);
85 add(label);
86 }
88 Gtk::TreeModelColumn<SPFont*> spfont;
89 Gtk::TreeModelColumn<SvgFont*> svgfont;
90 Gtk::TreeModelColumn<Glib::ustring> label;
91 };
92 Glib::RefPtr<Gtk::ListStore> _model;
93 Columns _columns;
94 Gtk::TreeView _font_list;
95 Gtk::VBox _font_settings;
96 Gtk::Entry _preview_entry;
97 SvgFontDrawingArea _font_da, kerning_preview;
98 GlyphComboBox first_glyph, second_glyph;
99 SPGlyphKerning* kerning_pair;
100 Gtk::SpinButton kerning_spin, setwidth_spin;
102 class EntryWidget : public Gtk::HBox
103 {
104 public:
105 EntryWidget()
106 {
107 this->add(this->_label);
108 this->add(this->_entry);
109 }
110 void set_label(const gchar* l){
111 this->_label.set_text(l);
112 }
113 private:
114 Gtk::Label _label;
115 Gtk::Entry _entry;
116 };
117 EntryWidget _font_family, _font_variant;
118 };
120 } // namespace Dialog
121 } // namespace UI
122 } // namespace Inkscape
124 #endif //#ifndef INKSCAPE_UI_DIALOG_SVG_FONTS_H