mirror of https://github.com/GNOME/gimp.git
changed the text used in the preview.
2003-02-03 Sven Neumann <sven@gimp.org> * app/widgets/gimpfontselection-dialog.c: changed the text used in the preview. * app/widgets/gimpfontselection.[ch]: removed the yes/no image that used to signal a valid font but stopped working a long time ago. * app/widgets/gimppropwidgets.c: added a property widget for fonts. * app/tools/gimptexttool.c: use the new prop_widget.
This commit is contained in:
parent
3a105c809b
commit
4fb5ca6a87
13
ChangeLog
13
ChangeLog
|
@ -1,3 +1,16 @@
|
|||
2003-02-03 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/widgets/gimpfontselection-dialog.c: changed the text used in
|
||||
the preview.
|
||||
|
||||
* app/widgets/gimpfontselection.[ch]: removed the yes/no image
|
||||
that used to signal a valid font but stopped working a long time
|
||||
ago.
|
||||
|
||||
* app/widgets/gimppropwidgets.c: added a property widget for fonts.
|
||||
|
||||
* app/tools/gimptexttool.c: use the new prop_widget.
|
||||
|
||||
2003-02-03 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/display/gimpdisplayshell-callbacks.c: fixed the "TAB toggles
|
||||
|
|
|
@ -394,13 +394,10 @@ text_tool_options_new (GimpToolInfo *tool_info)
|
|||
gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (table), FALSE, FALSE, 0);
|
||||
gtk_widget_show (table);
|
||||
|
||||
font_selection = gimp_font_selection_new (NULL);
|
||||
gimp_font_selection_set_fontname (GIMP_FONT_SELECTION (font_selection),
|
||||
options->text->font);
|
||||
font_selection = gimp_prop_font_selection_new (text, "font");
|
||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
|
||||
_("Font:"), 1.0, 0.5,
|
||||
font_selection, 2, FALSE);
|
||||
gtk_widget_set_sensitive (font_selection, FALSE);
|
||||
|
||||
gimp_prop_scale_entry_new (text, "font-size",
|
||||
GTK_TABLE (table), 0, 1,
|
||||
|
|
|
@ -41,16 +41,20 @@
|
|||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
#define FONT_SIZE 18
|
||||
|
||||
#define FONT_LIST_HEIGHT 136
|
||||
#define FONT_LIST_WIDTH 190
|
||||
#define FONT_STYLE_LIST_WIDTH 170
|
||||
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
FAMILY_COLUMN,
|
||||
FAMILY_NAME_COLUMN
|
||||
};
|
||||
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
FACE_COLUMN,
|
||||
FACE_NAME_COLUMN
|
||||
};
|
||||
|
@ -262,7 +266,9 @@ gimp_font_selection_dialog_new (GimpFontSelection *fontsel)
|
|||
|
||||
dialog->layout = pango_layout_new (fontsel->context);
|
||||
pango_layout_set_text (dialog->layout,
|
||||
"my mind is going ...", -1);
|
||||
/* This is a so-called pangram; it's supposed to
|
||||
contain all characters found in the alphabet. */
|
||||
_("Pack my box with five dozen liquor jugs."), -1);
|
||||
|
||||
gimp_font_selection_dialog_set_font_desc (dialog, fontsel->font_desc);
|
||||
|
||||
|
@ -494,7 +500,7 @@ gimp_font_selection_dialog_show_available_fonts (GimpFontSelectionDialog *dialog
|
|||
if (dialog->family)
|
||||
current_name = pango_font_family_get_name (dialog->family);
|
||||
else
|
||||
current_name = "sans";
|
||||
current_name = "Sans";
|
||||
|
||||
for (i = 0; i < n_families; i++)
|
||||
{
|
||||
|
@ -632,7 +638,7 @@ gimp_font_selection_dialog_preview (GimpFontSelectionDialog *dialog)
|
|||
PangoFontDescription *font_desc;
|
||||
|
||||
font_desc = pango_font_face_describe (dialog->face);
|
||||
pango_font_description_set_size (font_desc, PANGO_SCALE * 24);
|
||||
pango_font_description_set_size (font_desc, PANGO_SCALE * FONT_SIZE);
|
||||
pango_layout_set_font_description (dialog->layout, font_desc);
|
||||
pango_font_description_free (font_desc);
|
||||
|
||||
|
|
|
@ -147,10 +147,6 @@ gimp_font_selection_init (GimpFontSelection *fontsel)
|
|||
|
||||
fontsel->context = NULL;
|
||||
|
||||
fontsel->valid = gtk_image_new_from_stock (GTK_STOCK_NO, GTK_ICON_SIZE_MENU);
|
||||
gtk_box_pack_start (GTK_BOX (fontsel), fontsel->valid, FALSE, FALSE, 0);
|
||||
gtk_widget_show (fontsel->valid);
|
||||
|
||||
fontsel->entry = gtk_entry_new ();
|
||||
gtk_entry_set_width_chars (GTK_ENTRY (fontsel->entry), 8);
|
||||
gtk_box_pack_start (GTK_BOX (fontsel), fontsel->entry, TRUE, TRUE, 0);
|
||||
|
@ -235,21 +231,14 @@ gimp_font_selection_real_activate (GimpFontSelection *fontsel)
|
|||
static void
|
||||
gimp_font_selection_real_font_changed (GimpFontSelection *fontsel)
|
||||
{
|
||||
gchar *name;
|
||||
|
||||
if (fontsel->font_desc)
|
||||
{
|
||||
gtk_image_set_from_stock (GTK_IMAGE (fontsel->valid),
|
||||
GTK_STOCK_YES, GTK_ICON_SIZE_BUTTON);
|
||||
name = pango_font_description_to_string (fontsel->font_desc);
|
||||
gchar *name = pango_font_description_to_string (fontsel->font_desc);
|
||||
|
||||
gtk_entry_set_text (GTK_ENTRY (fontsel->entry), name);
|
||||
|
||||
g_free (name);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_image_set_from_stock (GTK_IMAGE (fontsel->valid),
|
||||
GTK_STOCK_NO, GTK_ICON_SIZE_BUTTON);
|
||||
}
|
||||
|
||||
if (fontsel->dialog)
|
||||
gimp_font_selection_dialog_set_font_desc (fontsel->dialog,
|
||||
|
@ -261,51 +250,35 @@ gimp_font_selection_real_font_changed (GimpFontSelection *fontsel)
|
|||
* @fontsel:
|
||||
* @fontname:
|
||||
*
|
||||
* This function checks if there's a font matching the given @fontname.
|
||||
* It return %FALSE if no such font could be found. The @fontname has
|
||||
* the format "[FAMILY-LIST] [STYLE-OPTIONS]" as Pango expects it.
|
||||
*
|
||||
* This function causes the font selector to emit the "font_changed"
|
||||
* signal.
|
||||
*
|
||||
* Return value: %TRUE if there is a matching font.
|
||||
* This function expects a @fontname in the format "[FAMILY-LIST]
|
||||
* [STYLE-OPTIONS]". It causes the font selector to emit the
|
||||
* "font_changed" signal.
|
||||
**/
|
||||
gboolean
|
||||
void
|
||||
gimp_font_selection_set_fontname (GimpFontSelection *fontsel,
|
||||
const gchar *fontname)
|
||||
{
|
||||
PangoFontDescription *new_desc;
|
||||
PangoFont *font = NULL;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_FONT_SELECTION (fontsel), FALSE);
|
||||
g_return_val_if_fail (fontname != NULL, FALSE);
|
||||
g_return_if_fail (GIMP_IS_FONT_SELECTION (fontsel));
|
||||
g_return_if_fail (fontname != NULL);
|
||||
|
||||
new_desc = pango_font_description_from_string (fontname);
|
||||
if (new_desc)
|
||||
{
|
||||
pango_font_description_set_size (new_desc, 12 * PANGO_SCALE); /* eeek */
|
||||
font = pango_context_load_font (fontsel->context, new_desc);
|
||||
pango_font_description_unset_fields (new_desc, PANGO_FONT_MASK_SIZE);
|
||||
}
|
||||
|
||||
if (!new_desc)
|
||||
return;
|
||||
|
||||
if (fontsel->font_desc)
|
||||
pango_font_description_free (fontsel->font_desc);
|
||||
{
|
||||
if (pango_font_description_equal (fontsel->font_desc, new_desc))
|
||||
return;
|
||||
|
||||
pango_font_description_free (fontsel->font_desc);
|
||||
}
|
||||
|
||||
if (font)
|
||||
{
|
||||
fontsel->font_desc = new_desc;
|
||||
g_object_unref (font);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (new_desc)
|
||||
pango_font_description_free (new_desc);
|
||||
fontsel->font_desc = NULL;
|
||||
}
|
||||
|
||||
gimp_font_selection_font_changed (fontsel);
|
||||
|
||||
return (font != NULL);
|
||||
}
|
||||
|
||||
const gchar *
|
||||
|
|
|
@ -42,9 +42,7 @@ struct _GimpFontSelection
|
|||
PangoContext *context;
|
||||
PangoFontDescription *font_desc;
|
||||
|
||||
GtkWidget *valid;
|
||||
GtkWidget *entry;
|
||||
|
||||
GimpFontSelectionDialog *dialog;
|
||||
};
|
||||
|
||||
|
@ -59,7 +57,7 @@ struct _GimpFontSelectionClass
|
|||
|
||||
GType gimp_font_selection_get_type (void) G_GNUC_CONST;
|
||||
GtkWidget * gimp_font_selection_new (PangoContext *context);
|
||||
gboolean gimp_font_selection_set_fontname (GimpFontSelection *fontsel,
|
||||
void gimp_font_selection_set_fontname (GimpFontSelection *fontsel,
|
||||
const gchar *fontname);
|
||||
const gchar * gimp_font_selection_get_fontname (GimpFontSelection *fontsel);
|
||||
void gimp_font_selection_set_font_desc (GimpFontSelection *fontsel,
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
|
||||
#include "gimpcolorpanel.h"
|
||||
#include "gimpenummenu.h"
|
||||
#include "gimpfontselection.h"
|
||||
#include "gimppropwidgets.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
@ -864,6 +865,107 @@ gimp_prop_text_buffer_notify (GObject *config,
|
|||
}
|
||||
|
||||
|
||||
/********************/
|
||||
/* font selection */
|
||||
/********************/
|
||||
|
||||
static void gimp_prop_fontsel_callback (GtkWidget *fontsel,
|
||||
GObject *config);
|
||||
static void gimp_prop_fontsel_notify (GObject *config,
|
||||
GParamSpec *param_spec,
|
||||
GtkWidget *fontsel);
|
||||
|
||||
|
||||
GtkWidget *
|
||||
gimp_prop_font_selection_new (GObject *config,
|
||||
const gchar *property_name)
|
||||
{
|
||||
GParamSpec *param_spec;
|
||||
GtkWidget *fontsel;
|
||||
gchar *value;
|
||||
|
||||
param_spec = check_param_spec (config, property_name,
|
||||
G_TYPE_PARAM_STRING, G_STRLOC);
|
||||
if (! param_spec)
|
||||
return NULL;
|
||||
|
||||
g_object_get (config,
|
||||
property_name, &value,
|
||||
NULL);
|
||||
|
||||
fontsel = gimp_font_selection_new (NULL);
|
||||
|
||||
if (value)
|
||||
{
|
||||
gimp_font_selection_set_fontname (GIMP_FONT_SELECTION (fontsel), value);
|
||||
g_free (value);
|
||||
}
|
||||
|
||||
set_param_spec (G_OBJECT (fontsel),
|
||||
GIMP_FONT_SELECTION (fontsel)->entry, param_spec);
|
||||
|
||||
g_signal_connect (fontsel, "font_changed",
|
||||
G_CALLBACK (gimp_prop_fontsel_callback),
|
||||
config);
|
||||
|
||||
connect_notify (config, property_name,
|
||||
G_CALLBACK (gimp_prop_fontsel_notify),
|
||||
fontsel);
|
||||
|
||||
return fontsel;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_prop_fontsel_callback (GtkWidget *fontsel,
|
||||
GObject *config)
|
||||
{
|
||||
GParamSpec *param_spec;
|
||||
const gchar *name;
|
||||
|
||||
param_spec = get_param_spec (G_OBJECT (fontsel));
|
||||
if (! param_spec)
|
||||
return;
|
||||
|
||||
name = gimp_font_selection_get_fontname (GIMP_FONT_SELECTION (fontsel));
|
||||
|
||||
g_signal_handlers_block_by_func (config,
|
||||
gimp_prop_fontsel_notify,
|
||||
fontsel);
|
||||
|
||||
g_object_set (config,
|
||||
param_spec->name, name,
|
||||
NULL);
|
||||
|
||||
g_signal_handlers_unblock_by_func (config,
|
||||
gimp_prop_fontsel_notify,
|
||||
fontsel);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_prop_fontsel_notify (GObject *config,
|
||||
GParamSpec *param_spec,
|
||||
GtkWidget *fontsel)
|
||||
{
|
||||
gchar *value;
|
||||
|
||||
g_object_get (config,
|
||||
param_spec->name, &value,
|
||||
NULL);
|
||||
|
||||
g_signal_handlers_block_by_func (fontsel,
|
||||
gimp_prop_fontsel_callback,
|
||||
config);
|
||||
|
||||
gimp_font_selection_set_fontname (GIMP_FONT_SELECTION (fontsel), value);
|
||||
|
||||
g_signal_handlers_unblock_by_func (fontsel,
|
||||
gimp_prop_fontsel_callback,
|
||||
config);
|
||||
|
||||
g_free (value);
|
||||
}
|
||||
|
||||
|
||||
/****************/
|
||||
/* file entry */
|
||||
/****************/
|
||||
|
|
|
@ -74,6 +74,8 @@ GtkWidget * gimp_prop_entry_new (GObject *config,
|
|||
GtkTextBuffer * gimp_prop_text_buffer_new (GObject *config,
|
||||
const gchar *property_name,
|
||||
gint max_len);
|
||||
GtkWidget * gimp_prop_font_selection_new (GObject *config,
|
||||
const gchar *property_name);
|
||||
|
||||
|
||||
/* GimpParamPath */
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
|
||||
#include "gimpcolorpanel.h"
|
||||
#include "gimpenummenu.h"
|
||||
#include "gimpfontselection.h"
|
||||
#include "gimppropwidgets.h"
|
||||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
@ -864,6 +865,107 @@ gimp_prop_text_buffer_notify (GObject *config,
|
|||
}
|
||||
|
||||
|
||||
/********************/
|
||||
/* font selection */
|
||||
/********************/
|
||||
|
||||
static void gimp_prop_fontsel_callback (GtkWidget *fontsel,
|
||||
GObject *config);
|
||||
static void gimp_prop_fontsel_notify (GObject *config,
|
||||
GParamSpec *param_spec,
|
||||
GtkWidget *fontsel);
|
||||
|
||||
|
||||
GtkWidget *
|
||||
gimp_prop_font_selection_new (GObject *config,
|
||||
const gchar *property_name)
|
||||
{
|
||||
GParamSpec *param_spec;
|
||||
GtkWidget *fontsel;
|
||||
gchar *value;
|
||||
|
||||
param_spec = check_param_spec (config, property_name,
|
||||
G_TYPE_PARAM_STRING, G_STRLOC);
|
||||
if (! param_spec)
|
||||
return NULL;
|
||||
|
||||
g_object_get (config,
|
||||
property_name, &value,
|
||||
NULL);
|
||||
|
||||
fontsel = gimp_font_selection_new (NULL);
|
||||
|
||||
if (value)
|
||||
{
|
||||
gimp_font_selection_set_fontname (GIMP_FONT_SELECTION (fontsel), value);
|
||||
g_free (value);
|
||||
}
|
||||
|
||||
set_param_spec (G_OBJECT (fontsel),
|
||||
GIMP_FONT_SELECTION (fontsel)->entry, param_spec);
|
||||
|
||||
g_signal_connect (fontsel, "font_changed",
|
||||
G_CALLBACK (gimp_prop_fontsel_callback),
|
||||
config);
|
||||
|
||||
connect_notify (config, property_name,
|
||||
G_CALLBACK (gimp_prop_fontsel_notify),
|
||||
fontsel);
|
||||
|
||||
return fontsel;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_prop_fontsel_callback (GtkWidget *fontsel,
|
||||
GObject *config)
|
||||
{
|
||||
GParamSpec *param_spec;
|
||||
const gchar *name;
|
||||
|
||||
param_spec = get_param_spec (G_OBJECT (fontsel));
|
||||
if (! param_spec)
|
||||
return;
|
||||
|
||||
name = gimp_font_selection_get_fontname (GIMP_FONT_SELECTION (fontsel));
|
||||
|
||||
g_signal_handlers_block_by_func (config,
|
||||
gimp_prop_fontsel_notify,
|
||||
fontsel);
|
||||
|
||||
g_object_set (config,
|
||||
param_spec->name, name,
|
||||
NULL);
|
||||
|
||||
g_signal_handlers_unblock_by_func (config,
|
||||
gimp_prop_fontsel_notify,
|
||||
fontsel);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_prop_fontsel_notify (GObject *config,
|
||||
GParamSpec *param_spec,
|
||||
GtkWidget *fontsel)
|
||||
{
|
||||
gchar *value;
|
||||
|
||||
g_object_get (config,
|
||||
param_spec->name, &value,
|
||||
NULL);
|
||||
|
||||
g_signal_handlers_block_by_func (fontsel,
|
||||
gimp_prop_fontsel_callback,
|
||||
config);
|
||||
|
||||
gimp_font_selection_set_fontname (GIMP_FONT_SELECTION (fontsel), value);
|
||||
|
||||
g_signal_handlers_unblock_by_func (fontsel,
|
||||
gimp_prop_fontsel_callback,
|
||||
config);
|
||||
|
||||
g_free (value);
|
||||
}
|
||||
|
||||
|
||||
/****************/
|
||||
/* file entry */
|
||||
/****************/
|
||||
|
|
|
@ -74,6 +74,8 @@ GtkWidget * gimp_prop_entry_new (GObject *config,
|
|||
GtkTextBuffer * gimp_prop_text_buffer_new (GObject *config,
|
||||
const gchar *property_name,
|
||||
gint max_len);
|
||||
GtkWidget * gimp_prop_font_selection_new (GObject *config,
|
||||
const gchar *property_name);
|
||||
|
||||
|
||||
/* GimpParamPath */
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2003-02-03 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* de.po: small update to the German translation.
|
||||
|
||||
2003-02-03 Daniel Yacob <locales@geez.org>
|
||||
|
||||
* am.po: Updated Amharic translation.
|
||||
|
|
Loading…
Reference in New Issue