use italic font if not in user-override mode.

2007-08-13  Sven Neumann  <sven@gimp.org>

	* libgimpwidgets/gimpnumberpairentry.c: use italic font if not in
	user-override mode.

	* app/tools/gimprectangleoptions.c: removed auto-mode icon.

	* themes/Default/images/Makefile.am
	* themes/Default/images/stock-auto-mode-16.png
	* libgimpwidgets/gimpnumberpairentry.[ch]: removed
	GIMP_STOCK_AUTO_MODE.


svn path=/trunk/; revision=23231
This commit is contained in:
Sven Neumann 2007-08-13 09:25:27 +00:00 committed by Sven Neumann
parent b4a5338865
commit 5df43c2cbb
7 changed files with 67 additions and 57 deletions

View File

@ -1,3 +1,15 @@
2007-08-13 Sven Neumann <sven@gimp.org>
* libgimpwidgets/gimpnumberpairentry.c: use italic font if not in
user-override mode.
* app/tools/gimprectangleoptions.c: removed auto-mode icon.
* themes/Default/images/Makefile.am
* themes/Default/images/stock-auto-mode-16.png
* libgimpwidgets/gimpnumberpairentry.[ch]: removed
GIMP_STOCK_AUTO_MODE.
2007-08-13 Sven Neumann <sven@gimp.org> 2007-08-13 Sven Neumann <sven@gimp.org>
* app/gui/gui-vtable.c (gui_pdb_dialog_new): added missing cast. * app/gui/gui-vtable.c (gui_pdb_dialog_new): added missing cast.

View File

