gimp r26848 - in branches/soc-2008-text: . app/base app/core app/dialogs app/display app/paint-funcs app/plug-in app/widgets devel-docs devel-docs/libgimpwidgets devel-docs/libgimpwidgets/tmpl libgimpwidgets modules plug-ins po po-libgimp po-plug-ins po-python po-script-fu po-tips tools



Author: danedde
Date: Wed Sep  3 21:19:34 2008
New Revision: 26848
URL: http://svn.gnome.org/viewvc/gimp?rev=26848&view=rev

Log:
2008-09-03  Daniel Eddeland <danedde svn gnome org>

	Merged 26806:26837 from trunk, and tried
	to fix oddities in svn.



Added:
   branches/soc-2008-text/po-libgimp/LINGUAS
      - copied unchanged from r26837, /trunk/po-libgimp/LINGUAS
   branches/soc-2008-text/po-plug-ins/LINGUAS
      - copied unchanged from r26837, /trunk/po-plug-ins/LINGUAS
   branches/soc-2008-text/po-python/LINGUAS
      - copied unchanged from r26837, /trunk/po-python/LINGUAS
   branches/soc-2008-text/po-script-fu/LINGUAS
      - copied unchanged from r26837, /trunk/po-script-fu/LINGUAS
   branches/soc-2008-text/po-tips/LINGUAS
      - copied unchanged from r26837, /trunk/po-tips/LINGUAS
   branches/soc-2008-text/po/LINGUAS
      - copied unchanged from r26837, /trunk/po/LINGUAS
   branches/soc-2008-text/po/zh_HK.po
      - copied unchanged from r26837, /trunk/po/zh_HK.po
Removed:
   branches/soc-2008-text/devel-docs/libgimpwidgets/tmpl/gimphruler.sgml
   branches/soc-2008-text/devel-docs/libgimpwidgets/tmpl/gimpvruler.sgml
   branches/soc-2008-text/libgimpwidgets/gimphruler.c
   branches/soc-2008-text/libgimpwidgets/gimphruler.h
   branches/soc-2008-text/libgimpwidgets/gimpvruler.c
   branches/soc-2008-text/libgimpwidgets/gimpvruler.h
   branches/soc-2008-text/modules/controller-dx-input.c
   branches/soc-2008-text/plug-ins/
   branches/soc-2008-text/po-libgimp/tt.po
   branches/soc-2008-text/po-plug-ins/eo.po
   branches/soc-2008-text/po-plug-ins/tt.po
   branches/soc-2008-text/po-python/he.po
   branches/soc-2008-text/po-python/id.po
   branches/soc-2008-text/po-python/tt.po
   branches/soc-2008-text/po-python/yi.po
   branches/soc-2008-text/po-script-fu/tt.po
   branches/soc-2008-text/po-tips/el.po
   branches/soc-2008-text/po-tips/ga.po
   branches/soc-2008-text/po-tips/id.po
   branches/soc-2008-text/po-tips/oc.po
   branches/soc-2008-text/po-tips/tr.po
   branches/soc-2008-text/po-tips/tt.po
   branches/soc-2008-text/po-tips/xh.po
   branches/soc-2008-text/po-tips/yi.po
Modified:
   branches/soc-2008-text/AUTHORS
   branches/soc-2008-text/ChangeLog
   branches/soc-2008-text/app/base/tile-manager-crop.c
   branches/soc-2008-text/app/core/gimp-transform-region.c
   branches/soc-2008-text/app/core/gimpbrushclipboard.c
   branches/soc-2008-text/app/core/gimpbuffer.c
   branches/soc-2008-text/app/core/gimpbuffer.h
   branches/soc-2008-text/app/core/gimpchannel.c
   branches/soc-2008-text/app/core/gimpimage-crop.c
   branches/soc-2008-text/app/core/gimpimage-merge.c
   branches/soc-2008-text/app/core/gimpimage-resize.c
   branches/soc-2008-text/app/core/gimpimage-rotate.c
   branches/soc-2008-text/app/core/gimpimage-scale.c
   branches/soc-2008-text/app/core/gimpimage-undo-push.c
   branches/soc-2008-text/app/core/gimpimage-undo-push.h
   branches/soc-2008-text/app/core/gimpimage-undo.c
   branches/soc-2008-text/app/core/gimpimage.c
   branches/soc-2008-text/app/core/gimpimage.h
   branches/soc-2008-text/app/core/gimpmaskundo.c
   branches/soc-2008-text/app/core/gimpprojection-construct.c
   branches/soc-2008-text/app/core/gimpundo.h
   branches/soc-2008-text/app/dialogs/resolution-calibrate-dialog.c
   branches/soc-2008-text/app/display/gimpdisplayshell-scale.c
   branches/soc-2008-text/app/display/gimpdisplayshell.c
   branches/soc-2008-text/app/display/gimpstatusbar.c
   branches/soc-2008-text/app/paint-funcs/paint-funcs.c
   branches/soc-2008-text/app/paint-funcs/paint-funcs.h
   branches/soc-2008-text/app/plug-in/gimppluginshm.c
   branches/soc-2008-text/app/widgets/gimphelp.c
   branches/soc-2008-text/app/widgets/gimplayertreeview.c
   branches/soc-2008-text/app/widgets/gimpselectiondata.c
   branches/soc-2008-text/authors.xml
   branches/soc-2008-text/configure.in
   branches/soc-2008-text/devel-docs/ChangeLog
   branches/soc-2008-text/devel-docs/libgimpwidgets/libgimpwidgets-docs.sgml
   branches/soc-2008-text/devel-docs/libgimpwidgets/libgimpwidgets-sections.txt
   branches/soc-2008-text/devel-docs/libgimpwidgets/libgimpwidgets.types
   branches/soc-2008-text/devel-docs/libgimpwidgets/tmpl/gimpruler.sgml
   branches/soc-2008-text/libgimpwidgets/Makefile.am
   branches/soc-2008-text/libgimpwidgets/gimpcolorscales.c
   branches/soc-2008-text/libgimpwidgets/gimppreviewarea.c
   branches/soc-2008-text/libgimpwidgets/gimppropwidgets.c
   branches/soc-2008-text/libgimpwidgets/gimpruler.c
   branches/soc-2008-text/libgimpwidgets/gimpruler.h
   branches/soc-2008-text/libgimpwidgets/gimpscaleentry.c
   branches/soc-2008-text/libgimpwidgets/gimpwidgets.c
   branches/soc-2008-text/libgimpwidgets/gimpwidgets.def
   branches/soc-2008-text/libgimpwidgets/gimpwidgets.h
   branches/soc-2008-text/po-libgimp/ChangeLog
   branches/soc-2008-text/po-libgimp/ro.po
   branches/soc-2008-text/po-plug-ins/ChangeLog
   branches/soc-2008-text/po-plug-ins/ro.po
   branches/soc-2008-text/po-python/ChangeLog
   branches/soc-2008-text/po-python/ro.po
   branches/soc-2008-text/po-script-fu/ChangeLog
   branches/soc-2008-text/po-script-fu/ro.po
   branches/soc-2008-text/po-tips/ChangeLog
   branches/soc-2008-text/po-tips/ro.po
   branches/soc-2008-text/po/ChangeLog
   branches/soc-2008-text/po/ga.po
   branches/soc-2008-text/po/ro.po
   branches/soc-2008-text/po/zh_TW.po
   branches/soc-2008-text/tools/test-clipboard.c

Modified: branches/soc-2008-text/AUTHORS
==============================================================================
--- branches/soc-2008-text/AUTHORS	(original)
+++ branches/soc-2008-text/AUTHORS	Wed Sep  3 21:19:34 2008
@@ -48,7 +48,6 @@
  Alexia Death
  Brian Degenhardt
  Karine Delvare
- Aurore Derriennic
  Andreas Dilger
  Austin Donnelly
  Scott Draves
@@ -229,6 +228,7 @@
 
  Lapo Calamandrei
  Paul Davey
+ Aurore Derriennic
  Tuomas Kuosmanen
  Karl La Rocca
  Andreas Nilsson

