9eab3b2f83f922c87765220dd2bc001600108896
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();
74 void add_font();
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::Button _add;
111 Gtk::TreeView _font_list;
112 Gtk::VBox _font_settings;
113 Gtk::Entry _preview_entry;
114 SvgFontDrawingArea _font_da, kerning_preview;
115 GlyphComboBox first_glyph, second_glyph;
116 SPGlyphKerning* kerning_pair;
117 Gtk::SpinButton kerning_spin, setwidth_spin;
119 class EntryWidget : public Gtk::HBox
120 {
121 public:
122 EntryWidget()
123 {
124 this->add(this->_label);
125 this->add(this->_entry);
126 }
127 void set_label(const gchar* l){
128 this->_label.set_text(l);
129 }
130 private:
131 Gtk::Label _label;
132 Gtk::Entry _entry;
133 };
134 EntryWidget _font_family, _font_variant;
135 };
137 } // namespace Dialog
138 } // namespace UI
139 } // namespace Inkscape
141 #endif //#ifndef INKSCAPE_UI_DIALOG_SVG_FONTS_H