diff --git a/ChangeLog b/ChangeLog index d4b8b8f05b..8c2caf413f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2007-08-13 Sven Neumann + + * 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 * app/gui/gui-vtable.c (gui_pdb_dialog_new): added missing cast. diff --git a/app/tools/gimprectangleoptions.c b/app/tools/gimprectangleoptions.c index cf65f1d6d5..d86f6fc0f0 100644 --- a/app/tools/gimprectangleoptions.c +++ b/app/tools/gimprectangleoptions.c @@ -64,9 +64,6 @@ static gboolean gimp_number_pair_entry_history_select (GtkEntryComp static void gimp_number_pair_entry_history_add (GtkWidget *entry, 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 @@ -797,7 +794,6 @@ gimp_rectangle_options_gui (GimpToolOptions *tool_options) GtkWidget *table; GtkWidget *entry; GtkWidget *hbox; - GtkWidget *image; GList *children; gint row = 0; @@ -856,8 +852,8 @@ gimp_rectangle_options_gui (GimpToolOptions *tool_options) gtk_widget_show (private->second_row_hbox); } - /* Create and prepare the widgets that are on the second row dependant of - * current fixed-rule + /* Create and prepare the widgets that are on the second row + * dependant of current fixed-rule */ { /* Aspect ratio entry */ @@ -890,27 +886,11 @@ gimp_rectangle_options_gui (GimpToolOptions *tool_options) gtk_widget_hide (children->data); 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); g_object_ref_sink (private->fixed_aspect_hbox); - gtk_box_pack_start_defaults (GTK_BOX (private->fixed_aspect_hbox), - entry); - gtk_box_pack_start (GTK_BOX (private->fixed_aspect_hbox), - image, - FALSE, FALSE, 0); + gtk_box_pack_start_defaults (GTK_BOX (private->fixed_aspect_hbox), entry); gtk_widget_show (private->fixed_aspect_hbox); - /* Fixed width entry */ private->fixed_width_entry = 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); - 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); g_object_ref_sink (private->fixed_size_hbox); gtk_box_pack_start_defaults (GTK_BOX (private->fixed_size_hbox), entry); - gtk_box_pack_start (GTK_BOX (private->fixed_size_hbox), - image, - FALSE, FALSE, 0); gtk_widget_show (private->fixed_size_hbox); private->size_button_box = @@ -1188,14 +1154,3 @@ gimp_number_pair_entry_history_add (GtkWidget *entry, /* 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); -} diff --git a/libgimpwidgets/gimpnumberpairentry.c b/libgimpwidgets/gimpnumberpairentry.c index fddbf0ca21..f00fa53029 100644 --- a/libgimpwidgets/gimpnumberpairentry.c +++ b/libgimpwidgets/gimpnumberpairentry.c @@ -86,6 +86,9 @@ typedef struct */ 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 * widget is used for aspect ratio, valid separators are typically * ':' and '/'. @@ -123,6 +126,7 @@ static void gimp_number_pair_entry_get_property (GObject guint property_id, GValue *value, GParamSpec *pspec); +static void gimp_number_pair_entry_changed (GimpNumberPairEntry *entry); static gboolean gimp_number_pair_entry_events (GtkWidget *widgett, GdkEvent *event); @@ -276,12 +280,16 @@ gimp_number_pair_entry_init (GimpNumberPairEntry *entry) priv->default_left_number = 1.0; priv->default_right_number = 1.0; priv->user_override = FALSE; + priv->font_italic = FALSE; priv->separators = NULL; priv->num_separators = 0; priv->allow_simplification = FALSE; priv->min_valid_value = G_MINDOUBLE; 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_CALLBACK (gimp_number_pair_entry_events), 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: * @entry: A #GimpNumberPairEntry widget. @@ -660,13 +697,15 @@ gimp_number_pair_entry_set_user_override (GimpNumberPairEntry *entry, priv->user_override = user_override; - if (!priv->user_override) + if (! user_override) { gimp_number_pair_entry_set_default_values (entry, priv->default_left_number, priv->default_right_number); } + gimp_number_pair_entry_modify_font (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; } +static void +gimp_number_pair_entry_changed (GimpNumberPairEntry *entry) +{ + gimp_number_pair_entry_modify_font (entry, FALSE); +} + static gboolean gimp_number_pair_entry_events (GtkWidget *widget, GdkEvent *event) @@ -824,9 +869,14 @@ gimp_number_pair_entry_update_text (GimpNumberPairEntry *entry) buffer = gimp_number_pair_entry_strdup_number_pair_string (entry, priv->left_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_signal_handlers_unblock_by_func (entry, + gimp_number_pair_entry_changed, NULL); } static gboolean diff --git a/libgimpwidgets/gimpstock.c b/libgimpwidgets/gimpstock.c index cd8a4bd16a..a7a70d33c3 100644 --- a/libgimpwidgets/gimpstock.c +++ b/libgimpwidgets/gimpstock.c @@ -176,8 +176,6 @@ static const GtkStockItem gimp_stock_items[] = { GIMP_STOCK_TEXT_DIR_RTL, 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_GRAYSCALE, 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_AUTO_MODE, stock_auto_mode_16 }, - { GIMP_STOCK_CONVERT_RGB, stock_convert_rgb_16 }, { GIMP_STOCK_CONVERT_GRAYSCALE, stock_convert_grayscale_16 }, { GIMP_STOCK_CONVERT_INDEXED, stock_convert_indexed_16 }, diff --git a/libgimpwidgets/gimpstock.h b/libgimpwidgets/gimpstock.h index cae10bfa92..4b069f8307 100644 --- a/libgimpwidgets/gimpstock.h +++ b/libgimpwidgets/gimpstock.h @@ -142,8 +142,6 @@ G_BEGIN_DECLS /* in menu size: */ -#define GIMP_STOCK_AUTO_MODE "gimp-auto-mode" - #define GIMP_STOCK_CONVERT_RGB "gimp-convert-rgb" #define GIMP_STOCK_CONVERT_GRAYSCALE "gimp-convert-grayscale" #define GIMP_STOCK_CONVERT_INDEXED "gimp-convert-indexed" diff --git a/themes/Default/images/Makefile.am b/themes/Default/images/Makefile.am index fca97ec480..269ec7fca7 100644 --- a/themes/Default/images/Makefile.am +++ b/themes/Default/images/Makefile.am @@ -124,7 +124,6 @@ STOCK_MENU_IMAGES = \ STOCK_BUTTON_IMAGES = \ stock-anchor-16.png \ - stock-auto-mode-16.png \ stock-center-24.png \ stock-channel-24.png \ stock-channel-alpha-24.png \ diff --git a/themes/Default/images/stock-auto-mode-16.png b/themes/Default/images/stock-auto-mode-16.png deleted file mode 100644 index d7b5c2b304..0000000000 Binary files a/themes/Default/images/stock-auto-mode-16.png and /dev/null differ