Modified: branches/soc-2008-text/app/base/tile-manager-crop.c
==============================================================================
--- branches/soc-2008-text/app/base/tile-manager-crop.c	(original)
+++ branches/soc-2008-text/app/base/tile-manager-crop.c	Wed Sep  3 21:19:34 2008
@@ -35,14 +35,13 @@
 tile_manager_crop (TileManager *tiles,
                    gint         border)
 {
-  PixelRegion   PR;
-  TileManager  *new_tiles;
-  gint          bytes, alpha;
-  gint          x1, y1, x2, y2;
-  gboolean      found;
-  gboolean      empty;
-  gpointer      pr;
-  const guchar  black[MAX_CHANNELS] = { 0, 0, 0, 0 };
+  PixelRegion  region;
+  TileManager *new_tiles;
+  gint         bytes, alpha;
+  gint         x1, y1, x2, y2;
+  gboolean     found;
+  gboolean     empty;
+  gpointer     pr;
 
   g_return_val_if_fail (tiles != NULL, NULL);
 
@@ -55,22 +54,22 @@
   x2 = 0;
   y2 = 0;
 
-  pixel_region_init (&PR, tiles, 0, 0, x1, y1, FALSE);
+  pixel_region_init (&region, tiles, 0, 0, x1, y1, FALSE);
 
-  for (pr = pixel_regions_register (1, &PR);
+  for (pr = pixel_regions_register (1, &region);
        pr != NULL;
        pr = pixel_regions_process (pr))
     {
-      const guchar *data = PR.data + alpha;
-      gint          ex   = PR.x + PR.w;
-      gint          ey   = PR.y + PR.h;
+      const guchar *data = region.data + alpha;
+      gint          ex   = region.x + region.w;
+      gint          ey   = region.y + region.h;
       gint          x, y;
 
-      for (y = PR.y; y < ey; y++)
+      for (y = region.y; y < ey; y++)
         {
           found = FALSE;
 
-          for (x = PR.x; x < ex; x++, data += bytes)
+          for (x = region.x; x < ex; x++, data += bytes)
             if (*data)
               {
                 if (x < x1)
@@ -129,22 +128,22 @@
           pixel_region_init (&destPR, new_tiles,
                              0, 0, new_width, border,
                              TRUE);
-          color_region (&destPR, black);
+          clear_region (&destPR);
 
           pixel_region_init (&destPR, new_tiles,
                              0, border, border, (y2 - y1),
                              TRUE);
-          color_region (&destPR, black);
+          clear_region (&destPR);
 
           pixel_region_init (&destPR, new_tiles,
                              new_width - border, border, border, (y2 - y1),
                              TRUE);
-          color_region (&destPR, black);
+          clear_region (&destPR);
 
           pixel_region_init (&destPR, new_tiles,
                              0, new_height - border, new_width, border,
                              TRUE);
-          color_region (&destPR, black);
+          clear_region (&destPR);
         }
 
       pixel_region_init (&srcPR, tiles,

Modified: branches/soc-2008-text/app/core/gimp-transform-region.c
==============================================================================
--- branches/soc-2008-text/app/core/gimp-transform-region.c	(original)
+++ branches/soc-2008-text/app/core/gimp-transform-region.c	Wed Sep  3 21:19:34 2008
@@ -117,51 +117,50 @@
                                             gdouble           *u,
                                             gdouble           *v);
 
-static inline gboolean supersample_dtest   (gdouble u0,
-                                            gdouble v0,
-                                            gdouble u1,
-                                            gdouble v1,
-                                            gdouble u2,
-                                            gdouble v2,
-                                            gdouble u3,
-                                            gdouble v3);
-
-static void     sample_adapt      (TileManager   *tm,
-                                   gdouble        uc,
-                                   gdouble        vc,
-                                   gdouble        u0,
-                                   gdouble        v0,
-                                   gdouble        u1,
-                                   gdouble        v1,
-                                   gdouble        u2,
-                                   gdouble        v2,
-                                   gdouble        u3,
-                                   gdouble        v3,
-                                   gint           level,
+static inline gboolean supersample_dtest   (const gdouble u0,
+                                            const gdouble v0,
+                                            const gdouble u1,
+                                            const gdouble v1,
+                                            const gdouble u2,
+                                            const gdouble v2,
+                                            const gdouble u3,
+                                            const gdouble v3);
+
+static void     sample_adapt      (PixelSurround *surround,
+                                   const gdouble  uc,
+                                   const gdouble  vc,
+                                   const gdouble  u0,
+                                   const gdouble  v0,
+                                   const gdouble  u1,
+                                   const gdouble  v1,
+                                   const gdouble  u2,
+                                   const gdouble  v2,
+                                   const gdouble  u3,
+                                   const gdouble  v3,
+                                   const  gint    level,
                                    guchar        *color,
-                                   const guchar  *bg_color,
-                                   gint           bpp,
-                                   gint           alpha);
+                                   const gint     bpp,
+                                   const gint     alpha);
 
 static void     sample_linear     (PixelSurround *surround,
-                                   gdouble        u,
-                                   gdouble        v,
+                                   const gdouble  u,
+                                   const gdouble  v,
                                    guchar        *color,
-                                   gint           bytes,
-                                   gint           alpha);
+                                   const gint     bytes,
+                                   const gint     alpha);
 static void     sample_cubic      (PixelSurround *surround,
-                                   gdouble        u,
-                                   gdouble        v,
+                                   const gdouble  u,
+                                   const gdouble  v,
                                    guchar        *color,
-                                   gint           bytes,
-                                   gint           alpha);
+                                   const gint     bytes,
+                                   const gint     alpha);
 static void     sample_lanczos    (PixelSurround *surround,
                                    const gfloat  *lanczos,
-                                   gdouble        u,
-                                   gdouble        v,
+                                   const gdouble  u,
+                                   const gdouble  v,
                                    guchar        *color,
-                                   gint           bytes,
-                                   gint           alpha);
+                                   const gint     bytes,
+                                   const gint     alpha);
 
 
 /*  public functions  */
@@ -394,7 +393,8 @@
   gint           n;
   gpointer       pr;
 
-  surround = pixel_surround_new (orig_tiles, 2, 2, bg_color);
+  surround = pixel_surround_new (orig_tiles, 2, 2, PIXEL_SURROUND_BACKGROUND);
+  pixel_surround_set_bg (surround, bg_color);
 
   uinc = m->coeff[0][0];
   vinc = m->coeff[1][0];
@@ -431,14 +431,14 @@
               if (supersample_dtest (u[1], v[1], u[2], v[2],
                                      u[3], v[3], u[4], v[4]))
                 {
-                  sample_adapt (orig_tiles,
+                  sample_adapt (surround,
                                 u[0] - u1, v[0] - v1,
                                 u[1] - u1, v[1] - v1,
                                 u[2] - u1, v[2] - v1,
                                 u[3] - u1, v[3] - v1,
                                 u[4] - u1, v[4] - v1,
                                 recursion_level,
-                                d, bg_color, destPR->bytes, alpha);
+                                d, destPR->bytes, alpha);
                 }
               else
                 {
@@ -496,7 +496,8 @@
   gint           n;
   gpointer       pr;
 
-  surround = pixel_surround_new (orig_tiles, 4, 4, bg_color);
+  surround = pixel_surround_new (orig_tiles, 4, 4, PIXEL_SURROUND_BACKGROUND);
+  pixel_surround_set_bg (surround, bg_color);
 
   uinc = m->coeff[0][0];
   vinc = m->coeff[1][0];
@@ -532,14 +533,14 @@
               if (supersample_dtest (u[1], v[1], u[2], v[2],
                                      u[3], v[3], u[4], v[4]))
                 {
-                  sample_adapt (orig_tiles,
+                  sample_adapt (surround,
                                 u[0] - u1, v[0] - v1,
                                 u[1] - u1, v[1] - v1,
                                 u[2] - u1, v[2] - v1,
                                 u[3] - u1, v[3] - v1,
                                 u[4] - u1, v[4] - v1,
                                 recursion_level,
-                                d, bg_color, destPR->bytes, alpha);
+                                d, destPR->bytes, alpha);
                 }
               else
                 {
@@ -599,7 +600,9 @@
   gpointer       pr;
 
   surround = pixel_surround_new (orig_tiles,
-                                 LANCZOS_WIDTH2, LANCZOS_WIDTH2, bg_color);
+                                 LANCZOS_WIDTH2, LANCZOS_WIDTH2,
+                                 PIXEL_SURROUND_BACKGROUND);
+  pixel_surround_set_bg (surround, bg_color);
 
   /* allocate and fill lanczos lookup table */
   lanczos = create_lanczos_lookup ();
@@ -638,14 +641,14 @@
               if (supersample_dtest (u[1], v[1], u[2], v[2],
                                      u[3], v[3], u[4], v[4]))
                 {
-                  sample_adapt (orig_tiles,
+                  sample_adapt (surround,
                                 u[0] - u1, v[0] - v1,
                                 u[1] - u1, v[1] - v1,
                                 u[2] - u1, v[2] - v1,
                                 u[3] - u1, v[3] - v1,
                                 u[4] - u1, v[4] - v1,
                                 recursion_level,
-                                d, bg_color, destPR->bytes, alpha);
+                                d, destPR->bytes, alpha);
                 }
               else
                 {
@@ -685,8 +688,8 @@
 
 static inline void
 untransform_coords (const GimpMatrix3 *m,
-                    gint               x,
-                    gint               y,
+                    const gint         x,
+                    const gint         y,
                     gdouble           *tu,
                     gdouble           *tv,
                     gdouble           *tw)
@@ -751,16 +754,16 @@
    */
 static void
 sample_linear (PixelSurround *surround,
-               gdouble        u,
-               gdouble        v,
+               const gdouble  u,
+               const gdouble  v,
                guchar        *color,
-               gint           bytes,
-               gint           alpha)
+               const gint     bytes,
+               const gint     alpha)
 {
   gdouble       a_val, a_recip;
   gint          i;
-  gint          iu = floor (u);
-  gint          iv = floor (v);
+  const gint    iu = floor (u);
+  const gint    iv = floor (v);
   gint          rowstride;
   gdouble       du, dv;
   const guchar *alphachan;
@@ -835,56 +838,42 @@
     bilinear interpolation of a fixed point pixel
 */
 static void
-sample_bi (TileManager  *tm,
-           gint          x,
-           gint          y,
-           guchar       *color,
-           const guchar *bg_color,
-           gint          bpp,
-           gint          alpha)
+sample_bi (PixelSurround *surround,
+           const gint     x,
+           const gint     y,
+           guchar        *color,
+           const gint     bpp,
+           const gint     alpha)
 {
-  guchar C[4][4];
-  gint   i;
-  gint   xscale = (x & (FIXED_UNIT-1));
-  gint   yscale = (y & (FIXED_UNIT-1));
-
-  gint   x0 = x >> FIXED_SHIFT;
-  gint   y0 = y >> FIXED_SHIFT;
-  gint   x1 = x0 + 1;
-  gint   y1 = y0 + 1;
-
-
-  /*  fill the color with default values, since read_pixel_data_1
-   *  does nothing, when accesses are out of bounds.
-   */
-  for (i = 0; i < 4; i++)
-    *(guint*) (&C[i]) = *(guint*) (bg_color);
-
-  read_pixel_data_1 (tm, x0, y0, C[0]);
-  read_pixel_data_1 (tm, x1, y0, C[2]);
-  read_pixel_data_1 (tm, x0, y1, C[1]);
-  read_pixel_data_1 (tm, x1, y1, C[3]);
+  const gint    xscale = x & (FIXED_UNIT - 1);
+  const gint    yscale = y & (FIXED_UNIT - 1);
+  const gint    x0     = x >> FIXED_SHIFT;
+  const gint    y0     = y >> FIXED_SHIFT;
+  gint          rowstride;
+  const guchar *src    = pixel_surround_lock (surround, x0, y0, &rowstride);
+  const guchar *s0     = src;
+  const guchar *s1     = src + bpp;
+  const guchar *s2     = src + rowstride;
+  const guchar *s3     = src + rowstride + bpp;
+  gint          i;
 
 #define lerp(v1, v2, r) \
         (((guint)(v1) * (FIXED_UNIT - (guint)(r)) + \
           (guint)(v2) * (guint)(r)) >> FIXED_SHIFT)
 
-  color[alpha]= lerp (lerp (C[0][alpha], C[1][alpha], yscale),
-                      lerp (C[2][alpha], C[3][alpha], yscale), xscale);
+  color[alpha]= lerp (lerp (s0[alpha], s1[alpha], yscale),
+                      lerp (s2[alpha], s3[alpha], yscale), xscale);
 
   if (color[alpha])
-    { /* to avoid problems, calculate with premultiplied alpha */
+    {
+      /* to avoid problems, calculate with premultiplied alpha */
       for (i = 0; i < alpha; i++)
         {
-          C[0][i] = (C[0][i] * C[0][alpha] / 255);
-          C[1][i] = (C[1][i] * C[1][alpha] / 255);
-          C[2][i] = (C[2][i] * C[2][alpha] / 255);
-          C[3][i] = (C[3][i] * C[3][alpha] / 255);
+          color[i] = lerp (lerp (s0[i] * s0[alpha] / 255,
+                                 s1[i] * s1[alpha] / 255, yscale),
+                           lerp (s2[i] * s2[alpha] / 255,
+                                 s3[i] * s3[alpha] / 255, yscale), xscale);
         }
-
-      for (i = 0; i < alpha; i++)
-        color[i] = lerp (lerp (C[0][i], C[1][i], yscale),
-                         lerp (C[2][i], C[3][i], yscale), xscale);
     }
   else
     {
@@ -902,10 +891,10 @@
  * subdivision should be used.
  */
 static inline gboolean
-supersample_test (gint x0, gint y0,
-                  gint x1, gint y1,
-                  gint x2, gint y2,
-                  gint x3, gint y3)
+supersample_test (const gint x0, const gint y0,
+                  const gint x1, const gint y1,
+                  const gint x2, const gint y2,
+                  const gint x3, const gint y3)
 {
   return (abs (x0 - x1) > FIXED_UNIT ||
           abs (x1 - x2) > FIXED_UNIT ||
@@ -925,10 +914,10 @@
  * rotations.
  */
 static inline gboolean
-supersample_dtest (gdouble x0, gdouble y0,
-                   gdouble x1, gdouble y1,
-                   gdouble x2, gdouble y2,
-                   gdouble x3, gdouble y3)
+supersample_dtest (const gdouble x0, const gdouble y0,
+                   const gdouble x1, const gdouble y1,
+                   const gdouble x2, const gdouble y2,
+                   const gdouble x3, const gdouble y3)
 {
   return (fabs (x0 - x1) > G_SQRT2 ||
           fabs (x1 - x2) > G_SQRT2 ||
@@ -947,30 +936,29 @@
     0..3 is a cycle around the quad
 */
 static void
-get_sample (TileManager  *tm,
-            gint          xc,
-            gint          yc,
-            gint          x0,
-            gint          y0,
-            gint          x1,
-            gint          y1,
-            gint          x2,
-            gint          y2,
-            gint          x3,
-            gint          y3,
-            gint         *cc,
-            gint          level,
-            guint        *color,
-            const guchar *bg_color,
-            gint          bpp,
-            gint          alpha)
+get_sample (PixelSurround *surround,
+            const gint     xc,
+            const gint     yc,
+            const gint     x0,
+            const gint     y0,
+            const gint     x1,
+            const gint     y1,
+            const gint     x2,
+            const gint     y2,
+            const gint     x3,
+            const gint     y3,
+            gint          *cc,
+            const gint     level,
+            guint         *color,
+            const gint     bpp,
+            const gint     alpha)
 {
   if (!level || !supersample_test (x0, y0, x1, y1, x2, y2, x3, y3))
     {
       gint   i;
       guchar C[4];
 
-      sample_bi (tm, xc, yc, C, bg_color, bpp, alpha);
+      sample_bi (surround, xc, yc, C, bpp, alpha);
 
       for (i = 0; i < bpp; i++)
         color[i]+= C[i];
@@ -1004,45 +992,44 @@
       bry = (y2 + yc) / 2;
       by  = (y3 + y2) / 2;
 
-      get_sample (tm,
+      get_sample (surround,
                   tlx,tly,
                   x0,y0, tx,ty, xc,yc, lx,ly,
-                  cc, level-1, color, bg_color, bpp, alpha);
+                  cc, level-1, color, bpp, alpha);
 
-      get_sample (tm,
+      get_sample (surround,
                   trx,try,
                   tx,ty, x1,y1, rx,ry, xc,yc,
-                  cc, level-1, color, bg_color, bpp, alpha);
+                  cc, level-1, color, bpp, alpha);
 
-      get_sample (tm,
+      get_sample (surround,
                   brx,bry,
                   xc,yc, rx,ry, x2,y2, bx,by,
-                  cc, level-1, color, bg_color, bpp, alpha);
+                  cc, level-1, color, bpp, alpha);
 
-      get_sample (tm,
+      get_sample (surround,
                   blx,bly,
                   lx,ly, xc,yc, bx,by, x3,y3,
-                  cc, level-1, color, bg_color, bpp, alpha);
+                  cc, level-1, color, bpp, alpha);
     }
 }
 
 static void
-sample_adapt (TileManager  *tm,
-              gdouble       xc,
-              gdouble       yc,
-              gdouble       x0,
-              gdouble       y0,
-              gdouble       x1,
-              gdouble       y1,
-              gdouble       x2,
-              gdouble       y2,
-              gdouble       x3,
-              gdouble       y3,
-              gint          level,
-              guchar       *color,
-              const guchar *bg_color,
-              gint          bpp,
-              gint          alpha)
+sample_adapt (PixelSurround *surround,
+              const gdouble  xc,
+              const gdouble  yc,
+              const gdouble  x0,
+              const gdouble  y0,
+              const gdouble  x1,
+              const gdouble  y1,
+              const gdouble  x2,
+              const gdouble  y2,
+              const gdouble  x3,
+              const gdouble  y3,
+              const gint     level,
+              guchar        *color,
+              const gint     bpp,
+              const gint     alpha)
 {
     gint  cc = 0;
     gint  i;
@@ -1050,13 +1037,13 @@
 
     C[0] = C[1] = C[2] = C[3] = 0;
 
-    get_sample (tm,
+    get_sample (surround,
                 DOUBLE2FIXED (xc), DOUBLE2FIXED (yc),
                 DOUBLE2FIXED (x0), DOUBLE2FIXED (y0),
                 DOUBLE2FIXED (x1), DOUBLE2FIXED (y1),
                 DOUBLE2FIXED (x2), DOUBLE2FIXED (y2),
                 DOUBLE2FIXED (x3), DOUBLE2FIXED (y3),
-                &cc, level, C, bg_color, bpp, alpha);
+                &cc, level, C, bpp, alpha);
 
     if (!cc)
       cc=1;
@@ -1092,11 +1079,11 @@
 /*  Note: cubic function no longer clips result. */
 /*  Inlining this function makes sample_cubic() run about 10% faster. (Sven) */
 static inline gdouble
-gimp_drawable_transform_cubic (gdouble dx,
-                               gint    jm1,
-                               gint    j,
-                               gint    jp1,
-                               gint    jp2)
+gimp_drawable_transform_cubic (const gdouble dx,
+                               const gint    jm1,
+                               const gint    j,
+                               const gint    jp1,
+                               const gint    jp2)
 {
   gdouble result;
 
@@ -1127,18 +1114,18 @@
    */
 static void
 sample_cubic (PixelSurround *surround,
-              gdouble        u,
-              gdouble        v,
+              const gdouble  u,
+              const gdouble  v,
               guchar        *color,
-              gint           bytes,
-              gint           alpha)
+              const gint     bytes,
+              const gint     alpha)
 {
   gdouble       a_val, a_recip;
   gint          i;
-  gint          iu = floor(u);
-  gint          iv = floor(v);
-  gint          rowstride;
+  const gint    iu = floor(u);
+  const gint    iv = floor(v);
   gdouble       du, dv;
+  gint          rowstride;
   const guchar *data;
 
   /* lock the pixel surround */
@@ -1207,11 +1194,11 @@
 static void
 sample_lanczos (PixelSurround *surround,
                 const gfloat  *lanczos,
-                gdouble        u,
-                gdouble        v,
+                const gdouble  u,
+                const gdouble  v,
                 guchar        *color,
-                gint           bytes,
-                gint           alpha)
+                const gint     bytes,
+                const gint     alpha)
 {
   gdouble       x_kernel[LANCZOS_WIDTH2]; /* 1-D kernels of window coeffs */
   gdouble       y_kernel[LANCZOS_WIDTH2];

Modified: branches/soc-2008-text/app/core/gimpbrushclipboard.c
==============================================================================
--- branches/soc-2008-text/app/core/gimpbrushclipboard.c	(original)
+++ branches/soc-2008-text/app/core/gimpbrushclipboard.c	Wed Sep  3 21:19:34 2008
@@ -207,7 +207,7 @@
 
   if (gimp->global_buffer)
     {
-      TileManager   *tiles = gimp->global_buffer->tiles;
+      TileManager   *tiles = gimp_buffer_get_tiles (gimp->global_buffer);
       GimpImageType  type  = gimp_buffer_get_image_type (gimp->global_buffer);
 
       width  = MIN (gimp_buffer_get_width  (gimp->global_buffer), 512);

Modified: branches/soc-2008-text/app/core/gimpbuffer.c
==============================================================================
--- branches/soc-2008-text/app/core/gimpbuffer.c	(original)
+++ branches/soc-2008-text/app/core/gimpbuffer.c	Wed Sep  3 21:19:34 2008
@@ -327,3 +327,11 @@
 
   return 0;
 }
+
+TileManager *
+gimp_buffer_get_tiles (const GimpBuffer *buffer)
+{
+  g_return_val_if_fail (GIMP_IS_BUFFER (buffer), NULL);
+
+  return buffer->tiles;
+}

Modified: branches/soc-2008-text/app/core/gimpbuffer.h
==============================================================================
--- branches/soc-2008-text/app/core/gimpbuffer.h	(original)
+++ branches/soc-2008-text/app/core/gimpbuffer.h	Wed Sep  3 21:19:34 2008
@@ -59,6 +59,7 @@
 
 gint            gimp_buffer_get_bytes       (const GimpBuffer *buffer);
 GimpImageType   gimp_buffer_get_image_type  (const GimpBuffer *buffer);
+TileManager   * gimp_buffer_get_tiles       (const GimpBuffer *buffer);
 
 
 #endif /* __GIMP_BUFFER_H__ */

Modified: branches/soc-2008-text/app/core/gimpchannel.c
==============================================================================
--- branches/soc-2008-text/app/core/gimpchannel.c	(original)
+++ branches/soc-2008-text/app/core/gimpchannel.c	Wed Sep  3 21:19:34 2008
@@ -494,7 +494,6 @@
   GimpChannel *tmp_mask = NULL;
   gint         width, height;
   PixelRegion  srcPR, destPR;
-  guchar       empty = TRANSPARENT_OPACITY;
   gint         x1, y1, x2, y2;
 
   gimp_channel_bounds (channel, &x1, &y1, &x2, &y2);
@@ -539,7 +538,7 @@
                      0, 0,
                      gimp_item_width  (GIMP_ITEM (channel)),
                      gimp_item_height (GIMP_ITEM (channel)), TRUE);
-  color_region (&srcPR, &empty);
+  clear_region (&srcPR);
 
   if (width != 0 && height != 0)
     {
@@ -1195,7 +1194,6 @@
                          gboolean     push_undo)
 {
   PixelRegion maskPR;
-  guchar      bg = TRANSPARENT_OPACITY;
 
   if (push_undo)
     {
@@ -1216,7 +1214,7 @@
                          channel->x1, channel->y1,
                          channel->x2 - channel->x1,
                          channel->y2 - channel->y1, TRUE);
-      color_region (&maskPR, &bg);
+      clear_region (&maskPR);
     }
   else
     {
@@ -1226,7 +1224,7 @@
                          0, 0,
                          gimp_item_width  (GIMP_ITEM (channel)),
                          gimp_item_height (GIMP_ITEM (channel)), TRUE);
-      color_region (&maskPR, &bg);
+      clear_region (&maskPR);
     }
 
   /*  we know the bounds  */
@@ -1247,7 +1245,6 @@
                        gboolean     push_undo)
 {
   PixelRegion maskPR;
-  guchar      bg = OPAQUE_OPACITY;
 
   if (push_undo)
     gimp_channel_push_undo (channel,
@@ -1261,7 +1258,7 @@
                      0, 0,
                      gimp_item_width  (GIMP_ITEM (channel)),
                      gimp_item_height (GIMP_ITEM (channel)), TRUE);
-  color_region (&maskPR, &bg);
+  clear_region (&maskPR);
 
   /*  we know the bounds  */
   channel->bounds_known = TRUE;

Modified: branches/soc-2008-text/app/core/gimpimage-crop.c
==============================================================================
--- branches/soc-2008-text/app/core/gimpimage-crop.c	(original)
+++ branches/soc-2008-text/app/core/gimpimage-crop.c	Wed Sep  3 21:19:34 2008
@@ -87,10 +87,14 @@
                  gboolean     crop_layers)
 {
   gint width, height;
+  gint previous_width, previous_height;
 
   g_return_if_fail (GIMP_IS_IMAGE (image));
   g_return_if_fail (GIMP_IS_CONTEXT (context));
 
+  previous_width  = gimp_image_get_width (image);
+  previous_height = gimp_image_get_height (image);
+
   width  = x2 - x1;
   height = y2 - y1;
 
@@ -129,7 +133,12 @@
                                      _("Resize Image"));
 
       /*  Push the image size to the stack  */
-      gimp_image_undo_push_image_size (image, NULL, x1, y1);
+      gimp_image_undo_push_image_size (image,
+                                       NULL,
+                                       x1,
+                                       y1,
+                                       width,
+                                       height);
 
       /*  Set the new width and height  */
       g_object_set (image,
@@ -267,7 +276,11 @@
                          gimp_image_get_width  (image),
                          gimp_image_get_height (image));
 
-      gimp_image_size_changed_detailed (image, -x1, -y1);
+      gimp_image_size_changed_detailed (image,
+                                        -x1,
+                                        -y1,
+                                        previous_width,
+                                        previous_height);
 
       g_object_thaw_notify (G_OBJECT (image));
     }

Modified: branches/soc-2008-text/app/core/gimpimage-merge.c
==============================================================================
--- branches/soc-2008-text/app/core/gimpimage-merge.c	(original)
+++ branches/soc-2008-text/app/core/gimpimage-merge.c	Wed Sep  3 21:19:34 2008
@@ -319,7 +319,6 @@
   GimpLayer       *merge_layer;
   GimpLayer       *layer;
   GimpLayer       *bottom_layer;
-  guchar           bg[4] = {0, 0, 0, 0};
   GimpImageType    type;
   gint             count;
   gint             x1, y1, x2, y2;
@@ -418,6 +417,8 @@
   if (merge_type == GIMP_FLATTEN_IMAGE ||
       gimp_drawable_type (GIMP_DRAWABLE (layer)) == GIMP_INDEXED_IMAGE)
     {
+      guchar bg[4] = { 0, 0, 0, 0 };
+
       type = GIMP_IMAGE_TYPE_FROM_BASE_TYPE (gimp_image_base_type (image));
 
       merge_layer = gimp_layer_new (image, (x2 - x1), (y2 - y1),
@@ -471,15 +472,13 @@
       GIMP_ITEM (merge_layer)->offset_x = x1;
       GIMP_ITEM (merge_layer)->offset_y = y1;
 
-      /*  Set the layer to transparent  */
+      /*  clear the layer  */
       pixel_region_init (&src1PR,
                          gimp_drawable_get_tiles (GIMP_DRAWABLE (merge_layer)),
                          0, 0,
                          (x2 - x1), (y2 - y1),
                          TRUE);
-
-      /*  set the region to 0's  */
-      color_region (&src1PR, bg);
+      clear_region (&src1PR);
 
       /*  Find the index in the layer list of the bottom layer--we need this
        *  in order to add the final, merged layer to the layer list correctly

Modified: branches/soc-2008-text/app/core/gimpimage-resize.c
==============================================================================
--- branches/soc-2008-text/app/core/gimpimage-resize.c	(original)
+++ branches/soc-2008-text/app/core/gimpimage-resize.c	Wed Sep  3 21:19:34 2008
@@ -97,7 +97,12 @@
   old_height = gimp_image_get_height (image);
 
   /*  Push the image size to the stack  */
-  gimp_image_undo_push_image_size (image, NULL, -offset_x, -offset_y);
+  gimp_image_undo_push_image_size (image,
+                                   NULL,
+                                   -offset_x,
+                                   -offset_y,
+                                   new_width,
+                                   new_height);
 
   /*  Set the new width and height  */
   g_object_set (image,
@@ -220,7 +225,11 @@
 
   gimp_image_undo_group_end (image);
 
-  gimp_image_size_changed_detailed (image, offset_x, offset_y);
+  gimp_image_size_changed_detailed (image,
+                                    offset_x,
+                                    offset_y,
+                                    old_width,
+                                    old_height);
 
   g_object_thaw_notify (G_OBJECT (image));
 

Modified: branches/soc-2008-text/app/core/gimpimage-rotate.c
==============================================================================
--- branches/soc-2008-text/app/core/gimpimage-rotate.c	(original)
+++ branches/soc-2008-text/app/core/gimpimage-rotate.c	Wed Sep  3 21:19:34 2008
@@ -61,6 +61,8 @@
   gdouble   progress_current = 1.0;
   gint      new_image_width;
   gint      new_image_height;
+  gint      previous_image_width;
+  gint      previous_image_height;
   gint      offset_x;
   gint      offset_y;
   gboolean  size_changed;
@@ -71,8 +73,11 @@
 
   gimp_set_busy (image->gimp);
 
-  center_x = (gdouble) gimp_image_get_width  (image) / 2.0;
-  center_y = (gdouble) gimp_image_get_height (image) / 2.0;
+  previous_image_width  = gimp_image_get_width  (image);
+  previous_image_height = gimp_image_get_height (image);
+
+  center_x              = previous_image_width  / 2.0;
+  center_y              = previous_image_height / 2.0;
 
   progress_max = (image->channels->num_children +
                   image->layers->num_children   +
@@ -192,7 +197,12 @@
       gdouble xres;
       gdouble yres;
 
-      gimp_image_undo_push_image_size (image, NULL, offset_x, offset_y);
+      gimp_image_undo_push_image_size (image,
+                                       NULL,
+                                       offset_x,
+                                       offset_y,
+                                       new_image_width,
+                                       new_image_height);
 
       g_object_set (image,
                     "width",  new_image_width,
@@ -208,7 +218,11 @@
   gimp_image_undo_group_end (image);
 
   if (size_changed)
-    gimp_image_size_changed_detailed (image, -offset_x, -offset_y);
+    gimp_image_size_changed_detailed (image,
+                                      -offset_x,
+                                      -offset_y,
+                                      previous_image_width,
+                                      previous_image_height);
 
   g_object_thaw_notify (G_OBJECT (image));
 

Modified: branches/soc-2008-text/app/core/gimpimage-scale.c
==============================================================================
--- branches/soc-2008-text/app/core/gimpimage-scale.c	(original)
+++ branches/soc-2008-text/app/core/gimpimage-scale.c	Wed Sep  3 21:19:34 2008
@@ -90,7 +90,12 @@
   offset_y = (old_height - new_height) / 2;
 
   /*  Push the image size to the stack  */
-  gimp_image_undo_push_image_size (image, NULL, offset_x, offset_y);
+  gimp_image_undo_push_image_size (image,
+                                   NULL,
+                                   offset_x,
+                                   offset_y,
+                                   new_width,
+                                   new_height);
 
   /*  Set the new width and height  */
   g_object_set (image,
@@ -212,7 +217,11 @@
 
   g_object_unref (sub_progress);
 
-  gimp_image_size_changed_detailed (image, -offset_x, -offset_y);
+  gimp_image_size_changed_detailed (image,
+                                    -offset_x,
+                                    -offset_y,
+                                    old_width,
+                                    old_height);
 
   g_object_thaw_notify (G_OBJECT (image));
 

Modified: branches/soc-2008-text/app/core/gimpimage-undo-push.c
==============================================================================
--- branches/soc-2008-text/app/core/gimpimage-undo-push.c	(original)
+++ branches/soc-2008-text/app/core/gimpimage-undo-push.c	Wed Sep  3 21:19:34 2008
@@ -82,7 +82,9 @@
 gimp_image_undo_push_image_size (GimpImage   *image,
                                  const gchar *undo_desc,
                                  gint         previous_origin_x,
-                                 gint         previous_origin_y)
+                                 gint         previous_origin_y,
+                                 gint         previous_width,
+                                 gint         previous_height)
 {
   g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
 
@@ -91,6 +93,8 @@
                                GIMP_DIRTY_IMAGE | GIMP_DIRTY_IMAGE_SIZE,
                                "previous-origin-x", previous_origin_x,
                                "previous-origin-y", previous_origin_y,
+                               "previous-width",    previous_width,
+                               "previous-height",   previous_height,
                                NULL);
 }
 

Modified: branches/soc-2008-text/app/core/gimpimage-undo-push.h
==============================================================================
--- branches/soc-2008-text/app/core/gimpimage-undo-push.h	(original)
+++ branches/soc-2008-text/app/core/gimpimage-undo-push.h	Wed Sep  3 21:19:34 2008
@@ -27,7 +27,9 @@
 GimpUndo * gimp_image_undo_push_image_size          (GimpImage     *image,
                                                      const gchar   *undo_desc,
                                                      gint           previous_origin_x,
-                                                     gint           previous_origin_y);
+                                                     gint           previous_origin_y,
+                                                     gint           previous_width,
+                                                     gint           prevoius_height);
 GimpUndo * gimp_image_undo_push_image_resolution    (GimpImage     *image,
                                                      const gchar   *undo_desc);
 GimpUndo * gimp_image_undo_push_image_grid          (GimpImage     *image,

Modified: branches/soc-2008-text/app/core/gimpimage-undo.c
==============================================================================
--- branches/soc-2008-text/app/core/gimpimage-undo.c	(original)
+++ branches/soc-2008-text/app/core/gimpimage-undo.c	Wed Sep  3 21:19:34 2008
@@ -383,7 +383,9 @@
       if (accum.size_changed)
         gimp_image_size_changed_detailed (image,
                                           accum.previous_origin_x,
-                                          accum.previous_origin_y);
+                                          accum.previous_origin_y,
+                                          accum.previous_width,
+                                          accum.previous_height);
 
       if (accum.resolution_changed)
         gimp_image_resolution_changed (image);

Modified: branches/soc-2008-text/app/core/gimpimage.c
==============================================================================
--- branches/soc-2008-text/app/core/gimpimage.c	(original)
+++ branches/soc-2008-text/app/core/gimpimage.c	Wed Sep  3 21:19:34 2008
@@ -151,7 +151,9 @@
 static void     gimp_image_real_size_changed_detailed
                                                  (GimpImage      *image,
                                                   gint            previous_origin_x,
-                                                  gint            previous_origin_y);
+                                                  gint            previous_origin_y,
+                                                  gint            previous_width,
+                                                  gint            previous_height);
 static void     gimp_image_real_colormap_changed (GimpImage      *image,
                                                   gint            color_index);
 static void     gimp_image_real_flush            (GimpImage      *image,
@@ -325,8 +327,10 @@
                   G_SIGNAL_RUN_FIRST,
                   G_STRUCT_OFFSET (GimpImageClass, size_changed_detailed),
                   NULL, NULL,
-                  gimp_marshal_VOID__INT_INT,
-                  G_TYPE_NONE, 2,
+                  gimp_marshal_VOID__INT_INT_INT_INT,
+                  G_TYPE_NONE, 4,
+                  G_TYPE_INT,
+                  G_TYPE_INT,
                   G_TYPE_INT,
                   G_TYPE_INT);
 
@@ -1122,7 +1126,9 @@
 static void
 gimp_image_real_size_changed_detailed (GimpImage *image,
                                        gint       previous_origin_x,
-                                       gint       previous_origin_y)
+                                       gint       previous_origin_y,
+                                       gint       previous_width,
+                                       gint       previous_height)
 {
   /* Whenever GimpImage::size-changed-detailed is emitted, so is
    * GimpViewable::size-changed. Clients choose what signal to listen
@@ -1503,7 +1509,11 @@
       image->yresolution = yresolution;
 
       gimp_image_resolution_changed (image);
-      gimp_image_size_changed_detailed (image, 0, 0);
+      gimp_image_size_changed_detailed (image,
+                                        0,
+                                        0,
+                                        gimp_image_get_width (image),
+                                        gimp_image_get_height (image));
     }
 }
 
@@ -1841,13 +1851,17 @@
 void
 gimp_image_size_changed_detailed (GimpImage *image,
                                   gint       previous_origin_x,
-                                  gint       previous_origin_y)
+                                  gint       previous_origin_y,
+                                  gint       previous_width,
+                                  gint       previous_height)
 {
   g_return_if_fail (GIMP_IS_IMAGE (image));
 
   g_signal_emit (image, gimp_image_signals[SIZE_CHANGED_DETAILED], 0,
                  previous_origin_x,
-                 previous_origin_y);
+                 previous_origin_y,
+                 previous_width,
+                 previous_height);
 }
 
 void
@@ -2507,6 +2521,17 @@
 }
 
 
+/*  projection  */
+
+GimpProjection *
+gimp_image_get_projection (const GimpImage *image)
+{
+  g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
+
+  return image->projection;
+}
+
+
 /*  layers / channels / vectors  */
 
 GimpContainer *

Modified: branches/soc-2008-text/app/core/gimpimage.h
==============================================================================
--- branches/soc-2008-text/app/core/gimpimage.h	(original)
+++ branches/soc-2008-text/app/core/gimpimage.h	Wed Sep  3 21:19:34 2008
@@ -193,7 +193,9 @@
   void (* resolution_changed)           (GimpImage            *image);
   void (* size_changed_detailed)        (GimpImage            *image,
                                          gint                  previous_origin_x,
-                                         gint                  previous_origin_y);
+                                         gint                  previous_origin_y,
+                                         gint                  previous_width,
+                                         gint                  previous_height);
   void (* unit_changed)                 (GimpImage            *image);
   void (* quick_mask_changed)           (GimpImage            *image);
   void (* selection_control)            (GimpImage            *image,
@@ -329,7 +331,9 @@
 void            gimp_image_quick_mask_changed    (GimpImage          *image);
 void            gimp_image_size_changed_detailed (GimpImage          *image,
                                                   gint                previous_origin_x,
-                                                  gint                previous_origin_y);
+                                                  gint                previous_origin_y,
+                                                  gint                previous_width,
+                                                  gint                previous_height);
 
 
 /*  undo  */
@@ -403,6 +407,11 @@
 GimpTattoo      gimp_image_get_tattoo_state      (GimpImage          *image);
 
 
+/*  projection  */
+
+GimpProjection * gimp_image_get_projection       (const GimpImage    *image);
+
+
 /*  layers / channels / vectors  */
 
 GimpContainer * gimp_image_get_layers            (const GimpImage    *image);

Modified: branches/soc-2008-text/app/core/gimpmaskundo.c
==============================================================================
--- branches/soc-2008-text/app/core/gimpmaskundo.c	(original)
+++ branches/soc-2008-text/app/core/gimpmaskundo.c	Wed Sep  3 21:19:34 2008
@@ -139,8 +139,6 @@
 
   if (gimp_channel_bounds (channel, &x1, &y1, &x2, &y2))
     {
-      guchar empty = 0;
-
       new_tiles = tile_manager_new (x2 - x1, y2 - y1, 1);
 
       pixel_region_init (&srcPR,
@@ -155,7 +153,7 @@
                          gimp_drawable_get_tiles (GIMP_DRAWABLE (channel)),
                          x1, y1, x2 - x1, y2 - y1, TRUE);
 
-      color_region (&srcPR, &empty);
+      clear_region (&srcPR);
     }
   else
     {

Modified: branches/soc-2008-text/app/core/gimpprojection-construct.c
==============================================================================
--- branches/soc-2008-text/app/core/gimpprojection-construct.c	(original)
+++ branches/soc-2008-text/app/core/gimpprojection-construct.c	Wed Sep  3 21:19:34 2008
@@ -337,9 +337,9 @@
  * @w:
  * @h:
  *
- * This function determines whether a visible layer with combine mode Normal
- * provides complete coverage over the specified area.  If not, the projection
- * is initialized to transparent black.
+ * This function determines whether a visible layer with combine mode
+ * Normal provides complete coverage over the specified area.  If not,
+ * the projection is initialized to transparent black.
  */
 static void
 gimp_projection_initialize (GimpProjection *proj,
@@ -363,6 +363,7 @@
 
       if (gimp_item_get_visible (item)                                  &&
           ! gimp_drawable_has_alpha (GIMP_DRAWABLE (item))              &&
+          ! gimp_layer_get_mask (GIMP_LAYER (item))                     &&
           gimp_layer_get_mode (GIMP_LAYER (item)) == GIMP_NORMAL_MODE   &&
           (off_x <= x)                                                  &&
           (off_y <= y)                                                  &&
@@ -376,12 +377,11 @@
 
   if (! coverage)
     {
-      PixelRegion PR;
-      guchar      clear[4] = { 0, 0, 0, 0 };
+      PixelRegion region;
 
-      pixel_region_init (&PR, gimp_projection_get_tiles (proj),
-                         x, y, w, h, TRUE);
-      color_region (&PR, clear);
+      pixel_region_init (&region,
+                         gimp_projection_get_tiles (proj), x, y, w, h, TRUE);
+      clear_region (&region);
     }
 }
 

Modified: branches/soc-2008-text/app/core/gimpundo.h
==============================================================================
--- branches/soc-2008-text/app/core/gimpundo.h	(original)
+++ branches/soc-2008-text/app/core/gimpundo.h	Wed Sep  3 21:19:34 2008
@@ -26,12 +26,19 @@
 struct _GimpUndoAccumulator
 {
   gboolean mode_changed;
+
   gboolean size_changed;
-  gdouble  previous_origin_x;
-  gdouble  previous_origin_y;
+  gint     previous_origin_x;
+  gint     previous_origin_y;
+  gint     previous_width;
+  gint     previous_height;
+
   gboolean resolution_changed;
+
   gboolean unit_changed;
+
   gboolean quick_mask_changed;
+
   gboolean alpha_changed;
 };
 

Modified: branches/soc-2008-text/app/dialogs/resolution-calibrate-dialog.c
==============================================================================
--- branches/soc-2008-text/app/dialogs/resolution-calibrate-dialog.c	(original)
+++ branches/soc-2008-text/app/dialogs/resolution-calibrate-dialog.c	Wed Sep  3 21:19:34 2008
@@ -105,14 +105,14 @@
       gtk_widget_show (image);
     }
 
-  ruler = gimp_hruler_new ();
+  ruler = gimp_ruler_new (GTK_ORIENTATION_HORIZONTAL);
   gtk_widget_set_size_request (ruler, ruler_width, 32);
   gimp_ruler_set_range (GIMP_RULER (ruler), 0, ruler_width, ruler_width);
   gtk_table_attach (GTK_TABLE (table), ruler, 1, 3, 0, 1,
                     GTK_SHRINK, GTK_SHRINK, 0, 0);
   gtk_widget_show (ruler);
 
-  ruler = gimp_vruler_new ();
+  ruler = gimp_ruler_new (GTK_ORIENTATION_VERTICAL);
   gtk_widget_set_size_request (ruler, 32, ruler_height);
   gimp_ruler_set_range (GIMP_RULER (ruler), 0, ruler_height, ruler_height);
   gtk_table_attach (GTK_TABLE (table), ruler, 0, 1, 1, 3,

Modified: branches/soc-2008-text/app/display/gimpdisplayshell-scale.c
==============================================================================
--- branches/soc-2008-text/app/display/gimpdisplayshell-scale.c	(original)
+++ branches/soc-2008-text/app/display/gimpdisplayshell-scale.c	Wed Sep  3 21:19:34 2008
@@ -672,7 +672,6 @@
   gint       shell_height;
   gint       screen_width;
   gint       screen_height;
-  gdouble    new_scale;
 
   g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
 
@@ -684,16 +683,18 @@
   screen_width  = gdk_screen_get_width (screen)  * 0.75;
   screen_height = gdk_screen_get_height (screen) * 0.75;
 
+  /* We need to zoom before we use SCALE[XY] */
+  gimp_zoom_model_zoom (shell->zoom, GIMP_ZOOM_TO, scale);
+
   shell_width  = SCALEX (shell, image_width);
   shell_height = SCALEY (shell, image_height);
 
-  gimp_zoom_model_zoom (shell->zoom, GIMP_ZOOM_TO, scale);
-
   if (shell->display->config->initial_zoom_to_fit)
     {
       /*  Limit to the size of the screen...  */
       if (shell_width > screen_width || shell_height > screen_height)
         {
+          gdouble new_scale;
           gdouble current = gimp_zoom_model_get_factor (shell->zoom);
 
           new_scale = current * MIN (((gdouble) screen_height) / shell_height,

Modified: branches/soc-2008-text/app/display/gimpdisplayshell.c
==============================================================================
--- branches/soc-2008-text/app/display/gimpdisplayshell.c	(original)
+++ branches/soc-2008-text/app/display/gimpdisplayshell.c	Wed Sep  3 21:19:34 2008
@@ -1026,7 +1026,7 @@
   gimp_display_shell_selection_init (shell);
 
   /*  the horizontal ruler  */
-  shell->hrule = gimp_hruler_new ();
+  shell->hrule = gimp_ruler_new (GTK_ORIENTATION_HORIZONTAL);
   gtk_widget_set_events (GTK_WIDGET (shell->hrule),
                          GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
 
@@ -1040,7 +1040,7 @@
   gimp_help_set_help_data (shell->hrule, NULL, GIMP_HELP_IMAGE_WINDOW_RULER);
 
   /*  the vertical ruler  */
-  shell->vrule = gimp_vruler_new ();
+  shell->vrule = gimp_ruler_new (GTK_ORIENTATION_VERTICAL);
   gtk_widget_set_events (GTK_WIDGET (shell->vrule),
                          GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
 

Modified: branches/soc-2008-text/app/display/gimpstatusbar.c
==============================================================================
--- branches/soc-2008-text/app/display/gimpstatusbar.c	(original)
+++ branches/soc-2008-text/app/display/gimpstatusbar.c	Wed Sep  3 21:19:34 2008
@@ -291,7 +291,7 @@
 {
   GtkRequisition  child_requisition;
   gint            width   = 0;
-  gint            padding = 2 * widget->style->ythickness;
+  gint            padding = 2 * gtk_widget_get_style (widget)->ythickness;
 
   /*  also consider the children which can be invisible  */
 
@@ -1269,7 +1269,7 @@
                                     PANGO_PIXELS (rect.width) : 0);
       y += PANGO_PIXELS (rect.y);
 
-      gdk_draw_pixbuf (widget->window, widget->style->black_gc,
+      gdk_draw_pixbuf (widget->window, gtk_widget_get_style (widget)->black_gc,
                        statusbar->icon,
                        0, 0,
                        x, y,

Modified: branches/soc-2008-text/app/paint-funcs/paint-funcs.c
==============================================================================
--- branches/soc-2008-text/app/paint-funcs/paint-funcs.c	(original)
+++ branches/soc-2008-text/app/paint-funcs/paint-funcs.c	Wed Sep  3 21:19:34 2008
@@ -1886,6 +1886,35 @@
 /**************************************************/
 
 void
+clear_region (PixelRegion *dest)
+{
+  gpointer pr;
+
+  for (pr = pixel_regions_register (1, dest);
+       pr != NULL;
+       pr = pixel_regions_process (pr))
+    {
+      if (dest->w * dest->bytes == dest->rowstride)
+        {
+          memset (dest->data, 0, dest->w * dest->h * dest->bytes);
+        }
+      else
+        {
+          guchar *d = dest->data;
+          gint    h = dest->h;
+
+          while (h--)
+            {
+              memset (d, 0, dest->w * dest->bytes);
+
+              d += dest->rowstride;
+            }
+        }
+    }
+}
+
+
+void
 color_region (PixelRegion  *dest,
               const guchar *col)
 {

Modified: branches/soc-2008-text/app/paint-funcs/paint-funcs.h
==============================================================================
--- branches/soc-2008-text/app/paint-funcs/paint-funcs.h	(original)
+++ branches/soc-2008-text/app/paint-funcs/paint-funcs.h	Wed Sep  3 21:19:34 2008
@@ -339,6 +339,9 @@
 
 
 /*  Region functions  */
+
+void  clear_region                        (PixelRegion  *dest);
+
 void  color_region                        (PixelRegion  *dest,
                                            const guchar *color);
 void  color_region_mask                   (PixelRegion  *dest,

Modified: branches/soc-2008-text/app/plug-in/gimppluginshm.c
==============================================================================
--- branches/soc-2008-text/app/plug-in/gimppluginshm.c	(original)
+++ branches/soc-2008-text/app/plug-in/gimppluginshm.c	Wed Sep  3 21:19:34 2008
@@ -142,7 +142,7 @@
     g_snprintf (fileMapName, sizeof (fileMapName), "GIMP%d.SHM", pid);
 
     /* Create the file mapping into paging space */
-    shm->shm_handle = CreateFileMapping ((HANDLE) 0xFFFFFFFF, NULL,
+    shm->shm_handle = CreateFileMapping (INVALID_FILE_HANDLE, NULL,
                                          PAGE_READWRITE, 0,
                                          TILE_MAP_SIZE,
                                          fileMapName);

Modified: branches/soc-2008-text/app/widgets/gimphelp.c
==============================================================================
--- branches/soc-2008-text/app/widgets/gimphelp.c	(original)
+++ branches/soc-2008-text/app/widgets/gimphelp.c	Wed Sep  3 21:19:34 2008
@@ -48,7 +48,7 @@
 #include "gimpmessagebox.h"
 #include "gimpmessagedialog.h"
 #include "gimpmessagedialog.h"
-#include "gimpwidgets-utils.c"
+#include "gimpwidgets-utils.h"
 
 #include "gimp-log.h"
 #include "gimp-intl.h"

Modified: branches/soc-2008-text/app/widgets/gimplayertreeview.c
==============================================================================
--- branches/soc-2008-text/app/widgets/gimplayertreeview.c	(original)
+++ branches/soc-2008-text/app/widgets/gimplayertreeview.c	Wed Sep  3 21:19:34 2008
@@ -1001,7 +1001,7 @@
 
   if (layer)
     {
-      gdouble opacity = adjustment->value / 100.0;
+      gdouble opacity = gtk_adjustment_get_value (adjustment) / 100.0;
 
       if (gimp_layer_get_opacity (layer) != opacity)
         {
@@ -1078,7 +1078,8 @@
                gimp_layer_tree_view_lock_alpha_button_toggled);
     }
 
-  if (gimp_layer_get_opacity (layer) * 100.0 != view->opacity_adjustment->value)
+  if (gimp_layer_get_opacity (layer) * 100.0 !=
+      gtk_adjustment_get_value (view->opacity_adjustment))
     {
       BLOCK (view->opacity_adjustment,
              gimp_layer_tree_view_opacity_scale_changed);

Modified: branches/soc-2008-text/app/widgets/gimpselectiondata.c
==============================================================================
--- branches/soc-2008-text/app/widgets/gimpselectiondata.c	(original)
+++ branches/soc-2008-text/app/widgets/gimpselectiondata.c	Wed Sep  3 21:19:34 2008
@@ -50,14 +50,15 @@
 
 /*  local function prototypes  */
 
-static gchar      * gimp_selection_data_get_name   (GtkSelectionData *selection);
-static GimpObject * gimp_selection_data_get_object (GtkSelectionData *selection,
-                                                    GimpContainer    *container,
-                                                    GimpObject       *additional);
-static gchar      * gimp_unescape_uri_string       (const char       *escaped,
-                                                    int               len,
-                                                    const char       *illegal_escaped_characters,
-                                                    gboolean          ascii_must_not_be_escaped);
+static const gchar * gimp_selection_data_get_name   (GtkSelectionData *selection,
+                                                     const gchar      *strfunc);
+static GimpObject  * gimp_selection_data_get_object (GtkSelectionData *selection,
+                                                     GimpContainer    *container,
+                                                     GimpObject       *additional);
+static gchar       * gimp_unescape_uri_string       (const char       *escaped,
+                                                     int               len,
+                                                     const char       *illegal_escaped_characters,
+                                                     gboolean          ascii_must_not_be_escaped);
 
 
 /*  public functions  */
@@ -92,7 +93,7 @@
     }
 
   gtk_selection_data_set (selection, selection->target,
-                          8, (guchar *) vals, strlen (vals) + 1);
+                          8, (guchar *) vals, strlen (vals));
 
   g_free (vals);
 }
@@ -360,7 +361,7 @@
   str = g_strdup_printf ("%d:%d", get_pid (), gimp_image_get_ID (image));
 
   gtk_selection_data_set (selection, selection->target,
-                          8, (guchar *) str, strlen (str) + 1);
+                          8, (guchar *) str, strlen (str));
 
   g_free (str);
 }
@@ -369,27 +370,26 @@
 gimp_selection_data_get_image (GtkSelectionData *selection,
                                Gimp             *gimp)
 {
-  GimpImage *image = NULL;
-  gchar     *str;
-  gint       pid;
-  gint       ID;
+  const gchar *str;
 
   g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
   g_return_val_if_fail (selection != NULL, NULL);
 
-  str = gimp_selection_data_get_name (selection);
-  if (! str)
-    return NULL;
+  str = gimp_selection_data_get_name (selection, G_STRFUNC);
 
-  if (sscanf (str, "%i:%i", &pid, &ID) == 2 &&
-      pid == get_pid ())
+  if (str)
     {
-      image = gimp_image_get_by_ID (gimp, ID);
-    }
+      gint pid;
+      gint ID;
 
-  g_free (str);
+      if (sscanf (str, "%i:%i", &pid, &ID) == 2 &&
+          pid == get_pid ())
+        {
+          return gimp_image_get_by_ID (gimp, ID);
+        }
+    }
 
-  return image;
+  return NULL;
 }
 
 void
@@ -406,7 +406,7 @@
                          (gint) channel);
 
   gtk_selection_data_set (selection, selection->target,
-                          8, (guchar *) str, strlen (str) + 1);
+                          8, (guchar *) str, strlen (str));
 
   g_free (str);
 }
@@ -416,11 +416,7 @@
                                    Gimp             *gimp,
                                    GimpChannelType  *channel)
 {
-  GimpImage *image = NULL;
-  gchar     *str;
-  gint       pid;
-  gint       ID;
-  gint       ch;
+  const gchar *str;
 
   g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
   g_return_val_if_fail (selection != NULL, NULL);
@@ -428,22 +424,27 @@
   if (channel)
     *channel = 0;
 
-  str = gimp_selection_data_get_name (selection);
-  if (! str)
-    return NULL;
+  str = gimp_selection_data_get_name (selection, G_STRFUNC);
 
-  if (sscanf (str, "%i:%i:%i", &pid, &ID, &ch) == 3 &&
-      pid == get_pid ())
+  if (str)
     {
-      image = gimp_image_get_by_ID (gimp, ID);
+      gint pid;
+      gint ID;
+      gint ch;
 
-      if (image && channel)
-        *channel = ch;
-    }
+      if (sscanf (str, "%i:%i:%i", &pid, &ID, &ch) == 3 &&
+          pid == get_pid ())
+        {
+          GimpImage *image = gimp_image_get_by_ID (gimp, ID);
 
-  g_free (str);
+          if (image && channel)
+            *channel = ch;
 
-  return image;
+          return image;
+        }
+    }
+
+  return NULL;
 }
 
 void
@@ -458,7 +459,7 @@
   str = g_strdup_printf ("%d:%d", get_pid (), gimp_item_get_ID (item));
 
   gtk_selection_data_set (selection, selection->target,
-                          8, (guchar *) str, strlen (str) + 1);
+                          8, (guchar *) str, strlen (str));
 
   g_free (str);
 }
@@ -467,27 +468,26 @@
 gimp_selection_data_get_item (GtkSelectionData *selection,
                               Gimp             *gimp)
 {
-  GimpItem *item = NULL;
-  gchar    *str;
-  gint      pid;
-  gint      ID;
+  const gchar *str;
 
   g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
   g_return_val_if_fail (selection != NULL, NULL);
 
-  str = gimp_selection_data_get_name (selection);
-  if (! str)
-    return NULL;
+  str = gimp_selection_data_get_name (selection, G_STRFUNC);
 
-  if (sscanf (str, "%i:%i", &pid, &ID) == 2 &&
-      pid == get_pid ())
+  if (str)
     {
-      item = gimp_item_get_by_ID (gimp, ID);
-    }
+      gint pid;
+      gint ID;
 
-  g_free (str);
+      if (sscanf (str, "%i:%i", &pid, &ID) == 2 &&
+          pid == get_pid ())
+        {
+          return gimp_item_get_by_ID (gimp, ID);
+        }
+    }
 
-  return item;
+  return NULL;
 }
 
 void
@@ -506,8 +506,10 @@
       gchar *str;
 
       str = g_strdup_printf ("%d:%p:%s", get_pid (), object, name);
+
       gtk_selection_data_set (selection, selection->target,
-                              8, (guchar *) str, strlen (str) + 1);
+                              8, (guchar *) str, strlen (str));
+
       g_free (str);
     }
 }
@@ -630,24 +632,24 @@
 
 /*  private functions  */
 
-static gchar *
-gimp_selection_data_get_name (GtkSelectionData *selection)
+static const gchar *
+gimp_selection_data_get_name (GtkSelectionData *selection,
+                              const gchar      *strfunc)
 {
-  gchar *name;
+  const gchar *name;
 
   if ((selection->format != 8) || (selection->length < 1))
     {
-      g_warning ("Received invalid selection data");
+      g_warning ("%s: received invalid selection data", strfunc);
       return NULL;
     }
 
-  name = g_strndup ((const gchar *) selection->data, selection->length);
+  name = (const gchar *) selection->data;
 
   if (! g_utf8_validate (name, -1, NULL))
     {
-      g_warning ("Received invalid selection data "
-                 "(doesn't validate as UTF-8)!");
-      g_free (name);
+      g_warning ("%s: received invalid selection data "
+                 "(doesn't validate as UTF-8)", strfunc);
       return NULL;
     }
 
@@ -661,42 +663,43 @@
                                 GimpContainer    *container,
                                 GimpObject       *additional)
 {
-  GimpObject *object = NULL;
-  gchar      *str;
-  gint        pid;
-  gpointer    object_addr;
-  gint        name_offset = 0;
+  const gchar *str;
 
-  str = gimp_selection_data_get_name (selection);
-  if (! str)
-    return NULL;
+  str = gimp_selection_data_get_name (selection, G_STRFUNC);
 
-  if (sscanf (str, "%i:%p:%n", &pid, &object_addr, &name_offset) >= 2 &&
-      pid == get_pid () && name_offset > 0)
+  if (str)
     {
-      gchar *name = str + name_offset;
+      gint     pid;
+      gpointer object_addr;
+      gint     name_offset = 0;
 
-      GIMP_LOG (DND, "pid = %d, addr = %p, name = '%s'",
-                pid, object_addr, name);
-
-      if (additional &&
-          strcmp (name, gimp_object_get_name (additional)) == 0 &&
-          object_addr == (gpointer) additional)
+      if (sscanf (str, "%i:%p:%n", &pid, &object_addr, &name_offset) >= 2 &&
+          pid == get_pid () && name_offset > 0)
         {
-          object = additional;
-        }
-      else
-        {
-          object = gimp_container_get_child_by_name (container, name);
+          const gchar *name = str + name_offset;
+
+          GIMP_LOG (DND, "pid = %d, addr = %p, name = '%s'",
+                    pid, object_addr, name);
 
-          if (object && object_addr != (gpointer) object)
-            object = NULL;
+          if (additional &&
+              strcmp (name, gimp_object_get_name (additional)) == 0 &&
+              object_addr == (gpointer) additional)
+            {
+              return additional;
+            }
+          else
+            {
+              GimpObject *object;
+
+              object = gimp_container_get_child_by_name (container, name);
+
+              if (object_addr == (gpointer) object)
+                return object;
+            }
         }
     }
 
-  g_free (str);
-
-  return object;
+  return NULL;
 }
 
 /*  the next two functions are straight cut'n'paste from glib/glib/gconvert.c,

Modified: branches/soc-2008-text/authors.xml
==============================================================================
--- branches/soc-2008-text/authors.xml	(original)
+++ branches/soc-2008-text/authors.xml	Wed Sep  3 21:19:34 2008
@@ -55,7 +55,7 @@
   <contributor role="author" last-active="2.6">Alexia Death</contributor>
   <contributor role="author" last-active="1.0">Brian Degenhardt</contributor>
   <contributor role="author" last-active="2.4">Karine Delvare</contributor>
-  <contributor role="author" last-active="2.6">Aurore Derriennic</contributor>
+  <contributor role="artist" last-active="2.6">Aurore Derriennic</contributor>
   <contributor role="author" last-active="1.0">Andreas Dilger</contributor>
   <contributor role="author" last-active="2.0">Austin Donnelly</contributor>
   <contributor role="author" last-active="1.0">Scott Draves</contributor>

Modified: branches/soc-2008-text/configure.in
==============================================================================
--- branches/soc-2008-text/configure.in	(original)
+++ branches/soc-2008-text/configure.in	Wed Sep  3 21:19:34 2008
@@ -411,15 +411,14 @@
 # Internationalisation
 ######################
 
-# Note to translators: you MUST have .po files in all 6 directories:
-# po, po-libgimp, po-plug-ins, po-python, po-script-fu and po-tips
-# before adding your language code to ALL_LINGUAS.
-ALL_LINGUAS="ar be bg ca ca valencia cs da de dz el en_CA en_GB eo es et eu fa fi fr ga gl gu he hu hr id is it ja km ko lt mk ms nb ne nl nn oc pa pl pt pt_BR ro ru rw sk sl sr sr Latn sv tr tt uk vi xh yi zh_CN zh_TW"
-
 IT_PROG_INTLTOOL(0.35.5)
 AM_GLIB_GNU_GETTEXT
 
 
+###########
+# iso-codes
+###########
+
 AC_MSG_CHECKING([for iso-codes])
 PKG_CHECK_EXISTS(iso-codes,
   have_iso_codes="yes"
@@ -439,7 +438,6 @@
 # Checks for required libraries
 ###############################
 
-
 PKG_CHECK_MODULES(BABL, babl >= babl_required_version, :,
   AC_MSG_ERROR([Test for babl failed. Please get it from http://gegl.org/]))
 

Modified: branches/soc-2008-text/devel-docs/libgimpwidgets/libgimpwidgets-docs.sgml
==============================================================================
--- branches/soc-2008-text/devel-docs/libgimpwidgets/libgimpwidgets-docs.sgml	(original)
+++ branches/soc-2008-text/devel-docs/libgimpwidgets/libgimpwidgets-docs.sgml	Wed Sep  3 21:19:34 2008
@@ -40,7 +40,6 @@
     <xi:include href="xml/gimpfileentry.xml" />
     <xi:include href="xml/gimpframe.xml" />
     <xi:include href="xml/gimphintbox.xml" />
-    <xi:include href="xml/gimphruler.xml" />
     <xi:include href="xml/gimpintcombobox.xml" />
     <xi:include href="xml/gimpintstore.xml" />
     <xi:include href="xml/gimpmemsizeentry.xml" />
@@ -57,7 +56,6 @@
     <xi:include href="xml/gimpsizeentry.xml" />
     <xi:include href="xml/gimpstringcombobox.xml" />
     <xi:include href="xml/gimpunitmenu.xml" />
-    <xi:include href="xml/gimpvruler.xml" />
     <xi:include href="xml/gimpzoommodel.xml" />
   </part>
   

Modified: branches/soc-2008-text/devel-docs/libgimpwidgets/libgimpwidgets-sections.txt
==============================================================================
--- branches/soc-2008-text/devel-docs/libgimpwidgets/libgimpwidgets-sections.txt	(original)
+++ branches/soc-2008-text/devel-docs/libgimpwidgets/libgimpwidgets-sections.txt	Wed Sep  3 21:19:34 2008
@@ -568,6 +568,7 @@
 <FILE>gimpruler</FILE>
 <TITLE>GimpRuler</TITLE>
 GimpRuler
+gimp_ruler_new
 gimp_ruler_set_unit
 gimp_ruler_get_unit
 gimp_ruler_set_position
@@ -586,38 +587,6 @@
 </SECTION>
 
 <SECTION>
-<FILE>gimphruler</FILE>
-<TITLE>GimpHRuler</TITLE>
-gimp_hruler_new
-<SUBSECTION Standard>
-GimpHRuler
-GimpHRulerClass
-GIMP_HRULER
-GIMP_IS_HRULER
-GIMP_TYPE_HRULER
-gimp_hruler_get_type
-GIMP_HRULER_CLASS
-GIMP_IS_HRULER_CLASS
-GIMP_HRULER_GET_CLASS
-</SECTION>
-
-<SECTION>
-<FILE>gimpvruler</FILE>
-<TITLE>GimpVRuler</TITLE>
-gimp_vruler_new
-<SUBSECTION Standard>
-GimpVRuler
-GimpVRulerClass
-GIMP_VRULER
-GIMP_IS_VRULER
-GIMP_TYPE_VRULER
-gimp_vruler_get_type
-GIMP_VRULER_CLASS
-GIMP_IS_VRULER_CLASS
-GIMP_VRULER_GET_CLASS
-</SECTION>
-
-<SECTION>
 <FILE>gimpunitmenu</FILE>
 <TITLE>GimpUnitMenu</TITLE>
 GimpUnitMenu

Modified: branches/soc-2008-text/devel-docs/libgimpwidgets/libgimpwidgets.types
==============================================================================
--- branches/soc-2008-text/devel-docs/libgimpwidgets/libgimpwidgets.types	(original)
+++ branches/soc-2008-text/devel-docs/libgimpwidgets/libgimpwidgets.types	Wed Sep  3 21:19:34 2008
@@ -28,7 +28,6 @@
 gimp_file_entry_get_type
 gimp_frame_get_type
 gimp_hint_box_get_type
-gimp_hruler_get_type
 gimp_int_combo_box_get_type
 gimp_int_store_get_type
 gimp_memsize_entry_get_type
@@ -45,5 +44,4 @@
 gimp_size_entry_get_type
 gimp_string_combo_box_get_type
 gimp_unit_menu_get_type
-gimp_vruler_get_type
 gimp_zoom_model_get_type

Modified: branches/soc-2008-text/devel-docs/libgimpwidgets/tmpl/gimpruler.sgml
==============================================================================
--- branches/soc-2008-text/devel-docs/libgimpwidgets/tmpl/gimpruler.sgml	(original)
+++ branches/soc-2008-text/devel-docs/libgimpwidgets/tmpl/gimpruler.sgml	Wed Sep  3 21:19:34 2008
@@ -33,6 +33,11 @@
 
 </para>
 
+<!-- ##### ARG GimpRuler:orientation ##### -->
+<para>
+
+</para>
+
 <!-- ##### ARG GimpRuler:position ##### -->
 <para>
 
@@ -48,6 +53,15 @@
 
 </para>
 
+<!-- ##### FUNCTION gimp_ruler_new ##### -->
+<para>
+
+</para>
+
+ orientation: 
+ Returns: 
+
+
 <!-- ##### FUNCTION gimp_ruler_set_unit ##### -->
 <para>
 

Modified: branches/soc-2008-text/libgimpwidgets/Makefile.am
==============================================================================
--- branches/soc-2008-text/libgimpwidgets/Makefile.am	(original)
+++ branches/soc-2008-text/libgimpwidgets/Makefile.am	Wed Sep  3 21:19:34 2008
@@ -122,8 +122,6 @@
 	gimphelpui.h			\
 	gimphintbox.c			\
 	gimphintbox.h			\
-	gimphruler.c			\
-	gimphruler.h			\
 	gimpintcombobox.c		\
 	gimpintcombobox.h		\
 	gimpintstore.c			\
@@ -166,8 +164,6 @@
 	gimpstringcombobox.h		\
 	gimpunitmenu.c			\
 	gimpunitmenu.h			\
-	gimpvruler.c			\
-	gimpvruler.h			\
 	gimpzoommodel.c			\
 	gimpzoommodel.h			\
 	gimpwidgets-private.c		\
@@ -218,7 +214,6 @@
 	gimpframe.h			\
 	gimphelpui.h			\
 	gimphintbox.h			\
-	gimphruler.h			\
 	gimpintcombobox.h		\
 	gimpintstore.h			\
 	gimpmemsizeentry.h		\
@@ -240,7 +235,6 @@
 	gimpstock.h			\
 	gimpstringcombobox.h		\
 	gimpunitmenu.h			\
-	gimpvruler.h			\
 	gimpzoommodel.h
 
 libgimpwidgets_2_0_la_LDFLAGS = \

Modified: branches/soc-2008-text/libgimpwidgets/gimpcolorscales.c
==============================================================================
--- branches/soc-2008-text/libgimpwidgets/gimpcolorscales.c	(original)
+++ branches/soc-2008-text/libgimpwidgets/gimpcolorscales.c	Wed Sep  3 21:19:34 2008
@@ -345,6 +345,7 @@
                                 GimpColorScales *scales)
 {
   GimpColorSelector *selector = GIMP_COLOR_SELECTOR (scales);
+  gdouble            value    = gtk_adjustment_get_value (adjustment);
   gint               i;
 
   for (i = 0; i < 7; i++)
@@ -354,32 +355,31 @@
   switch (i)
     {
     case GIMP_COLOR_SELECTOR_HUE:
-      selector->hsv.h = GTK_ADJUSTMENT (adjustment)->value / 360.0;
+      selector->hsv.h = value / 360.0;
       break;
 
     case GIMP_COLOR_SELECTOR_SATURATION:
-      selector->hsv.s = GTK_ADJUSTMENT (adjustment)->value / 100.0;
+      selector->hsv.s = value / 100.0;
       break;
 
     case GIMP_COLOR_SELECTOR_VALUE:
-      selector->hsv.v = GTK_ADJUSTMENT (adjustment)->value / 100.0;
+      selector->hsv.v = value / 100.0;
       break;
 
     case GIMP_COLOR_SELECTOR_RED:
-      selector->rgb.r = GTK_ADJUSTMENT (adjustment)->value / 255.0;
+      selector->rgb.r = value / 255.0;
       break;
 
     case GIMP_COLOR_SELECTOR_GREEN:
-      selector->rgb.g = GTK_ADJUSTMENT (adjustment)->value / 255.0;
+      selector->rgb.g = value / 255.0;
       break;
 
     case GIMP_COLOR_SELECTOR_BLUE:
-      selector->rgb.b = GTK_ADJUSTMENT (adjustment)->value / 255.0;
+      selector->rgb.b = value / 255.0;
       break;
 
     case GIMP_COLOR_SELECTOR_ALPHA:
-      selector->hsv.a = selector->rgb.a =
-        GTK_ADJUSTMENT (adjustment)->value / 100.0;
+      selector->hsv.a = selector->rgb.a = value / 100.0;
       break;
     }
 

Modified: branches/soc-2008-text/libgimpwidgets/gimppreviewarea.c
==============================================================================
--- branches/soc-2008-text/libgimpwidgets/gimppreviewarea.c	(original)
+++ branches/soc-2008-text/libgimpwidgets/gimppreviewarea.c	Wed Sep  3 21:19:34 2008
@@ -220,14 +220,10 @@
 gimp_preview_area_expose (GtkWidget      *widget,
                           GdkEventExpose *event)
 {
-  GimpPreviewArea *area;
+  GimpPreviewArea *area = GIMP_PREVIEW_AREA (widget);
   GdkRectangle     rect;
   GdkRectangle     render;
 
-  g_return_val_if_fail (GIMP_IS_PREVIEW_AREA (widget), FALSE);
-
-  area = GIMP_PREVIEW_AREA (widget);
-
   if (! area->buf)
     return FALSE;
 

Modified: branches/soc-2008-text/libgimpwidgets/gimppropwidgets.c
==============================================================================
--- branches/soc-2008-text/libgimpwidgets/gimppropwidgets.c	(original)
+++ branches/soc-2008-text/libgimpwidgets/gimppropwidgets.c	Wed Sep  3 21:19:34 2008
@@ -1291,56 +1291,55 @@
                                GObject       *config)
 {
   GParamSpec *param_spec;
+  gdouble     value;
 
   param_spec = get_param_spec (G_OBJECT (adjustment));
   if (! param_spec)
     return;
 
+  value = gtk_adjustment_get_value (adjustment);
+
   if (G_IS_PARAM_SPEC_INT (param_spec))
     {
       g_object_set (config,
-                    param_spec->name, (gint) adjustment->value,
+                    param_spec->name, (gint) value,
                     NULL);
     }
   else if (G_IS_PARAM_SPEC_UINT (param_spec))
     {
       g_object_set (config,
-                    param_spec->name, (guint) adjustment->value,
+                    param_spec->name, (guint) value,
                     NULL);
     }
   else if (G_IS_PARAM_SPEC_LONG (param_spec))
     {
       g_object_set (config,
-                    param_spec->name, (glong) adjustment->value,
+                    param_spec->name, (glong) value,
                     NULL);
     }
   else if (G_IS_PARAM_SPEC_ULONG (param_spec))
     {
       g_object_set (config,
-                    param_spec->name, (gulong) adjustment->value,
+                    param_spec->name, (gulong) value,
                     NULL);
     }
   else if (G_IS_PARAM_SPEC_INT64 (param_spec))
     {
       g_object_set (config,
-                    param_spec->name, (gint64) adjustment->value,
+                    param_spec->name, (gint64) value,
                     NULL);
     }
   else if (G_IS_PARAM_SPEC_UINT64 (param_spec))
     {
       g_object_set (config,
-                    param_spec->name, (guint64) adjustment->value,
+                    param_spec->name, (guint64) value,
                     NULL);
     }
   else if (G_IS_PARAM_SPEC_DOUBLE (param_spec))
     {
-      gdouble value;
-
       if (GPOINTER_TO_INT (g_object_get_data (G_OBJECT (adjustment),
                                               "opacity-scale")))
-        value = adjustment->value / 100.0;
-      else
-        value = adjustment->value;
+        value /= 100.0;
 
       g_object_set (config, param_spec->name, value, NULL);
     }
@@ -1420,7 +1419,7 @@
       return;
     }
 
-  if (adjustment->value != value)
+  if (gtk_adjustment_get_value (adjustment) != value)
     {
       g_signal_handlers_block_by_func (adjustment,
                                        gimp_prop_adjustment_callback,
@@ -3528,14 +3527,15 @@
                               GParamSpec *param_spec,
                               GtkWidget  *image)
 {
-  gchar *stock_id;
+  gchar       *stock_id;
+  GtkIconSize  icon_size;
 
   g_object_get (config,
                 param_spec->name, &stock_id,
                 NULL);
 
-  gtk_image_set_from_stock (GTK_IMAGE (image), stock_id,
-                            GTK_IMAGE (image)->icon_size);
+  gtk_image_get_stock (GTK_IMAGE (image), NULL, &icon_size);
+  gtk_image_set_from_stock (GTK_IMAGE (image), stock_id, icon_size);
 
   if (stock_id)
     g_free (stock_id);

Modified: branches/soc-2008-text/libgimpwidgets/gimpruler.c
==============================================================================
--- branches/soc-2008-text/libgimpwidgets/gimpruler.c	(original)
+++ branches/soc-2008-text/libgimpwidgets/gimpruler.c	Wed Sep  3 21:19:34 2008
@@ -19,33 +19,26 @@
 
 #include "config.h"
 
+#include <string.h>
+
 #include <gtk/gtk.h>
 
 #include "libgimpbase/gimpbase.h"
+#include "libgimpmath/gimpmath.h"
 
 #include "gimpwidgetstypes.h"
 
 #include "gimpruler.h"
 
 
-/* All distances below are in 1/72nd's of an inch. (According to
- * Adobe that's a point, but points are really 1/72.27 in.)
- */
-typedef struct
-{
-  GimpUnit   unit;
-  gdouble    lower;
-  gdouble    upper;
-  gdouble    position;
-  gdouble    max_size;
+#define RULER_WIDTH  13
+#define MINIMUM_INCR  5
 
-  GdkPixmap *backing_store;
-  GdkGC     *non_gr_exp_gc;
-} GimpRulerPrivate;
 
 enum
 {
   PROP_0,
+  PROP_ORIENTATION,
   PROP_UNIT,
   PROP_LOWER,
   PROP_UPPER,
@@ -53,23 +46,62 @@
   PROP_MAX_SIZE
 };
 
-static void  gimp_ruler_realize       (GtkWidget      *widget);
-static void  gimp_ruler_unrealize     (GtkWidget      *widget);
-static void  gimp_ruler_size_allocate (GtkWidget      *widget,
-                                       GtkAllocation  *allocation);
-static gint  gimp_ruler_expose        (GtkWidget      *widget,
-                                       GdkEventExpose *event);
-static void  gimp_ruler_draw_ticks    (GimpRuler      *ruler);
-static void  gimp_ruler_draw_pos      (GimpRuler      *ruler);
-static void  gimp_ruler_make_pixmap   (GimpRuler      *ruler);
-static void  gimp_ruler_set_property  (GObject        *object,
-                                       guint            prop_id,
-                                       const GValue   *value,
-                                       GParamSpec     *pspec);
-static void  gimp_ruler_get_property  (GObject        *object,
-                                       guint           prop_id,
-                                       GValue         *value,
-                                       GParamSpec     *pspec);
+
+/* All distances below are in 1/72nd's of an inch. (According to
+ * Adobe that's a point, but points are really 1/72.27 in.)
+ */
+typedef struct
+{
+  GtkOrientation  orientation;
+  GimpUnit        unit;
+  gdouble         lower;
+  gdouble         upper;
+  gdouble         position;
+  gdouble         max_size;
+
+  GdkPixmap      *backing_store;
+  GdkGC          *non_gr_exp_gc;
+
+  gint            xsrc;
+  gint            ysrc;
+} GimpRulerPrivate;
+
+
+static const struct
+{
+  gdouble  ruler_scale[16];
+  gint     subdivide[5];
+} ruler_metric =
+{
+  { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000, 2500, 5000, 10000, 25000, 50000, 100000 },
+  { 1, 5, 10, 50, 100 }
+};
+
+
+static void          gimp_ruler_set_property  (GObject        *object,
+                                               guint            prop_id,
+                                               const GValue   *value,
+                                               GParamSpec     *pspec);
+static void          gimp_ruler_get_property  (GObject        *object,
+                                               guint           prop_id,
+                                               GValue         *value,
+                                               GParamSpec     *pspec);
+
+static void          gimp_ruler_realize       (GtkWidget      *widget);
+static void          gimp_ruler_unrealize     (GtkWidget      *widget);
+static void          gimp_ruler_size_allocate (GtkWidget      *widget,
+                                               GtkAllocation  *allocation);
+static gboolean      gimp_ruler_motion_notify (GtkWidget      *widget,
+                                               GdkEventMotion *event);
+static gboolean      gimp_ruler_expose        (GtkWidget      *widget,
+                                               GdkEventExpose *event);
+
+static void          gimp_ruler_draw_ticks    (GimpRuler      *ruler);
+static void          gimp_ruler_draw_pos      (GimpRuler      *ruler);
+static void          gimp_ruler_make_pixmap   (GimpRuler      *ruler);
+static PangoLayout * gimp_ruler_create_layout (GtkWidget      *widget,
+                                               const gchar    *text);
+
 
 G_DEFINE_TYPE (GimpRuler, gimp_ruler, GTK_TYPE_WIDGET)
 
@@ -83,20 +115,27 @@
   GObjectClass   *object_class = G_OBJECT_CLASS (klass);
   GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
 
-  object_class->set_property = gimp_ruler_set_property;
-  object_class->get_property = gimp_ruler_get_property;
-
-  widget_class->realize       = gimp_ruler_realize;
-  widget_class->unrealize     = gimp_ruler_unrealize;
-  widget_class->size_allocate = gimp_ruler_size_allocate;
-  widget_class->expose_event  = gimp_ruler_expose;
+  object_class->set_property        = gimp_ruler_set_property;
+  object_class->get_property        = gimp_ruler_get_property;
 
-  klass->draw_ticks = NULL;
-  klass->draw_pos   = NULL;
+  widget_class->realize             = gimp_ruler_realize;
+  widget_class->unrealize           = gimp_ruler_unrealize;
+  widget_class->size_allocate       = gimp_ruler_size_allocate;
+  widget_class->motion_notify_event = gimp_ruler_motion_notify;
+  widget_class->expose_event        = gimp_ruler_expose;
 
   g_type_class_add_private (object_class, sizeof (GimpRulerPrivate));
 
   g_object_class_install_property (object_class,
+                                   PROP_ORIENTATION,
+                                   g_param_spec_enum ("orientation",
+                                                      "Orientation",
+                                                      "The orientation of the ruler",
+                                                      GTK_TYPE_ORIENTATION,
+                                                      GTK_ORIENTATION_HORIZONTAL,
+                                                      GIMP_PARAM_READWRITE));
+
+  g_object_class_install_property (object_class,
                                    PROP_LOWER,
                                    gimp_param_spec_unit ("unit",
                                                          "Unit",
@@ -149,8 +188,14 @@
 static void
 gimp_ruler_init (GimpRuler *ruler)
 {
-  GimpRulerPrivate *priv = GIMP_RULER_GET_PRIVATE (ruler);
+  GtkWidget        *widget = GTK_WIDGET (ruler);
+  GtkStyle         *style  = gtk_widget_get_style (widget);
+  GimpRulerPrivate *priv   = GIMP_RULER_GET_PRIVATE (ruler);
 
+  widget->requisition.width  = style->xthickness * 2 + 1;
+  widget->requisition.height = style->ythickness * 2 + RULER_WIDTH;
+
+  priv->orientation   = GTK_ORIENTATION_HORIZONTAL;
   priv->unit          = GIMP_PIXELS;
   priv->lower         = 0;
   priv->upper         = 0;
@@ -171,6 +216,25 @@
 
   switch (prop_id)
     {
+    case PROP_ORIENTATION:
+      {
+        GtkWidget *widget = GTK_WIDGET (ruler);
+        GtkStyle  *style  = gtk_widget_get_style (widget);
+
+        priv->orientation = g_value_get_enum (value);
+        if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
+          {
+            widget->requisition.width  = style->xthickness * 2 + 1;
+            widget->requisition.height = style->ythickness * 2 + RULER_WIDTH;
+          }
+        else
+          {
+            widget->requisition.width  = style->xthickness * 2 + RULER_WIDTH;
+            widget->requisition.height = style->ythickness * 2 + 1;
+          }
+        gtk_widget_queue_resize (widget);
+      }
+      break;
     case PROP_UNIT:
       gimp_ruler_set_unit (ruler, g_value_get_int (value));
       break;
@@ -195,6 +259,7 @@
                             priv->upper,
                             g_value_get_double (value));
       break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -212,6 +277,9 @@
 
   switch (prop_id)
     {
+    case PROP_ORIENTATION:
+      g_value_set_enum (value, priv->orientation);
+      break;
     case PROP_UNIT:
       g_value_set_int (value, priv->unit);
       break;
@@ -227,6 +295,7 @@
     case PROP_MAX_SIZE:
       g_value_set_double (value, priv->max_size);
       break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -234,6 +303,24 @@
 }
 
 /**
+ * gimp_ruler_new:
+ * @orientation: the ruler's orientation.
+ *
+ * Creates a new ruler.
+ *
+ * Return value: a new #GimpRuler widget.
+ *
+ * Since: GIMP 2.8
+ **/
+GtkWidget *
+gimp_ruler_new (GtkOrientation orientation)
+{
+  return g_object_new (GIMP_TYPE_RULER,
+                       "orientation", orientation,
+                       NULL);
+}
+
+/**
  * gimp_ruler_set_position:
  * @ruler: a #GimpRuler
  * @unit:  the #GimpUnit to set the ruler to
@@ -399,35 +486,6 @@
     *max_size = priv->max_size;
 }
 
-GdkDrawable *
-_gimp_ruler_get_backing_store (GimpRuler *ruler)
-{
-  return GIMP_RULER_GET_PRIVATE (ruler)->backing_store;
-}
-
-PangoLayout *
-_gimp_ruler_create_pango_layout (GtkWidget   *widget,
-                                 const gchar *text)
-{
-  PangoLayout    *layout;
-  PangoAttrList  *attrs;
-  PangoAttribute *attr;
-
-  layout = gtk_widget_create_pango_layout (widget, text);
-
-  attrs = pango_attr_list_new ();
-
-  attr = pango_attr_scale_new (PANGO_SCALE_X_SMALL);
-  attr->start_index = 0;
-  attr->end_index   = -1;
-  pango_attr_list_insert (attrs, attr);
-
-  pango_layout_set_attributes (layout, attrs);
-  pango_attr_list_unref (attrs);
-
-  return layout;
-}
-
 static void
 gimp_ruler_realize (GtkWidget *widget)
 {
@@ -445,9 +503,9 @@
   attributes.wclass      = GDK_INPUT_OUTPUT;
   attributes.visual      = gtk_widget_get_visual (widget);
   attributes.colormap    = gtk_widget_get_colormap (widget);
-  attributes.event_mask  = gtk_widget_get_events (widget);
-  attributes.event_mask |= (GDK_EXPOSURE_MASK |
-                            GDK_POINTER_MOTION_MASK |
+  attributes.event_mask  = (gtk_widget_get_events (widget) |
+                            GDK_EXPOSURE_MASK              |
+                            GDK_POINTER_MOTION_MASK        |
                             GDK_POINTER_MOTION_HINT_MASK);
 
   attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
@@ -457,7 +515,8 @@
   gdk_window_set_user_data (widget->window, ruler);
 
   widget->style = gtk_style_attach (widget->style, widget->window);
-  gtk_style_set_background (widget->style, widget->window, GTK_STATE_ACTIVE);
+  gtk_style_set_background (gtk_widget_get_style (widget), widget->window,
+                            GTK_STATE_ACTIVE);
 
   gimp_ruler_make_pixmap (ruler);
 }
@@ -480,8 +539,7 @@
       priv->non_gr_exp_gc = NULL;
     }
 
-  if (GTK_WIDGET_CLASS (gimp_ruler_parent_class)->unrealize)
-    (* GTK_WIDGET_CLASS (gimp_ruler_parent_class)->unrealize) (widget);
+  GTK_WIDGET_CLASS (gimp_ruler_parent_class)->unrealize (widget);
 }
 
 static void
@@ -502,7 +560,38 @@
     }
 }
 
-static gint
+static gboolean
+gimp_ruler_motion_notify (GtkWidget      *widget,
+                          GdkEventMotion *event)
+{
+  GimpRuler        *ruler = GIMP_RULER (widget);
+  GimpRulerPrivate *priv  = GIMP_RULER_GET_PRIVATE (ruler);
+  gdouble           lower;
+  gdouble           upper;
+
+  gdk_event_request_motions (event);
+
+  gimp_ruler_get_range (ruler, &lower, &upper, NULL);
+
+  if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
+    {
+      gimp_ruler_set_position (ruler,
+                               lower +
+                               (upper - lower) * event->x /
+                               widget->allocation.width);
+    }
+  else
+    {
+      gimp_ruler_set_position (ruler,
+                               lower +
+                               (upper - lower) * event->y /
+                               widget->allocation.height);
+    }
+
+  return FALSE;
+}
+
+static gboolean
 gimp_ruler_expose (GtkWidget      *widget,
                    GdkEventExpose *event)
 {
@@ -529,30 +618,323 @@
 static void
 gimp_ruler_draw_ticks (GimpRuler *ruler)
 {
-  g_return_if_fail (GIMP_IS_RULER (ruler));
+  GtkWidget        *widget = GTK_WIDGET (ruler);
+  GtkStyle         *style  = gtk_widget_get_style (widget);
+  GimpRulerPrivate *priv   = GIMP_RULER_GET_PRIVATE (ruler);
+  cairo_t          *cr;
+  gint              i;
+  gint              width, height;
+  gint              xthickness;
+  gint              ythickness;
+  gint              length, ideal_length;
+  gdouble           lower, upper;  /* Upper and lower limits, in ruler units */
+  gdouble           increment;     /* Number of pixels per unit */
+  gint              scale;         /* Number of units per major unit */
+  gdouble           start, end, cur;
+  gchar             unit_str[32];
+  gint              digit_height;
+  gint              digit_offset;
+  gint              text_size;
+  gint              pos;
+  gdouble           max_size;
+  GimpUnit          unit;
+  PangoLayout      *layout;
+  PangoRectangle    logical_rect, ink_rect;
+
+  if (! GTK_WIDGET_DRAWABLE (widget))
+    return;
+
+  xthickness = style->xthickness;
+  ythickness = style->ythickness;
+
+  layout = gimp_ruler_create_layout (widget, "012456789");
+  pango_layout_get_extents (layout, &ink_rect, &logical_rect);
+
+  digit_height = PANGO_PIXELS (ink_rect.height) + 2;
+  digit_offset = ink_rect.y;
+
+  if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
+    {
+      width  = widget->allocation.width;
+      height = widget->allocation.height - ythickness * 2;
+    }
+  else
+    {
+      width  = widget->allocation.height;
+      height = widget->allocation.width - ythickness * 2;
+    }
+
+  gtk_paint_box (style, priv->backing_store,
+                 GTK_STATE_NORMAL, GTK_SHADOW_OUT,
+                 NULL, widget,
+                 priv->orientation == GTK_ORIENTATION_HORIZONTAL ?
+                 "hruler" : "vruler",
+                 0, 0,
+                 widget->allocation.width, widget->allocation.height);
+
+  cr = gdk_cairo_create (priv->backing_store);
+  gdk_cairo_set_source_color (cr, &style->fg[widget->state]);
+
+  if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
+    {
+      cairo_rectangle (cr,
+                       xthickness,
+                       height + ythickness,
+                       widget->allocation.width - 2 * xthickness,
+                       1);
+    }
+  else
+    {
+      cairo_rectangle (cr,
+                       height + xthickness,
+                       ythickness,
+                       1,
+                       widget->allocation.height - 2 * ythickness);
+    }
+
+  gimp_ruler_get_range (ruler, &lower, &upper, &max_size);
+
+  if ((upper - lower) == 0)
+    goto out;
+
+  increment = (gdouble) width / (upper - lower);
+
+  /* determine the scale
+   *   use the maximum extents of the ruler to determine the largest
+   *   possible number to be displayed.  Calculate the height in pixels
+   *   of this displayed text. Use this height to find a scale which
+   *   leaves sufficient room for drawing the ruler.
+   *
+   *   We calculate the text size as for the vruler instead of using
+   *   text_size = gdk_string_width(font, unit_str), so that the result
+   *   for the scale looks consistent with an accompanying vruler
+   */
+  scale = ceil (max_size);
+  g_snprintf (unit_str, sizeof (unit_str), "%d", scale);
+  text_size = strlen (unit_str) * digit_height + 1;
+
+  for (scale = 0; scale < G_N_ELEMENTS (ruler_metric.ruler_scale); scale++)
+    if (ruler_metric.ruler_scale[scale] * fabs (increment) > 2 * text_size)
+      break;
+
+  if (scale == G_N_ELEMENTS (ruler_metric.ruler_scale))
+    scale = G_N_ELEMENTS (ruler_metric.ruler_scale) - 1;
+
+  unit = gimp_ruler_get_unit (ruler);
+
+  /* drawing starts here */
+  length = 0;
+  for (i = G_N_ELEMENTS (ruler_metric.subdivide) - 1; i >= 0; i--)
+    {
+      gdouble subd_incr;
+
+      /* hack to get proper subdivisions at full pixels */
+      if (unit == GIMP_UNIT_PIXEL && scale == 1 && i == 1)
+        subd_incr = 1.0;
+      else
+        subd_incr = ((gdouble) ruler_metric.ruler_scale[scale] /
+                     (gdouble) ruler_metric.subdivide[i]);
+
+      if (subd_incr * fabs (increment) <= MINIMUM_INCR)
+        continue;
+
+      /* don't subdivide pixels */
+      if (unit == GIMP_UNIT_PIXEL && subd_incr < 1.0)
+        continue;
+
+      /* Calculate the length of the tickmarks. Make sure that
+       * this length increases for each set of ticks
+       */
+      ideal_length = height / (i + 1) - 1;
+      if (ideal_length > ++length)
+        length = ideal_length;
+
+      if (lower < upper)
+        {
+          start = floor (lower / subd_incr) * subd_incr;
+          end   = ceil  (upper / subd_incr) * subd_incr;
+        }
+      else
+        {
+          start = floor (upper / subd_incr) * subd_incr;
+          end   = ceil  (lower / subd_incr) * subd_incr;
+        }
+
+      for (cur = start; cur <= end; cur += subd_incr)
+        {
+          pos = ROUND ((cur - lower) * increment);
+
+          if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
+            {
+              cairo_rectangle (cr,
+                               pos, height + ythickness - length,
+                               1,   length);
+            }
+          else
+            {
+              cairo_rectangle (cr,
+                               height + xthickness - length, pos,
+                               length,                       1);
+            }
+
+          /* draw label */
+          if (i == 0)
+            {
+              g_snprintf (unit_str, sizeof (unit_str), "%d", (int) cur);
+
+              if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
+                {
+                  pango_layout_set_text (layout, unit_str, -1);
+                  pango_layout_get_extents (layout, &logical_rect, NULL);
+
+                  gtk_paint_layout (style,
+                                    priv->backing_store,
+                                    GTK_WIDGET_STATE (widget),
+                                    FALSE,
+                                    NULL,
+                                    widget,
+                                    "hruler",
+                                    pos + 2,
+                                    ythickness + PANGO_PIXELS (logical_rect.y - digit_offset),
+                                    layout);
+                }
+              else
+                {
+                  gint j;
+
+                  for (j = 0; j < (int) strlen (unit_str); j++)
+                    {
+                      pango_layout_set_text (layout, unit_str + j, 1);
+                      pango_layout_get_extents (layout, NULL, &logical_rect);
+
+                      gtk_paint_layout (style,
+                                        priv->backing_store,
+                                        GTK_WIDGET_STATE (widget),
+                                        FALSE,
+                                        NULL,
+                                        widget,
+                                        "vruler",
+                                        xthickness + 1,
+                                        pos + digit_height * j + 2 + PANGO_PIXELS (logical_rect.y - digit_offset),
+                                        layout);
+                    }
+                }
+            }
+        }
+    }
+
+  cairo_fill (cr);
+out:
+  cairo_destroy (cr);
 
-  if (GIMP_RULER_GET_CLASS (ruler)->draw_ticks)
-    GIMP_RULER_GET_CLASS (ruler)->draw_ticks (ruler);
+  g_object_unref (layout);
 }
 
 static void
 gimp_ruler_draw_pos (GimpRuler *ruler)
 {
-  g_return_if_fail (GIMP_IS_RULER (ruler));
+  GtkWidget        *widget = GTK_WIDGET (ruler);
+  GtkStyle         *style  = gtk_widget_get_style (widget);
+  GimpRulerPrivate *priv   = GIMP_RULER_GET_PRIVATE (ruler);
+  gint              x, y;
+  gint              width, height;
+  gint              bs_width, bs_height;
+  gint              xthickness;
+  gint              ythickness;
+
+  if (! GTK_WIDGET_DRAWABLE (ruler))
+    return;
+
+  xthickness = style->xthickness;
+  ythickness = style->ythickness;
+
+  if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
+    {
+      width  = widget->allocation.width;
+      height = widget->allocation.height - ythickness * 2;
+
+      bs_width = height / 2 + 2;
+      bs_width |= 1;  /* make sure it's odd */
+      bs_height = bs_width / 2 + 1;
+    }
+  else
+    {
+      width  = widget->allocation.width - xthickness * 2;
+      height = widget->allocation.height;
+
+      bs_height = width / 2 + 2;
+      bs_height |= 1;  /* make sure it's odd */
+      bs_width = bs_height / 2 + 1;
+    }
+
+  if ((bs_width > 0) && (bs_height > 0))
+    {
+      cairo_t *cr = gdk_cairo_create (widget->window);
+      gdouble  lower;
+      gdouble  upper;
+      gdouble  position;
+      gdouble  increment;
+
+      /*  If a backing store exists, restore the ruler  */
+      if (priv->backing_store)
+        gdk_draw_drawable (widget->window,
+                           style->black_gc,
+                           priv->backing_store,
+                           priv->xsrc, priv->ysrc,
+                           priv->xsrc, priv->ysrc,
+                           bs_width, bs_height);
+
+      position = gimp_ruler_get_position (ruler);
 
-  if (GIMP_RULER_GET_CLASS (ruler)->draw_pos)
-     GIMP_RULER_GET_CLASS (ruler)->draw_pos (ruler);
+      gimp_ruler_get_range (ruler, &lower, &upper, NULL);
+
+      if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
+        {
+          increment = (gdouble) width / (upper - lower);
+
+          x = ROUND ((position - lower) * increment) + (xthickness - bs_width) / 2 - 1;
+          y = (height + bs_height) / 2 + ythickness;
+        }
+      else
+        {
+          increment = (gdouble) height / (upper - lower);
+
+          x = (width + bs_width) / 2 + xthickness;
+          y = ROUND ((position - lower) * increment) + (ythickness - bs_height) / 2 - 1;
+        }
+
+      gdk_cairo_set_source_color (cr, &style->fg[widget->state]);
+
+      cairo_move_to (cr, x, y);
+
+      if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
+        {
+          cairo_line_to (cr, x + bs_width / 2.0, y + bs_height);
+          cairo_line_to (cr, x + bs_width,       y);
+        }
+      else
+        {
+          cairo_line_to (cr, x + bs_width, y + bs_height / 2.0);
+          cairo_line_to (cr, x,            y + bs_height);
+        }
+
+      cairo_fill (cr);
+
+      cairo_destroy (cr);
+
+      priv->xsrc = x;
+      priv->ysrc = y;
+    }
 }
 
 static void
 gimp_ruler_make_pixmap (GimpRuler *ruler)
 {
-  GimpRulerPrivate *priv   = GIMP_RULER_GET_PRIVATE (ruler);
   GtkWidget        *widget = GTK_WIDGET (ruler);
+  GimpRulerPrivate *priv   = GIMP_RULER_GET_PRIVATE (ruler);
   gint              width;
   gint              height;
 
-
   if (priv->backing_store)
     {
       gdk_drawable_get_size (priv->backing_store, &width, &height);
@@ -574,3 +956,26 @@
       gdk_gc_set_exposures (priv->non_gr_exp_gc, FALSE);
     }
 }
+
+static PangoLayout *
+gimp_ruler_create_layout (GtkWidget   *widget,
+                          const gchar *text)
+{
+  PangoLayout    *layout;
+  PangoAttrList  *attrs;
+  PangoAttribute *attr;
+
+  layout = gtk_widget_create_pango_layout (widget, text);
+
+  attrs = pango_attr_list_new ();
+
+  attr = pango_attr_scale_new (PANGO_SCALE_X_SMALL);
+  attr->start_index = 0;
+  attr->end_index   = -1;
+  pango_attr_list_insert (attrs, attr);
+
+  pango_layout_set_attributes (layout, attrs);
+  pango_attr_list_unref (attrs);
+
+  return layout;
+}

Modified: branches/soc-2008-text/libgimpwidgets/gimpruler.h
==============================================================================
--- branches/soc-2008-text/libgimpwidgets/gimpruler.h	(original)
+++ branches/soc-2008-text/libgimpwidgets/gimpruler.h	Wed Sep  3 21:19:34 2008
@@ -20,7 +20,6 @@
 #ifndef __GIMP_RULER_H__
 #define __GIMP_RULER_H__
 
-
 G_BEGIN_DECLS
 
 #define GIMP_TYPE_RULER            (gimp_ruler_get_type ())
@@ -35,15 +34,12 @@
 
 struct _GimpRuler
 {
-  GtkWidget parent_instance;
+  GtkWidget  parent_instance;
 };
 
 struct _GimpRulerClass
 {
-  GtkWidgetClass parent_class;
-
-  void (* draw_ticks) (GimpRuler *ruler);
-  void (* draw_pos)   (GimpRuler *ruler);
+  GtkWidgetClass  parent_class;
 
   /* Padding for future expansion */
   void (*_gimp_reserved1) (void);
@@ -53,28 +49,23 @@
 };
 
 
-GType     gimp_ruler_get_type   (void) G_GNUC_CONST;
-
-void      gimp_ruler_set_unit     (GimpRuler *ruler,
-                                   GimpUnit   unit);
-GimpUnit  gimp_ruler_get_unit     (GimpRuler *ruler);
-void      gimp_ruler_set_position (GimpRuler *ruler,
-                                   gdouble    position);
-gdouble   gimp_ruler_get_position (GimpRuler *ruler);
-void      gimp_ruler_set_range    (GimpRuler *ruler,
-                                   gdouble    lower,
-                                   gdouble    upper,
-                                   gdouble    max_size);
-void      gimp_ruler_get_range    (GimpRuler *ruler,
-                                   gdouble   *lower,
-                                   gdouble   *upper,
-                                   gdouble   *max_size);
-
-
-GdkDrawable * _gimp_ruler_get_backing_store   (GimpRuler   *ruler) G_GNUC_INTERNAL;
-PangoLayout * _gimp_ruler_create_pango_layout (GtkWidget   *widget,
-                                               const gchar *text)  G_GNUC_INTERNAL;
+GType       gimp_ruler_get_type     (void) G_GNUC_CONST;
 
+GtkWidget * gimp_ruler_new          (GtkOrientation  orientation);
+void        gimp_ruler_set_unit     (GimpRuler      *ruler,
+                                     GimpUnit        unit);
+GimpUnit    gimp_ruler_get_unit     (GimpRuler      *ruler);
+void        gimp_ruler_set_position (GimpRuler      *ruler,
+                                     gdouble         position);
+gdouble     gimp_ruler_get_position (GimpRuler      *ruler);
+void        gimp_ruler_set_range    (GimpRuler      *ruler,
+                                     gdouble         lower,
+                                     gdouble         upper,
+                                     gdouble         max_size);
+void        gimp_ruler_get_range    (GimpRuler      *ruler,
+                                     gdouble        *lower,
+                                     gdouble        *upper,
+                                     gdouble        *max_size);
 
 G_END_DECLS
 

Modified: branches/soc-2008-text/libgimpwidgets/gimpscaleentry.c
==============================================================================
--- branches/soc-2008-text/libgimpwidgets/gimpscaleentry.c	(original)
+++ branches/soc-2008-text/libgimpwidgets/gimpscaleentry.c	Wed Sep  3 21:19:34 2008
@@ -66,7 +66,7 @@
                                    gimp_scale_entry_unconstrained_adjustment_callback,
                                    adjustment);
 
-  gtk_adjustment_set_value (other_adj, adjustment->value);
+  gtk_adjustment_set_value (other_adj, gtk_adjustment_get_value (adjustment));
 
   g_signal_handlers_unblock_by_func (other_adj,
                                      gimp_scale_entry_unconstrained_adjustment_callback,
@@ -104,7 +104,7 @@
                                    gimp_scale_entry_log_adjustment_callback,
                                    adjustment);
 
-  value = exp (adjustment->value);
+  value = exp (gtk_adjustment_get_value (adjustment));
   if (other_adj->lower <= 0.0)
     value += other_adj->lower  - 0.1;
 

Modified: branches/soc-2008-text/libgimpwidgets/gimpwidgets.c
==============================================================================
--- branches/soc-2008-text/libgimpwidgets/gimpwidgets.c	(original)
+++ branches/soc-2008-text/libgimpwidgets/gimpwidgets.c	Wed Sep  3 21:19:34 2008
@@ -975,7 +975,7 @@
 {
   gint *val = (gint *) data;
 
-  *val = RINT (adjustment->value);
+  *val = RINT (gtk_adjustment_get_value (adjustment));
 }
 
 /**
@@ -993,7 +993,7 @@
 {
   guint *val = (guint *) data;
 
-  *val = (guint) (adjustment->value + 0.5);
+  *val = (guint) (gtk_adjustment_get_value (adjustment) + 0.5);
 }
 
 /**
@@ -1007,7 +1007,8 @@
                               gpointer       data)
 {
   gfloat *val = (gfloat *) data;
-  *val = adjustment->value;
+
+  *val = gtk_adjustment_get_value (adjustment);
 
 }
 
@@ -1023,7 +1024,7 @@
 {
   gdouble *val = (gdouble *) data;
 
-  *val = adjustment->value;
+  *val = gtk_adjustment_get_value (adjustment);
 }
 
 /**

Modified: branches/soc-2008-text/libgimpwidgets/gimpwidgets.def
==============================================================================
--- branches/soc-2008-text/libgimpwidgets/gimpwidgets.def	(original)
+++ branches/soc-2008-text/libgimpwidgets/gimpwidgets.def	Wed Sep  3 21:19:34 2008
@@ -157,8 +157,6 @@
 	gimp_help_set_help_data_with_markup
 	gimp_hint_box_get_type
 	gimp_hint_box_new
-	gimp_hruler_get_type
-	gimp_hruler_new
 	gimp_int_adjustment_update
 	gimp_int_combo_box_append
 	gimp_int_combo_box_connect
@@ -307,6 +305,7 @@
 	gimp_ruler_get_range
 	gimp_ruler_get_type
 	gimp_ruler_get_unit
+	gimp_ruler_new
 	gimp_ruler_set_position
 	gimp_ruler_set_range
 	gimp_ruler_set_unit
@@ -358,8 +357,6 @@
 	gimp_unit_menu_set_pixel_digits
 	gimp_unit_menu_set_unit
 	gimp_unit_menu_update
-	gimp_vruler_get_type
-	gimp_vruler_new
 	gimp_widgets_init
 	gimp_zoom_button_new
 	gimp_zoom_model_get_factor

Modified: branches/soc-2008-text/libgimpwidgets/gimpwidgets.h
==============================================================================
--- branches/soc-2008-text/libgimpwidgets/gimpwidgets.h	(original)
+++ branches/soc-2008-text/libgimpwidgets/gimpwidgets.h	Wed Sep  3 21:19:34 2008
@@ -54,7 +54,6 @@
 #include <libgimpwidgets/gimpframe.h>
 #include <libgimpwidgets/gimphelpui.h>
 #include <libgimpwidgets/gimphintbox.h>
-#include <libgimpwidgets/gimphruler.h>
 #include <libgimpwidgets/gimpintcombobox.h>
 #include <libgimpwidgets/gimpintstore.h>
 #include <libgimpwidgets/gimpmemsizeentry.h>
@@ -75,7 +74,6 @@
 #include <libgimpwidgets/gimpstock.h>
 #include <libgimpwidgets/gimpstringcombobox.h>
 #include <libgimpwidgets/gimpunitmenu.h>
-#include <libgimpwidgets/gimpvruler.h>
 #include <libgimpwidgets/gimpzoommodel.h>
 
 #include <libgimpwidgets/gimpoldwidgets.h>

Modified: branches/soc-2008-text/tools/test-clipboard.c
==============================================================================
--- branches/soc-2008-text/tools/test-clipboard.c	(original)
+++ branches/soc-2008-text/tools/test-clipboard.c	Wed Sep  3 21:19:34 2008
@@ -366,8 +366,7 @@
                                                            FALSE));
   if (data)
     {
-      gsize bytes;
-      gint  fd;
+      gint fd;
 
       fd = open (filename, O_WRONLY | O_CREAT | O_TRUNC, 0644);
 
@@ -378,9 +377,7 @@
           return FALSE;
         }
 
-      bytes = data->length * data->format / 8;
-
-      if (write (fd, data->data, bytes) < bytes)
+      if (write (fd, data->data, data->length) < data->length)
         {
           close (fd);
           g_printerr ("%s: write() failed: %s",



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