font-selector.cpp revision 435e5af0d53e9cafc1d383953e9d56a7a5a6f231
#define __SP_FONT_SELECTOR_C__
/*
* Font selection widgets
*
* Authors:
* Chris Lahey <clahey@ximian.com>
* Lauris Kaplinski <lauris@kaplinski.com>
* bulia byak <buliabyak@users.sf.net>
* Johan Engelen <j.b.c.engelen@ewi.utwente.nl>
*
* Copyright (C) 1999-2001 Ximian, Inc.
* Copyright (C) 2002 Lauris Kaplinski
* Copyright (C) -2007 Authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <libnrtype/font-instance.h>
#include <libnrtype/font-lister.h>
#include "desktop.h"
#include "widgets/font-selector.h"
/* SPFontSelector */
struct SPFontSelector
{
unsigned int block_emit : 1;
int familyidx;
int styleidx;
bool fontsize_dirty;
};
struct SPFontSelectorClass
{
};
enum {
};
static void sp_font_selector_class_init (SPFontSelectorClass *c);
namespace {
const char *sizes[] = {
"4", "6", "8", "9", "10", "11", "12", "13", "14",
"16", "18", "20", "22", "24", "28",
"32", "36", "40", "48", "56", "64", "72", "144",
};
}
{
if (!type) {
sizeof(SPFontSelectorClass),
0, // base_init
0, // base_finalize
0, // class_finalize
0, // class_data
sizeof(SPFontSelector),
0, // n_preallocs
0 // value_table
};
}
return type;
}
static void sp_font_selector_class_init(SPFontSelectorClass *c)
{
1, GTK_TYPE_POINTER);
}
{
/* Family frame */
gtk_widget_show (f);
gtk_tree_view_set_model (GTK_TREE_VIEW(fsel->family_treeview), GTK_TREE_MODEL (Glib::unwrap (store)));
g_signal_connect (G_OBJECT(selection), "changed", G_CALLBACK (sp_font_selector_family_select_row), fsel);
/* Style frame */
gtk_widget_show(f);
g_signal_connect (G_OBJECT(selection), "changed", G_CALLBACK (sp_font_selector_style_select_row), fsel);
g_signal_connect (G_OBJECT(fsel->size), "changed", G_CALLBACK (sp_font_selector_size_changed), fsel);
gtk_widget_show_all (l);
for (unsigned int n = 0; sizes[n]; ++n)
{
}
fsel->fontsize_dirty = false;
}
{
}
}
}
}
}
{
{
}
path = gtk_tree_path_new ();
gtk_tree_selection_select_path (gtk_tree_view_get_selection (GTK_TREE_VIEW (fsel->style_treeview)), path);
}
{
if (!fsel->block_emit)
{
}
}
{
if (text) {
value = -1;
}
if (value <= 0) {
return; // could not parse value
}
if (value > 10000)
{
fsel->fontsize_dirty = true;
}
}
{
//We need to check this here since most GtkTreeModel operations are not atomic
//See GtkListStore documenation, Chapter "Atomic Operations" --mderezynski
if (!model_family) return;
if (!model_style) return;
// FIXME: when a text object uses non-available font, font==NULL and we can't set size
// (and the size shown in the widget is invalid). To fix, here we must always get some
// default font, exactly the same as sptext uses for on-canvas display, so that
// font!=NULL ever.
if ( font ) {
}
}
}
fsel->fontsize_dirty = false;
if (font) {
}
}
{
}
{
if (font)
{
try {
} catch (...) {
return;
}
gtk_tree_selection_select_path (gtk_tree_view_get_selection (GTK_TREE_VIEW (fsel->family_treeview)), path.gobj());
gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (fsel->family_treeview), path.gobj(), NULL, TRUE, 0.5, 0.5);
unsigned int currentStyleNumber = 0;
unsigned int bestStyleNumber = 0;
if (tempFont) {
}
while (list) {
if (tempFont) {
}
if (currentMatchForFont) {
// Found a better match for the font we are looking for
}
}
}
if (bestMatchForFont)
if (incomingFont)
gtk_tree_selection_select_path (gtk_tree_view_get_selection (GTK_TREE_VIEW (fsel->style_treeview)), path_c);
{
gchar s[8];
}
}
}
{
}
}
{
}
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :