gimp r26988 - in trunk: . app/widgets themes/Default themes/Small



Author: neo
Date: Thu Sep 18 09:33:20 2008
New Revision: 26988
URL: http://svn.gnome.org/viewvc/gimp?rev=26988&view=rev

Log:
2008-09-18  Sven Neumann  <sven gimp org>

	* app/widgets/gimpdock.c: made the font scale factor for the 
docks
	configurable in gtkrc.

	* themes/Default/gtkrc
	* themes/Small/gtkrc: for documentation purposes, added the
	default value for GimpDock::font-scale here. Changed all style
	property names to use the canonical names.



Modified:
   trunk/ChangeLog
   trunk/app/widgets/gimpdock.c
   trunk/themes/Default/gtkrc
   trunk/themes/Small/gtkrc

Modified: trunk/app/widgets/gimpdock.c
==============================================================================
--- trunk/app/widgets/gimpdock.c	(original)
+++ trunk/app/widgets/gimpdock.c	Thu Sep 18 09:33:20 2008
@@ -40,15 +40,15 @@
 #include "gimpdockseparator.h"
 #include "gimpwidgets-utils.h"
 
-#include "gimpsessioninfo.h" /* FIXME */
+#include "gimpsessioninfo.h"    /* FIXME */
 #include "core/gimpcontainer.h" /* FIXME */
-#include "dialogs/dialogs.h" /* FIXME */
+#include "dialogs/dialogs.h"    /* FIXME */
 
 #include "gimp-intl.h"
 
 
-#define DEFAULT_DOCK_HEIGHT 300
-
+#define DEFAULT_DOCK_HEIGHT     300
+#define DEFAULT_DOCK_FONT_SCALE PANGO_SCALE_SMALL
 
 enum
 {
@@ -156,6 +156,13 @@
                                                              -1, G_MAXINT,
                                                              DEFAULT_DOCK_HEIGHT,
                                                              GIMP_PARAM_READABLE));
+  gtk_widget_class_install_style_property (widget_class,
+                                           g_param_spec_double ("font-scale",
+                                                                NULL, NULL,
+                                                                0.0,
+                                                                G_MAXDOUBLE,
+                                                                DEFAULT_DOCK_FONT_SCALE,
+                                                                GIMP_PARAM_READABLE));
 }
 
 static void
@@ -312,12 +319,8 @@
 gimp_dock_style_set (GtkWidget *widget,
                      GtkStyle  *prev_style)
 {
-  PangoContext         *context;
-  PangoFontDescription *font_desc;
-  gint                  font_size;
-  gint                  default_height;
-  gchar                *font_str;
-  gchar                *rc_string;
+  gint    default_height;
+  gdouble font_scale;
 
   GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
 
@@ -325,29 +328,40 @@
 
   gtk_window_set_default_size (GTK_WINDOW (widget), -1, default_height);
 
-  context = gtk_widget_get_pango_context (widget);
-  font_desc = pango_context_get_font_description (context);
-  font_desc = pango_font_description_copy (font_desc);
-
-  font_size = pango_font_description_get_size (font_desc);
-  font_size = PANGO_SCALE_SMALL * font_size;
-  pango_font_description_set_size (font_desc, font_size);
-
-  font_str = pango_font_description_to_string (font_desc);
-  pango_font_description_free (font_desc);
-
-  rc_string =
-    g_strdup_printf ("style \"gimp-dock-style\""
-                     "{"
-                     "  font_name = \"%s\""
-                     "}"
-                     "widget \"gimp-dock-%d.*\" style \"gimp-dock-style\"",
-                     font_str,
-                     GIMP_DOCK (widget)->ID);
-  g_free (font_str);
+  gtk_widget_style_get (widget, "font-scale", &font_scale, NULL);
 
-  gtk_rc_parse_string (rc_string);
-  g_free (rc_string);
+  if (font_scale != 1.0)
+    {
+      PangoContext         *context;
+      PangoFontDescription *font_desc;
+      gint                  font_size;
+      gchar                *font_str;
+      gchar                *rc_string;
+
+      context = gtk_widget_get_pango_context (widget);
+      font_desc = pango_context_get_font_description (context);
+      font_desc = pango_font_description_copy (font_desc);
+
+      font_size = pango_font_description_get_size (font_desc);
+      font_size = font_scale * font_size;
+      pango_font_description_set_size (font_desc, font_size);
+
+      font_str = pango_font_description_to_string (font_desc);
+      pango_font_description_free (font_desc);
+
+      rc_string =
+        g_strdup_printf ("style \"gimp-dock-style\""
+                         "{"
+                         "  font_name = \"%s\""
+                         "}"
+                         "widget \"gimp-dock-%d.*\" style \"gimp-dock-style\"",
+                         font_str,
+                         GIMP_DOCK (widget)->ID);
+      g_free (font_str);
+
+      gtk_rc_parse_string (rc_string);
+      g_free (rc_string);
+    }
 }
 
 static void

Modified: trunk/themes/Default/gtkrc
==============================================================================
--- trunk/themes/Default/gtkrc	(original)
+++ trunk/themes/Default/gtkrc	Thu Sep 18 09:33:20 2008
@@ -36,26 +36,27 @@
       { "images/stock-warning-64.png", *, *, "gtk-dialog" }
     }
 
-  GtkPaned::handle_size             = 6
-  GimpDock::default_height          = 300
+  GtkPaned::handle-size             = 6
+  GimpDock::default-height          = 300
+  GimpDock::font-scale              = 0.8333
   GimpDockSeparator::height         = 6
-  GimpMenuDock::minimal_width       = 200
-  GimpMenuDock::menu_preview_size   = button
-  GimpToolbox::tool_icon_size       = button
-  GimpToolbox::button_relief        = none
-  GimpDockbook::tab_border          = 0
-  GimpDockbook::tab_icon_size       = button
-  GimpColorNotebook::tab_border     = 0
-  GimpColorNotebook::tab_icon_size  = button
-  GimpDockable::content_border      = 2
-  GimpEditor::content_spacing       = 2
-  GimpEditor::button_spacing        = 2
-  GimpEditor::button_icon_size      = menu
-  GimpDataEditor::minimal_height    = 96
-  GtkDialog::content_area_border    = 0
-  GtkDialog::button_spacing         = 6
-  GtkDialog::action_area_border     = 12
-  GimpUnitComboBox::appears_as_list = 0
+  GimpMenuDock::minimal-width       = 200
+  GimpMenuDock::menu-preview-size   = button
+  GimpToolbox::tool-icon-size       = button
+  GimpToolbox::button-relief        = none
+  GimpDockbook::tab-border          = 0
+  GimpDockbook::tab-icon-size       = button
+  GimpColorNotebook::tab-border     = 0
+  GimpColorNotebook::tab-icon-size  = button
+  GimpDockable::content-border      = 2
+  GimpEditor::content-spacing       = 2
+  GimpEditor::button-spacing        = 2
+  GimpEditor::button-icon-size      = menu
+  GimpDataEditor::minimal-height    = 96
+  GtkDialog::content-area-border    = 0
+  GtkDialog::button-spacing         = 6
+  GtkDialog::action-area-border     = 12
+  GimpUnitComboBox::appears-as-list = 0
 }
 
 class "GtkWidget" style "gimp-default-style"
@@ -63,7 +64,7 @@
 
 style "gimp-tool-dialog-style" = "gimp-default-style"
 {
-  GtkDialog::action_area_border = 6
+  GtkDialog::action-area-border = 6
 }
 
 class "GimpToolDialog" style "gimp-tool-dialog-style"
@@ -79,10 +80,10 @@
 
 style "gimp-dockable-style" = "gimp-default-style"
 {
-  GimpFrame::label_bold       = 0
-  GimpFrame::label_spacing    = 2
-  GtkButton::focus_line_width = 1
-  GtkButton::focus_padding    = 0
+  GimpFrame::label-bold       = 0
+  GimpFrame::label-spacing    = 2
+  GtkButton::focus-line_width = 1
+  GtkButton::focus-padding    = 0
 }
 
 widget "*GimpDockable.*" style "gimp-dockable-style"
@@ -94,8 +95,8 @@
   GimpScaleComboBox::label-scale = 0.8333
   GtkComboBox::arrow-size        = 8
   GtkButton::inner-border        = { 0, 0, 0, 0 }
-  GtkButton::focus_line_width    = 0
-  GtkButton::focus_padding       = 0
+  GtkButton::focus-line_width    = 0
+  GtkButton::focus-padding       = 0
 }
 
 widget "*GimpDisplayShell.*" style "gimp-display-style"

