Commit bc9676e4 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

app/text/Makefile.am app/text/text-types.h new GimpList subclass.

2003-03-25  Michael Natterer  <mitch@gimp.org>

	* app/text/Makefile.am
	* app/text/text-types.h
	* app/text/gimpfontlist.[ch]: new GimpList subclass. Unused...

	* app/text/gimpfont.[ch]: added gimp_font_get_standard().
parent 8ed375a4
2003-03-25 Michael Natterer <mitch@gimp.org>
* app/text/Makefile.am
* app/text/text-types.h
* app/text/gimpfontlist.[ch]: new GimpList subclass. Unused...
* app/text/gimpfont.[ch]: added gimp_font_get_standard().
2003-03-25 Michael Natterer <mitch@gimp.org>
 
* app/tools/tool_manager.c: added GIMP_CONTEXT_PATTERN_MASK to the
......@@ -19,6 +19,8 @@ libapptext_a_sources = \
text-enums.h \
gimpfont.c \
gimpfont.h \
gimpfontlist.c \
gimpfontlist.h \
gimptext.c \
gimptext.h \
gimptext-compat.c \
......
......@@ -109,3 +109,16 @@ gimp_font_get_memsize (GimpObject *object)
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object);
}
GimpFont *
gimp_font_get_standard (void)
{
static GimpFont *standard_font = NULL;
if (! standard_font)
standard_font = g_object_new (GIMP_TYPE_FONT,
"name", "Sans",
NULL);
return standard_font;
}
......@@ -48,7 +48,9 @@ struct _GimpFontClass
};
GType gimp_font_get_type (void) G_GNUC_CONST;
GType gimp_font_get_type (void) G_GNUC_CONST;
GimpFont * gimp_font_get_standard (void);
#endif /* __GIMP_FONT_H__ */
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimpfontlist.c
* Copyright (C) 2003 Michael Natterer <mitch@gimp.org>
* Sven Neumann <sven@gimp.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <string.h>
#include <glib-object.h>
#include "text-types.h"
#include "gimpfont.h"
#include "gimpfontlist.h"
#include "gimp-intl.h"
static void gimp_font_list_class_init (GimpFontListClass *klass);
static void gimp_font_list_init (GimpFontList *list);
static void gimp_font_list_add (GimpContainer *container,
GimpObject *object);
static gint gimp_font_list_font_compare_func (gconstpointer first,
gconstpointer second);
static GimpListClass *parent_class = NULL;
GType
gimp_font_list_get_type (void)
{
static GType list_type = 0;
if (! list_type)
{
static const GTypeInfo list_info =
{
sizeof (GimpFontListClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_font_list_class_init,
NULL, /* class_finalize */
NULL, /* class_font */
sizeof (GimpFontList),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_font_list_init,
};
list_type = g_type_register_static (GIMP_TYPE_LIST,
"GimpFontList",
&list_info, 0);
}
return list_type;
}
static void
gimp_font_list_class_init (GimpFontListClass *klass)
{
GimpContainerClass *container_class;
container_class = GIMP_CONTAINER_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
container_class->add = gimp_font_list_add;
}
static void
gimp_font_list_init (GimpFontList *list)
{
}
static void
gimp_font_list_add (GimpContainer *container,
GimpObject *object)
{
GimpList *list;
list = GIMP_LIST (container);
list->list = g_list_insert_sorted (list->list, object,
gimp_font_list_font_compare_func);
}
GimpContainer *
gimp_font_list_new (void)
{
GimpFontList *list;
list = g_object_new (GIMP_TYPE_FONT_LIST,
"children_type", GIMP_TYPE_FONT,
"policy", GIMP_CONTAINER_POLICY_STRONG,
NULL);
return GIMP_CONTAINER (list);
}
static gint
gimp_font_list_font_compare_func (gconstpointer first,
gconstpointer second)
{
return strcmp (((const GimpObject *) first)->name,
((const GimpObject *) second)->name);
}
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimpfontlist.h
* Copyright (C) 2003 Michael Natterer <mitch@gimp.org>
* Sven Neumann <sven@gimp.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __GIMP_FONT_LIST_H__
#define __GIMP_FONT_LIST_H__
#include "core/gimplist.h"
#define GIMP_TYPE_FONT_LIST (gimp_font_list_get_type ())
#define GIMP_FONT_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_FONT_LIST, GimpFontList))
#define GIMP_FONT_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_FONT_LIST, GimpFontListClass))
#define GIMP_IS_FONT_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_FONT_LIST))
#define GIMP_IS_FONT_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_FONT_LIST))
#define GIMP_FONT_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_FONT_LIST, GimpFontListClass))
typedef struct _GimpFontListClass GimpFontListClass;
struct _GimpFontList
{
GimpList parent_instance;
};
struct _GimpFontListClass
{
GimpListClass parent_class;
};
GType gimp_font_list_get_type (void) G_GNUC_CONST;
GimpContainer * gimp_font_list_new (void);
#endif /* __GIMP_FONT_LIST_H__ */
......@@ -27,10 +27,11 @@
#include "text/text-enums.h"
typedef struct _GimpFont GimpFont;
typedef struct _GimpText GimpText;
typedef struct _GimpTextLayer GimpTextLayer;
typedef struct _GimpTextLayout GimpTextLayout;
typedef struct _GimpFont GimpFont;
typedef struct _GimpFontList GimpFontList;
typedef struct _GimpText GimpText;
typedef struct _GimpTextLayer GimpTextLayer;
typedef struct _GimpTextLayout GimpTextLayout;
#endif /* __TEXT_TYPES_H__ */
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment