Commit 57a23b7b authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

allow NULL as context parameter in gimp_font_selection_new(). The widget

2003-01-31  Sven Neumann  <sven@gimp.org>

	* app/widgets/gimpfontselection.c: allow NULL as context parameter
	in gimp_font_selection_new(). The widget then uses a default
	PangoFT2Context.

	* app/tools/gimptexttool.c (text_tool_options_new): call
	gimp_font_selection_new() with a NULL context. The text tool now
	doesn't know about Pango any longer.

	* app/paint/Makefile.am
	* app/tools/Makefile.am (INCLUDES): removed PANGOFT2_CFLAGS.
parent 8ed5a720
2003-01-31 Sven Neumann <sven@gimp.org>
* app/widgets/gimpfontselection.c: allow NULL as context parameter
in gimp_font_selection_new(). The widget then uses a default
PangoFT2Context.
* app/tools/gimptexttool.c (text_tool_options_new): call
gimp_font_selection_new() with a NULL context. The text tool now
doesn't know about Pango any longer.
* app/paint/Makefile.am
* app/tools/Makefile.am (INCLUDES): removed PANGOFT2_CFLAGS.
2003-01-31 Sven Neumann <sven@gimp.org>
* app/core/core-enums.[ch]: added new enum GimpGravityType.
......
......@@ -43,7 +43,6 @@ INCLUDES = \
-I$(top_builddir)/app \
-I$(top_srcdir)/app \
$(GTK_CFLAGS) \
$(PANGOFT2_CFLAGS) \
-I$(includedir)
#
......
......@@ -128,5 +128,4 @@ INCLUDES = \
-I$(top_builddir)/app \
-I$(top_srcdir)/app \
$(GTK_CFLAGS) \
$(PANGOFT2_CFLAGS) \
-I$(includedir)
......@@ -24,19 +24,15 @@
#include <errno.h>
#include <gtk/gtk.h>
#include <pango/pangoft2.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "tools-types.h"
#include "config/gimpdisplayconfig.h"
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "core/gimpimage-mask.h"
#include "core/gimplayer.h"
#include "core/gimplayer-floating-sel.h"
#include "core/gimptoolinfo.h"
......@@ -392,13 +388,11 @@ text_tool_render (GimpTextTool *text_tool)
static GimpToolOptions *
text_tool_options_new (GimpToolInfo *tool_info)
{
GimpDisplayConfig *config;
TextOptions *options;
PangoContext *pango_context;
GtkWidget *vbox;
GtkWidget *table;
GtkWidget *size_spinbutton;
GtkWidget *spin_button;
TextOptions *options;
GtkWidget *vbox;
GtkWidget *table;
GtkWidget *size_spinbutton;
GtkWidget *spin_button;
options = g_new0 (TextOptions, 1);
......@@ -422,14 +416,7 @@ text_tool_options_new (GimpToolInfo *tool_info)
gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (table), FALSE, FALSE, 0);
gtk_widget_show (table);
config = GIMP_DISPLAY_CONFIG (tool_info->gimp->config);
pango_context = pango_ft2_get_context (config->monitor_xres,
config->monitor_yres);
options->font_selection = gimp_font_selection_new (pango_context);
g_object_unref (pango_context);
options->font_selection = gimp_font_selection_new (NULL);
gimp_font_selection_set_fontname
(GIMP_FONT_SELECTION (options->font_selection), DEFAULT_FONT);
......
......@@ -28,6 +28,7 @@
#include <string.h>
#include <gtk/gtk.h>
#include <pango/pangoft2.h>
#include "widgets-types.h"
......@@ -57,6 +58,9 @@ static gboolean gimp_font_selection_entry_focus_out (GtkWidget *widget,
GdkEvent *event,
gpointer data);
static PangoContext * gimp_font_selection_get_default_context (void);
enum
{
FONT_CHANGED,
......@@ -66,7 +70,8 @@ enum
static guint gimp_font_selection_signals[LAST_SIGNAL] = { 0 };
static GtkHBoxClass *parent_class = NULL;
static GtkHBoxClass *parent_class = NULL;
static PangoContext *default_context = NULL;
GType
......@@ -188,7 +193,8 @@ gimp_font_selection_finalize (GObject *object)
/**
* gimp_font_selection_new:
* @context: the #PangoContext to select a font from.
* @context: the #PangoContext to select a font from or %NULL to use a
* default context.
*
* Creates a new #GimpFontSelection widget.
*
......@@ -199,10 +205,13 @@ gimp_font_selection_new (PangoContext *context)
{
GimpFontSelection *fontsel;
g_return_val_if_fail (PANGO_IS_CONTEXT (context), NULL);
g_return_val_if_fail (context == NULL || PANGO_IS_CONTEXT (context), NULL);
fontsel = g_object_new (GIMP_TYPE_FONT_SELECTION, NULL);
if (!context)
context = gimp_font_selection_get_default_context ();
fontsel->context = context;
g_object_ref (fontsel->context);
......@@ -382,3 +391,17 @@ gimp_font_selection_entry_focus_out (GtkWidget *widget,
return FALSE;
}
static PangoContext *
gimp_font_selection_get_default_context (void)
{
if (default_context)
return default_context;
default_context = pango_ft2_get_context (72.0, 72.0);
g_object_add_weak_pointer (G_OBJECT (default_context),
(gpointer *) &default_context);
return default_context;
}
Markdown is supported
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