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 "sp-font-face.h"
18 #include "verbs.h"
19 #include "document.h"
20 #include "desktop.h"
21 #include "desktop-handles.h"
23 #include <gtkmm.h>
24 #include <gtkmm/liststore.h>
25 #include <gtkmm/treeview.h>
26 #include <gtkmm/entry.h>
27 #include <gtkmm/box.h>
29 #include "display/nr-svgfonts.h"
30 #include "attributes.h"
33 class SvgFontDrawingArea : Gtk::DrawingArea{
34 public:
35 SvgFontDrawingArea();
36 void set_text(Glib::ustring);
37 void set_svgfont(SvgFont*);
38 void set_size(int x, int y);
39 void redraw();
40 private:
41 int x,y;
42 SvgFont* svgfont;
43 Glib::ustring text;
44 bool on_expose_event (GdkEventExpose *event);
45 };
47 struct SPFont;
49 namespace Inkscape {
50 namespace UI {
51 namespace Dialog {
53 class GlyphComboBox : public Gtk::ComboBoxText {
54 public:
55 GlyphComboBox();
56 void update(SPFont*);
57 };
59 class SvgFontsDialog : public UI::Widget::Panel {
60 public:
61 SvgFontsDialog();
62 ~SvgFontsDialog();
64 static SvgFontsDialog &getInstance()
65 { return *new SvgFontsDialog(); }
67 void update_fonts();
68 SvgFont* get_selected_svgfont();
69 SPFont* get_selected_spfont();
70 void on_font_selection_changed();
71 void on_preview_text_changed();
72 void on_glyphs_changed();
73 void on_kerning_changed();
74 void on_setwidth_changed();
76 class AttrEntry : public Gtk::HBox
77 {
78 public:
79 AttrEntry(SvgFontsDialog* d, gchar* lbl, const SPAttributeEnum attr);
80 private:
81 SvgFontsDialog* dialog;
82 void on_attr_changed();
83 Gtk::Entry entry;
84 SPAttributeEnum attr;
85 };
87 private:
88 Gtk::HBox* AttrCombo(gchar* lbl, const SPAttributeEnum attr);
89 // Gtk::HBox* AttrSpin(gchar* lbl, const SPAttributeEnum attr);
90 Gtk::VBox* global_settings_tab();
91 Gtk::VBox* kerning_tab();
92 Gtk::VBox* glyphs_tab();
94 class Columns : public Gtk::TreeModel::ColumnRecord
95 {
96 public:
97 Columns()
98 {
99 add(spfont);
100 add(svgfont);
101 add(label);
102 }
104 Gtk::TreeModelColumn<SPFont*> spfont;
105 Gtk::TreeModelColumn<SvgFont*> svgfont;
106 Gtk::TreeModelColumn<Glib::ustring> label;
107 };
108 Glib::RefPtr<Gtk::ListStore> _model;
109 Columns _columns;
110 Gtk::TreeView _font_list;
111 Gtk::VBox _font_settings;
112 Gtk::Entry _preview_entry;
113 SvgFontDrawingArea _font_da, kerning_preview;
114 GlyphComboBox first_glyph, second_glyph;
115 SPGlyphKerning* kerning_pair;
116 Gtk::SpinButton kerning_spin, setwidth_spin;
118 class EntryWidget : public Gtk::HBox
119 {
120 public:
121 EntryWidget()
122 {
123 this->add(this->_label);
124 this->add(this->_entry);
125 }
126 void set_label(const gchar* l){
127 this->_label.set_text(l);
128 }
129 private:
130 Gtk::Label _label;
131 Gtk::Entry _entry;
132 };
133 EntryWidget _font_family, _font_variant;
134 };
136 } // namespace Dialog
137 } // namespace UI
138 } // namespace Inkscape
140 #endif //#ifndef INKSCAPE_UI_DIALOG_SVG_FONTS_H