summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFelipe Corr??a da Silva Sanches <juca@members.fsf.org>2008-06-25 16:18:02 +0000
committerJucaBlues <JucaBlues@users.sourceforge.net>2008-06-25 16:18:02 +0000
commitd7221942795e4bf740efb6851af320cf50bf0f96 (patch)
tree5b86940e8f05cc5462d1e9aff47bf3e3f3b8d4c3 /src
parentwarning cleanup (diff)
downloadinkscape-d7221942795e4bf740efb6851af320cf50bf0f96.tar.gz
inkscape-d7221942795e4bf740efb6851af320cf50bf0f96.zip
adding list of available SVGFonts to the SVGFonts dialog
(bzr r6059)
Diffstat (limited to 'src')
-rw-r--r--src/sp-font.cpp2
-rw-r--r--src/ui/dialog/svg-fonts-dialog.cpp36
-rw-r--r--src/ui/dialog/svg-fonts-dialog.h27
3 files changed, 63 insertions, 2 deletions
diff --git a/src/sp-font.cpp b/src/sp-font.cpp
index 9ba4730be..8667af4cb 100644
--- 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);
}
diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp
index f6d357a0e..284003c92 100644
--- a/src/ui/dialog/svg-fonts-dialog.cpp
+++ b/src/ui/dialog/svg-fonts-dialog.cpp
@@ -23,11 +23,43 @@ namespace Dialog {
/*** 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(){}
diff --git a/src/ui/dialog/svg-fonts-dialog.h b/src/ui/dialog/svg-fonts-dialog.h
index c2cd7a803..d12e9481c 100644
--- a/src/ui/dialog/svg-fonts-dialog.h
+++ b/src/ui/dialog/svg-fonts-dialog.h
@@ -15,6 +15,12 @@
#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;
@@ -29,6 +35,27 @@ public:
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