@ -64,9 +64,6 @@ static gboolean gimp_number_pair_entry_history_select (GtkEntryComp
static void gimp_number_pair_entry_history_add (GtkWidget *entry, static void gimp_number_pair_entry_history_add (GtkWidget *entry,
GtkTreeModel *model); GtkTreeModel *model);
static void gimp_rectangle_options_hide_on_user_override (GimpNumberPairEntry *number_pair_entry,
GParamSpec *param_spec,
GtkWidget *widget);
/* TODO: Calculate this dynamically so that the GtkEntry:s are always /* TODO: Calculate this dynamically so that the GtkEntry:s are always
@ -797,7 +794,6 @@ gimp_rectangle_options_gui (GimpToolOptions *tool_options)
GtkWidget *table; GtkWidget *table;
GtkWidget *entry; GtkWidget *entry;
GtkWidget *hbox; GtkWidget *hbox;
GtkWidget *image;
GList *children; GList *children;
gint row = 0; gint row = 0;
@ -856,8 +852,8 @@ gimp_rectangle_options_gui (GimpToolOptions *tool_options)
gtk_widget_show (private->second_row_hbox); gtk_widget_show (private->second_row_hbox);
} }
/* Create and prepare the widgets that are on the second row dependant of /* Create and prepare the widgets that are on the second row
* current fixed-rule * dependant of current fixed-rule
*/ */
{ {
/* Aspect ratio entry */ /* Aspect ratio entry */
@ -890,27 +886,11 @@ gimp_rectangle_options_gui (GimpToolOptions *tool_options)
gtk_widget_hide (children->data); gtk_widget_hide (children->data);
g_list_free (children); g_list_free (children);
image = gtk_image_new_from_stock (GIMP_STOCK_AUTO_MODE,
GTK_ICON_SIZE_MENU);
gtk_widget_set_size_request (GTK_WIDGET (image), 16, 16);
g_object_set (image,
"visible",
!gimp_number_pair_entry_get_user_override (GIMP_NUMBER_PAIR_ENTRY (entry)),
NULL);
g_signal_connect (entry, "notify::user-override",
G_CALLBACK (gimp_rectangle_options_hide_on_user_override),
image);
private->fixed_aspect_hbox = gtk_hbox_new (FALSE, 0); private->fixed_aspect_hbox = gtk_hbox_new (FALSE, 0);
g_object_ref_sink (private->fixed_aspect_hbox); g_object_ref_sink (private->fixed_aspect_hbox);
gtk_box_pack_start_defaults (GTK_BOX (private->fixed_aspect_hbox), gtk_box_pack_start_defaults (GTK_BOX (private->fixed_aspect_hbox), entry);
entry);
gtk_box_pack_start (GTK_BOX (private->fixed_aspect_hbox),
image,
FALSE, FALSE, 0);
gtk_widget_show (private->fixed_aspect_hbox); gtk_widget_show (private->fixed_aspect_hbox);
/* Fixed width entry */ /* Fixed width entry */
private->fixed_width_entry = private->fixed_width_entry =
gimp_prop_size_entry_new (config, "desired-fixed-width", "unit", "%a", gimp_prop_size_entry_new (config, "desired-fixed-width", "unit", "%a",
@ -951,24 +931,10 @@ gimp_rectangle_options_gui (GimpToolOptions *tool_options)
gtk_widget_show (entry); gtk_widget_show (entry);
image = gtk_image_new_from_stock (GIMP_STOCK_AUTO_MODE,
GTK_ICON_SIZE_MENU);
gtk_widget_set_size_request (GTK_WIDGET (image), 16, 16);
g_object_set (image,
"visible",
!gimp_number_pair_entry_get_user_override (GIMP_NUMBER_PAIR_ENTRY (entry)),
NULL);
g_signal_connect (entry, "notify::user-override",
G_CALLBACK (gimp_rectangle_options_hide_on_user_override),
image);
private->fixed_size_hbox = gtk_hbox_new (FALSE, 0); private->fixed_size_hbox = gtk_hbox_new (FALSE, 0);
g_object_ref_sink (private->fixed_size_hbox); g_object_ref_sink (private->fixed_size_hbox);
gtk_box_pack_start_defaults (GTK_BOX (private->fixed_size_hbox), gtk_box_pack_start_defaults (GTK_BOX (private->fixed_size_hbox),
entry); entry);
gtk_box_pack_start (GTK_BOX (private->fixed_size_hbox),
image,
FALSE, FALSE, 0);
gtk_widget_show (private->fixed_size_hbox); gtk_widget_show (private->fixed_size_hbox);
private->size_button_box = private->size_button_box =
@ -1188,14 +1154,3 @@ gimp_number_pair_entry_history_add (GtkWidget *entry,
/* FIXME: limit the size of the history */ /* FIXME: limit the size of the history */
} }
} }
static void
gimp_rectangle_options_hide_on_user_override (GimpNumberPairEntry *number_pair_entry,
GParamSpec *param_spec,
GtkWidget *widget)
{
g_object_set (widget,
"visible",
!gimp_number_pair_entry_get_user_override (number_pair_entry),
NULL);
}

View File

@ -86,6 +86,9 @@ typedef struct
*/ */
gboolean user_override; gboolean user_override;
/* Is the font style currently set to ITALIC or NORMAL ? */
gboolean font_italic;
/* What separators that are valid when parsing input, e.g. when the /* What separators that are valid when parsing input, e.g. when the
* widget is used for aspect ratio, valid separators are typically * widget is used for aspect ratio, valid separators are typically
* ':' and '/'. * ':' and '/'.
@ -123,6 +126,7 @@ static void gimp_number_pair_entry_get_property (GObject
guint property_id, guint property_id,
GValue *value, GValue *value,
GParamSpec *pspec); GParamSpec *pspec);
static void gimp_number_pair_entry_changed (GimpNumberPairEntry *entry);
static gboolean gimp_number_pair_entry_events (GtkWidget *widgett, static gboolean gimp_number_pair_entry_events (GtkWidget *widgett,
GdkEvent *event); GdkEvent *event);
@ -276,12 +280,16 @@ gimp_number_pair_entry_init (GimpNumberPairEntry *entry)
priv->default_left_number = 1.0; priv->default_left_number = 1.0;
priv->default_right_number = 1.0; priv->default_right_number = 1.0;
priv->user_override = FALSE; priv->user_override = FALSE;
priv->font_italic = FALSE;
priv->separators = NULL; priv->separators = NULL;
priv->num_separators = 0; priv->num_separators = 0;
priv->allow_simplification = FALSE; priv->allow_simplification = FALSE;
priv->min_valid_value = G_MINDOUBLE; priv->min_valid_value = G_MINDOUBLE;
priv->max_valid_value = G_MAXDOUBLE; priv->max_valid_value = G_MAXDOUBLE;
g_signal_connect (entry, "changed",
G_CALLBACK (gimp_number_pair_entry_changed),
NULL);
g_signal_connect (entry, "focus-out-event", g_signal_connect (entry, "focus-out-event",
G_CALLBACK (gimp_number_pair_entry_events), G_CALLBACK (gimp_number_pair_entry_events),
NULL); NULL);
@ -636,6 +644,35 @@ gimp_number_pair_entry_get_aspect (GimpNumberPairEntry *entry)
} }
} }
static void
gimp_number_pair_entry_modify_font (GimpNumberPairEntry *entry,
gboolean italic)
{
GimpNumberPairEntryPrivate *priv = GIMP_NUMBER_PAIR_ENTRY_GET_PRIVATE (entry);
GtkRcStyle *rc_style;
if (priv->font_italic == italic)
return;
rc_style = gtk_widget_get_modifier_style (GTK_WIDGET (entry));
if (! rc_style->font_desc)
{
PangoContext *context = gtk_widget_get_pango_context (GTK_WIDGET (entry));
rc_style->font_desc = pango_font_description_copy (pango_context_get_font_description (context));
}
pango_font_description_set_style (rc_style->font_desc,
italic ?
PANGO_STYLE_ITALIC : PANGO_STYLE_NORMAL);
gtk_widget_modify_style (GTK_WIDGET (entry), rc_style);
priv->font_italic = italic;
}
/** /**
* gimp_number_pair_entry_set_user_override: * gimp_number_pair_entry_set_user_override:
* @entry: A #GimpNumberPairEntry widget. * @entry: A #GimpNumberPairEntry widget.
@ -660,13 +697,15 @@ gimp_number_pair_entry_set_user_override (GimpNumberPairEntry *entry,
priv->user_override = user_override; priv->user_override = user_override;
if (!priv->user_override) if (! user_override)
{ {
gimp_number_pair_entry_set_default_values (entry, gimp_number_pair_entry_set_default_values (entry,
priv->default_left_number, priv->default_left_number,
priv->default_right_number); priv->default_right_number);
} }
gimp_number_pair_entry_modify_font (entry, ! user_override);
g_object_notify (G_OBJECT (entry), "user-override"); g_object_notify (G_OBJECT (entry), "user-override");
} }
@ -690,6 +729,12 @@ gimp_number_pair_entry_get_user_override (GimpNumberPairEntry *entry)
return priv->user_override; return priv->user_override;
} }
static void
gimp_number_pair_entry_changed (GimpNumberPairEntry *entry)
{
gimp_number_pair_entry_modify_font (entry, FALSE);
}
static gboolean static gboolean
gimp_number_pair_entry_events (GtkWidget *widget, gimp_number_pair_entry_events (GtkWidget *widget,
GdkEvent *event) GdkEvent *event)
@ -824,9 +869,14 @@ gimp_number_pair_entry_update_text (GimpNumberPairEntry *entry)
buffer = gimp_number_pair_entry_strdup_number_pair_string (entry, buffer = gimp_number_pair_entry_strdup_number_pair_string (entry,
priv->left_number, priv->left_number,
priv->right_number); priv->right_number);
gtk_entry_set_text (GTK_ENTRY (entry), buffer); g_signal_handlers_block_by_func (entry,
gimp_number_pair_entry_changed, NULL);
gtk_entry_set_text (GTK_ENTRY (entry), buffer);
g_free (buffer); g_free (buffer);
g_signal_handlers_unblock_by_func (entry,
gimp_number_pair_entry_changed, NULL);
} }
static gboolean static gboolean

View File

@ -176,8 +176,6 @@ static const GtkStockItem gimp_stock_items[] =
{ GIMP_STOCK_TEXT_DIR_RTL, NULL, 0, 0, LIBGIMP_DOMAIN }, { GIMP_STOCK_TEXT_DIR_RTL, NULL, 0, 0, LIBGIMP_DOMAIN },
{ GIMP_STOCK_PRINT_RESOLUTION, NULL, 0, 0, LIBGIMP_DOMAIN }, { GIMP_STOCK_PRINT_RESOLUTION, NULL, 0, 0, LIBGIMP_DOMAIN },
{ GIMP_STOCK_AUTO_MODE, NULL, 0, 0, LIBGIMP_DOMAIN },
{ GIMP_STOCK_CONVERT_RGB, NULL, 0, 0, LIBGIMP_DOMAIN }, { GIMP_STOCK_CONVERT_RGB, NULL, 0, 0, LIBGIMP_DOMAIN },
{ GIMP_STOCK_CONVERT_GRAYSCALE, NULL, 0, 0, LIBGIMP_DOMAIN }, { GIMP_STOCK_CONVERT_GRAYSCALE, NULL, 0, 0, LIBGIMP_DOMAIN },
{ GIMP_STOCK_CONVERT_INDEXED, NULL, 0, 0, LIBGIMP_DOMAIN }, { GIMP_STOCK_CONVERT_INDEXED, NULL, 0, 0, LIBGIMP_DOMAIN },
@ -491,8 +489,6 @@ gimp_stock_menu_pixbufs[] =
{ {
{ GIMP_STOCK_CENTER, stock_center_16 }, { GIMP_STOCK_CENTER, stock_center_16 },
{ GIMP_STOCK_AUTO_MODE, stock_auto_mode_16 },
{ GIMP_STOCK_CONVERT_RGB, stock_convert_rgb_16 }, { GIMP_STOCK_CONVERT_RGB, stock_convert_rgb_16 },
{ GIMP_STOCK_CONVERT_GRAYSCALE, stock_convert_grayscale_16 }, { GIMP_STOCK_CONVERT_GRAYSCALE, stock_convert_grayscale_16 },
{ GIMP_STOCK_CONVERT_INDEXED, stock_convert_indexed_16 }, { GIMP_STOCK_CONVERT_INDEXED, stock_convert_indexed_16 },

View File

@ -142,8 +142,6 @@ G_BEGIN_DECLS
/* in menu size: */ /* in menu size: */
#define GIMP_STOCK_AUTO_MODE "gimp-auto-mode"
#define GIMP_STOCK_CONVERT_RGB "gimp-convert-rgb" #define GIMP_STOCK_CONVERT_RGB "gimp-convert-rgb"
#define GIMP_STOCK_CONVERT_GRAYSCALE "gimp-convert-grayscale" #define GIMP_STOCK_CONVERT_GRAYSCALE "gimp-convert-grayscale"
#define GIMP_STOCK_CONVERT_INDEXED "gimp-convert-indexed" #define GIMP_STOCK_CONVERT_INDEXED "gimp-convert-indexed"

View File

@ -124,7 +124,6 @@ STOCK_MENU_IMAGES = \
STOCK_BUTTON_IMAGES = \ STOCK_BUTTON_IMAGES = \
stock-anchor-16.png \ stock-anchor-16.png \
stock-auto-mode-16.png \
stock-center-24.png \ stock-center-24.png \
stock-channel-24.png \ stock-channel-24.png \
stock-channel-alpha-24.png \ stock-channel-alpha-24.png \

Binary file not shown.

Before

Width:  |  Height:  |  Size: 609 B