f7d13a71498ffad0661abc0b3321dd6ec4fd978d
1 /** @file
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 * Released under GNU GPLv2 (or later). Read the file 'COPYING' for more information.
9 */
11 #ifndef INKSCAPE_UI_DIALOG_SVG_FONTS_H
12 #define INKSCAPE_UI_DIALOG_SVG_FONTS_H
14 #include "ui/widget/panel.h"
15 #include "sp-font.h"
16 #include "sp-font-face.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"
29 #include "attributes.h"
32 class SvgFontDrawingArea : Gtk::DrawingArea{
33 public:
34 SvgFontDrawingArea();
35 void set_text(Glib::ustring);
36 void set_svgfont(SvgFont*);
37 void set_size(int x, int y);
38 void redraw();
39 private:
40 int x,y;
41 SvgFont* svgfont;
42 Glib::ustring text;
43 bool on_expose_event (GdkEventExpose *event);
44 };
46 struct SPFont;
48 namespace Inkscape {
49 namespace UI {
50 namespace Dialog {
52 class GlyphComboBox : public Gtk::ComboBoxText {
53 public:
54 GlyphComboBox();
55 void update(SPFont*);
56 };
58 class SvgFontsDialog : public UI::Widget::Panel {
59 public:
60 SvgFontsDialog();
61 ~SvgFontsDialog();
63 static SvgFontsDialog &getInstance()
64 { return *new SvgFontsDialog(); }
66 void update_fonts();
67 SvgFont* get_selected_svgfont();
68 SPFont* get_selected_spfont();
69 void on_font_selection_changed();
70 void on_preview_text_changed();
71 void on_glyphs_changed();
72 void on_kerning_changed();
73 void on_setwidth_changed();
75 class AttrEntry : public Gtk::HBox
76 {
77 public:
78 AttrEntry(SvgFontsDialog* d, gchar* lbl, const SPAttributeEnum attr);
79 private:
80 SvgFontsDialog* dialog;
81 void on_attr_changed();
82 Gtk::Entry entry;
83 SPAttributeEnum attr;
84 };
86 private:
87 Gtk::HBox* AttrCombo(gchar* lbl, const SPAttributeEnum attr);
88 // Gtk::HBox* AttrSpin(gchar* lbl, const SPAttributeEnum attr);
89 Gtk::VBox* global_settings_tab();
90 Gtk::VBox* kerning_tab();
91 Gtk::VBox* glyphs_tab();
93 class Columns : public Gtk::TreeModel::ColumnRecord
94 {
95 public:
96 Columns()
97 {
98 add(spfont);
99 add(svgfont);
100 add(label);
101 }
103 Gtk::TreeModelColumn<SPFont*> spfont;
104 Gtk::TreeModelColumn<SvgFont*> svgfont;
105 Gtk::TreeModelColumn<Glib::ustring> label;
106 };
107 Glib::RefPtr<Gtk::ListStore> _model;
108 Columns _columns;
109 Gtk::TreeView _font_list;
110 Gtk::VBox _font_settings;
111 Gtk::Entry _preview_entry;
112 SvgFontDrawingArea _font_da, kerning_preview;
113 GlyphComboBox first_glyph, second_glyph;
114 SPGlyphKerning* kerning_pair;
115 Gtk::SpinButton kerning_spin, setwidth_spin;
117 class EntryWidget : public Gtk::HBox
118 {
119 public:
120 EntryWidget()
121 {
122 this->add(this->_label);
123 this->add(this->_entry);
124 }
125 void set_label(const gchar* l){
126 this->_label.set_text(l);
127 }
128 private:
129 Gtk::Label _label;
130 Gtk::Entry _entry;
131 };
132 EntryWidget _font_family, _font_variant;
133 };
135 } // namespace Dialog
136 } // namespace UI
137 } // namespace Inkscape
139 #endif //#ifndef INKSCAPE_UI_DIALOG_SVG_FONTS_H