Modified: trunk/themes/Small/gtkrc
==============================================================================
--- trunk/themes/Small/gtkrc	(original)
+++ trunk/themes/Small/gtkrc	Thu Sep 18 09:33:20 2008
@@ -30,38 +30,41 @@
       { "../Default/images/stock-warning-64.png", *, *, "gtk-dialog" }
     }
 
+# Uncommenting this line allows to set a different (smaller) font for GIMP.
+#
 # font_name = "sans 8"
 
 # Enabling the following line for some reason breaks toolbox resize
 # increment calculation. You can enable it to get an even smaller GUI
 # but need to restart GIMP after the theme change.
 #
-# GtkWidget::focus_padding         = 0
+# GtkWidget::focus-padding         = 0
 
-  GtkOptionMenu::indicator_size    = { 5, 11 }
-  GtkOptionMenu::indicator_spacing = { 4, 3, 1, 1 }
+  GtkOptionMenu::indicator-size    = { 5, 11 }
+  GtkOptionMenu::indicator-spacing = { 4, 3, 1, 1 }
 
-  GtkPaned::handle_size             = 5
-  GimpDock::default_height          = 240
+  GtkPaned::handle-size             = 5
+  GimpDock::default-height          = 240
+  GimpDock::font-scale              = 0.8333
   GimpDockSeparator::height         = 5
-  GimpMenuDock::minimal_width       = 200
-  GimpMenuDock::menu_preview_size   = small-toolbar
-  GimpToolbox::tool_icon_size       = menu
-  GimpToolbox::button_relief        = none
-  GimpDockbook::tab_border          = 0
-  GimpDockbook::tab_icon_size       = menu
-  GimpColorNotebook::tab_border     = 0
-  GimpColorNotebook::tab_icon_size  = menu
-  GimpDockable::content_border      = 1
-  GimpEditor::content_spacing       = 1
-  GimpEditor::button_spacing        = 1
-  GimpEditor::button_icon_size      = menu
-  GimpDataEditor::minimal_height    = 64
-  GimpFrame::label_spacing          = 2
-  GtkDialog::content_area_border    = 0
-  GtkDialog::button_spacing         = 6
-  GtkDialog::action_area_border     = 12
-  GimpUnitComboBox::appears_as_list = 0
+  GimpMenuDock::minimal-width       = 200
+  GimpMenuDock::menu-preview-size   = small-toolbar
+  GimpToolbox::tool-icon-size       = menu
+  GimpToolbox::button-relief        = none
+  GimpDockbook::tab-border          = 0
+  GimpDockbook::tab-icon-size       = menu
+  GimpColorNotebook::tab-border     = 0
+  GimpColorNotebook::tab-icon-size  = menu
+  GimpDockable::content-border      = 1
+  GimpEditor::content-spacing       = 1
+  GimpEditor::button-spacing        = 1
+  GimpEditor::button-icon-size      = menu
+  GimpDataEditor::minimal-height    = 64
+  GimpFrame::label-spacing          = 2
+  GtkDialog::content-area-border    = 0
+  GtkDialog::button-spacing         = 6
+  GtkDialog::action-area-border     = 12
+  GimpUnitComboBox::appears-as-list = 0
 }
 
 class "GtkWidget" style "gimp-default-style"
@@ -69,7 +72,7 @@
 
 style "gimp-tool-dialog-style" = "gimp-default-style"
 {
-  GtkDialog::action_area_border = 6
+  GtkDialog::action-area-border = 6
 }
 
 class "GimpToolDialog" style "gimp-tool-dialog-style"
@@ -85,9 +88,9 @@
 
 style "gimp-dockable-style" = "gimp-default-style"
 {
-  GimpFrame::label_bold       = 0
-  GtkButton::focus_line_width = 1
-  GtkButton::focus_padding    = 0
+  GimpFrame::label-bold       = 0
+  GtkButton::focus-line_width = 1
+  GtkButton::focus-padding    = 0
 }
 
 widget "*GimpDockable.*" style "gimp-dockable-style"
@@ -99,8 +102,8 @@
   GimpScaleComboBox::label-scale = 0.8333
   GtkComboBox::arrow-size        = 8
   GtkButton::inner-border        = { 0, 0, 0, 0 }
-  GtkButton::focus_line_width    = 0
-  GtkButton::focus_padding       = 0
+  GtkButton::focus-line-width    = 0
+  GtkButton::focus-padding       = 0
 }
 
 widget "*GimpDisplayShell.*" style "gimp-display-style"



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]