diff --git a/app/config/gimpguiconfig.c b/app/config/gimpguiconfig.c index 300c6f489a..a362ec420e 100644 --- a/app/config/gimpguiconfig.c +++ b/app/config/gimpguiconfig.c @@ -76,6 +76,7 @@ enum PROP_ICON_THEME_PATH, PROP_ICON_THEME, PROP_PREFER_SYMBOLIC_ICONS, + PROP_FONT_RELATIVE_SIZE, PROP_USE_HELP, PROP_SHOW_HELP_BUTTON, PROP_HELP_LOCALES, @@ -358,6 +359,13 @@ gimp_gui_config_class_init (GimpGuiConfigClass *klass) TRUE, GIMP_PARAM_STATIC_STRINGS); + GIMP_CONFIG_PROP_DOUBLE (object_class, PROP_FONT_RELATIVE_SIZE, + "font-relative-size", + "Tweak font-size from the theme", + FONT_SIZE_BLURB, + 0.5, 2.0, 1.0, + GIMP_PARAM_STATIC_STRINGS); + GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_USE_HELP, "use-help", "Use help", @@ -695,6 +703,9 @@ gimp_gui_config_set_property (GObject *object, case PROP_PREFER_SYMBOLIC_ICONS: gui_config->prefer_symbolic_icons = g_value_get_boolean (value); break; + case PROP_FONT_RELATIVE_SIZE: + gui_config->font_relative_size = g_value_get_double (value); + break; case PROP_USE_HELP: gui_config->use_help = g_value_get_boolean (value); break; @@ -872,6 +883,9 @@ gimp_gui_config_get_property (GObject *object, case PROP_PREFER_SYMBOLIC_ICONS: g_value_set_boolean (value, gui_config->prefer_symbolic_icons); break; + case PROP_FONT_RELATIVE_SIZE: + g_value_set_double (value, gui_config->font_relative_size); + break; case PROP_USE_HELP: g_value_set_boolean (value, gui_config->use_help); break; diff --git a/app/config/gimpguiconfig.h b/app/config/gimpguiconfig.h index 3bc6fb1278..9ad7ec6030 100644 --- a/app/config/gimpguiconfig.h +++ b/app/config/gimpguiconfig.h @@ -68,6 +68,7 @@ struct _GimpGuiConfig gchar *icon_theme_path; gchar *icon_theme; gboolean prefer_symbolic_icons; + gdouble font_relative_size; gboolean override_icon_size; GimpIconSize custom_icon_size; gboolean use_help; diff --git a/app/config/gimprc-blurbs.h b/app/config/gimprc-blurbs.h index e7ff1be250..2d04bd4d42 100644 --- a/app/config/gimprc-blurbs.h +++ b/app/config/gimprc-blurbs.h @@ -561,6 +561,9 @@ _("When enabled, symbolic icons will be preferred if available.") #define ICON_THEME_PATH_BLURB \ "Sets the icon theme search path." +#define FONT_SIZE_BLURB \ +_("Tweak font size of the graphical interface.") + #define IMAGE_CONVERT_PROFILE_INTENT_BLURB \ _("Sets the default rendering intent for the 'Convert to Color Profile' dialog.") diff --git a/app/dialogs/preferences-dialog.c b/app/dialogs/preferences-dialog.c index 999078b315..0ac7eabed2 100644 --- a/app/dialogs/preferences-dialog.c +++ b/app/dialogs/preferences-dialog.c @@ -155,6 +155,11 @@ static void prefs_gui_config_notify_icon_size (GObject *config, GtkRange *range); static void prefs_icon_size_value_changed (GtkRange *range, GimpGuiConfig *config); +static void prefs_gui_config_notify_font_size (GObject *config, + GParamSpec *pspec, + GtkRange *range); +static void prefs_font_size_value_changed (GtkRange *range, + GimpGuiConfig *config); /* private variables */ @@ -971,6 +976,38 @@ prefs_gui_config_notify_icon_size (GObject *config, config); } +static void +prefs_font_size_value_changed (GtkRange *range, + GimpGuiConfig *config) +{ + gdouble value = gtk_range_get_value (range); + + g_signal_handlers_block_by_func (config, + G_CALLBACK (prefs_gui_config_notify_font_size), + range); + g_object_set (G_OBJECT (config), + "font-relative-size", value / 100.0, + NULL); + g_signal_handlers_unblock_by_func (config, + G_CALLBACK (prefs_gui_config_notify_font_size), + range); +} + +static void +prefs_gui_config_notify_font_size (GObject *config, + GParamSpec *pspec, + GtkRange *range) +{ + g_signal_handlers_block_by_func (range, + G_CALLBACK (prefs_font_size_value_changed), + config); + gtk_range_set_value (range, + GIMP_GUI_CONFIG (config)->font_relative_size * 100.0); + g_signal_handlers_unblock_by_func (range, + G_CALLBACK (prefs_font_size_value_changed), + config); +} + static void prefs_format_string_select_callback (GtkListBox *listbox, GtkListBoxRow *row, @@ -2112,6 +2149,31 @@ prefs_dialog_new (Gimp *gimp, gtk_box_pack_start (GTK_BOX (vbox3), scale, FALSE, FALSE, 0); gtk_widget_show (scale); + /* Font sizes. */ + vbox3 = prefs_frame_new (_("Font Scaling"), GTK_CONTAINER (vbox2), FALSE); + gimp_help_set_help_data (vbox3, + _("Font scaling will not work with themes using absolute sizes."), + NULL); + scale = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, + 50, 200, 10); + gtk_scale_set_value_pos (GTK_SCALE (scale), GTK_POS_BOTTOM); + gtk_scale_add_mark (GTK_SCALE (scale), 50.0, GTK_POS_BOTTOM, + _("50%")); + gtk_scale_add_mark (GTK_SCALE (scale), 100.0, GTK_POS_BOTTOM, + _("100%")); + gtk_scale_add_mark (GTK_SCALE (scale), 200.0, GTK_POS_BOTTOM, + _("200%")); + gtk_range_set_value (GTK_RANGE (scale), + (gdouble) GIMP_GUI_CONFIG (object)->font_relative_size * 100.0); + g_signal_connect (G_OBJECT (scale), "value-changed", + G_CALLBACK (prefs_font_size_value_changed), + GIMP_GUI_CONFIG (object)); + g_signal_connect (G_OBJECT (object), "notify::font-relative-size", + G_CALLBACK (prefs_gui_config_notify_font_size), + scale); + gtk_box_pack_start (GTK_BOX (vbox3), scale, FALSE, FALSE, 0); + gtk_widget_show (scale); + /* Reload Current Theme button */ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0); diff --git a/app/gui/themes.c b/app/gui/themes.c index c29b603af7..b45e035013 100644 --- a/app/gui/themes.c +++ b/app/gui/themes.c @@ -100,6 +100,9 @@ themes_init (Gimp *gimp) g_signal_connect (config, "notify::custom-icon-size", G_CALLBACK (themes_theme_change_notify), gimp); + g_signal_connect (config, "notify::font-relative-size", + G_CALLBACK (themes_theme_change_notify), + gimp); themes_theme_change_notify (config, NULL, gimp); } @@ -373,6 +376,12 @@ themes_apply_theme (Gimp *gimp, button_icon_size); } + if (! error && config->font_relative_size != 1.0) + g_output_stream_printf (output, NULL, NULL, &error, + "\n" + "* { font-size: %frem; }", + config->font_relative_size); + if (! error) { g_output_stream_printf (