summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3ccc61b)
raw | patch | inline | side by side (parent: 3ccc61b)
author | JucaBlues <JucaBlues@users.sourceforge.net> | |
Wed, 25 Jun 2008 16:18:02 +0000 (16:18 +0000) | ||
committer | JucaBlues <JucaBlues@users.sourceforge.net> | |
Wed, 25 Jun 2008 16:18:02 +0000 (16:18 +0000) |
index 05c9159a2a285e8583952ed7d79f72342a411ee4..1915bb6422194764a18091215508d16642f31a04 100644 (file)
<svg width="400px" height="300px" version="1.1"
xmlns = 'http://www.w3.org/2000/svg'>
- <font id="Font1" horiz-adv-x="1000">
+ <font id="FirstExample" horiz-adv-x="1000">
<font-face font-family="Super Sans" font-style="oblique" font-stretch="ultra-expanded" />
<glyph unicode="!" d="M0,0h500v500h-500z">
<circle r='500' cx='500' cy='500' style="fill:none;stroke:green;"/>
<hkern u1="!" u2="@" k="500" />
</font>
- <font id="Font2" horiz-adv-x="1100">
+ <font id="AnotherSVGFont" horiz-adv-x="1100">
<font-face font-family="Super Sans2" font-style="oblique" font-stretch="ultra-expanded" />
<glyph unicode="!" d="M0,0h500v500h-500v-300h100v200h300v-300h-400z" />
<glyph unicode="@!" d="M0,0h200L1000,800v200h-200L0,200z" />
diff --git a/src/sp-font.cpp b/src/sp-font.cpp
index 9ba4730be10ebbf3d88f6e8238734e6defab7090..8667af4cb264dcdf8e08503938355f6390d9bf0c 100644 (file)
--- a/src/sp-font.cpp
+++ b/src/sp-font.cpp
@@ -105,6 +105,8 @@ static void sp_font_build(SPObject *object, SPDocument *document, Inkscape::XML:
sp_object_read_attr(object, "vert-adv-y");
SvgFont* svgfont = new SvgFont(SP_FONT(object));
+
+ sp_document_add_resource(document, "font", object);
}
index f6d357a0e1c7dc1a7026c61d3d8996677802b815..284003c927a2ebbacdfa88a6bcdd9ca2480d93a3 100644 (file)
/*** SvgFontsDialog ***/
+/* Add all fonts in the document to the combobox. */
+void SvgFontsDialog::update_fonts()
+{
+g_warning("update_fonts");
+ SPDesktop* desktop = this->getDesktop();
+ SPDocument* document = sp_desktop_document(desktop);
+ const GSList* fonts = sp_document_get_resource_list(document, "font");
+
+ _model->clear();
+g_warning("after _model->clear()");
+ for(const GSList *l = fonts; l; l = l->next) {
+ Gtk::TreeModel::Row row = *_model->append();
+ SPFont* f = (SPFont*)l->data;
+ row[_columns.font] = f;
+ const gchar* lbl = f->label();
+g_warning("label: %s", lbl);
+ const gchar* id = SP_OBJECT_ID(f);
+ row[_columns.label] = lbl ? lbl : (id ? id : "font");
+ }
+
+// update_selection(desktop->selection);
+// _dialog.update_filter_general_settings_view();
+}
+
SvgFontsDialog::SvgFontsDialog()
: UI::Widget::Panel("", "dialogs.svgfonts", SP_VERB_DIALOG_SVG_FONTS)
{
- Gtk::Label* label = Gtk::manage(new Gtk::Label("Here we will have settings for the SVGFonts used in the document."));
- _getContents()->add(*label);
+ //Gtk::Label* label = Gtk::manage(new Gtk::Label("Here we will have settings for the SVGFonts used in the document."));
+ _getContents()->add(_list);
+g_warning("a");
+ _model = Gtk::ListStore::create(_columns);
+g_warning("b");
+ _list.set_model(_model);
+ _list.append_column_editable("_Font", _columns.label);
+g_warning("c");
+ this->update_fonts();
+g_warning("d");
}
SvgFontsDialog::~SvgFontsDialog(){}
index c2cd7a803da326cf31d7476ba99971b717fa35b7..d12e9481c187076f0dc76bce8102561ecce87d17 100644 (file)
#include "ui/widget/panel.h"
#include "sp-font.h"
#include "verbs.h"
+#include "document.h"
+#include "desktop.h"
+#include "desktop-handles.h"
+
+#include <gtkmm/liststore.h>
+#include <gtkmm/treeview.h>
using namespace Inkscape::UI::Widget;
static SvgFontsDialog &getInstance()
{ return *new SvgFontsDialog(); }
+
+ void update_fonts();
+
+private:
+ class Columns : public Gtk::TreeModel::ColumnRecord
+ {
+ public:
+ Columns()
+ {
+ add(font);
+ add(label);
+ //add(sel);
+ }
+
+ Gtk::TreeModelColumn<SPFont*> font;
+ Gtk::TreeModelColumn<Glib::ustring> label;
+ //Gtk::TreeModelColumn<int> sel;
+ };
+ Glib::RefPtr<Gtk::ListStore> _model;
+ Columns _columns;
+ Gtk::TreeView _list;
};
} // namespace Dialog