gimp r25835 - in trunk: . libgimpwidgets



Author: neo
Date: Wed May 28 09:48:07 2008
New Revision: 25835
URL: http://svn.gnome.org/viewvc/gimp?rev=25835&view=rev

Log:
2008-05-28  Sven Neumann  <sven gimp org>

	* libgimpwidgets/gimpruler.[ch]
	* libgimpwidgets/gimphruler.c
	* libgimpwidgets/gimpvruler.c: enlarge the array of scales to
	prevent ruler numbers from overlapping (bug #535039).



Modified:
   trunk/ChangeLog
   trunk/libgimpwidgets/gimphruler.c
   trunk/libgimpwidgets/gimpruler.c
   trunk/libgimpwidgets/gimpruler.h
   trunk/libgimpwidgets/gimpvruler.c

Modified: trunk/libgimpwidgets/gimphruler.c
==============================================================================
--- trunk/libgimpwidgets/gimphruler.c	(original)
+++ trunk/libgimpwidgets/gimphruler.c	Wed May 28 09:48:07 2008
@@ -33,7 +33,6 @@
 #define RULER_HEIGHT          13
 #define MINIMUM_INCR          5
 #define MAXIMUM_SUBDIVIDE     5
-#define MAXIMUM_SCALES        10
 
 
 typedef struct
@@ -187,12 +186,12 @@
   g_snprintf (unit_str, sizeof (unit_str), "%d", scale);
   text_width = strlen (unit_str) * digit_height + 1;
 
-  for (scale = 0; scale < MAXIMUM_SCALES; scale++)
+  for (scale = 0; scale < G_N_ELEMENTS (metric->ruler_scale); scale++)
     if (metric->ruler_scale[scale] * fabs (increment) > 2 * text_width)
       break;
 
-  if (scale == MAXIMUM_SCALES)
-    scale = MAXIMUM_SCALES - 1;
+  if (scale == G_N_ELEMENTS (metric->ruler_scale))
+    scale = G_N_ELEMENTS (metric->ruler_scale) - 1;
 
   /* drawing starts here */
   length = 0;

Modified: trunk/libgimpwidgets/gimpruler.c
==============================================================================
--- trunk/libgimpwidgets/gimpruler.c	(original)
+++ trunk/libgimpwidgets/gimpruler.c	Wed May 28 09:48:07 2008
@@ -75,15 +75,18 @@
 {
   {
     "Pixel", "Pi", 1.0,
-    { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }
+    { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000, 2500, 5000, 10000, 25000, 50000, 100000 },
+    { 1, 5, 10, 50, 100 }
   },
   {
     "Inches", "In", 72.0,
-    { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512 }, { 1, 2, 4, 8, 16 }
+    { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768 },
+    { 1, 2, 4, 8, 16 }
   },
   {
-    "Centimeters", "Cn", 28.35,
-    { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }
+    "Centimeters", "Cm", 28.35,
+    { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000, 2550, 5000, 10000, 25000, 50000, 100000 },
+    { 1, 5, 10, 50, 100 }
   }
 };
 

Modified: trunk/libgimpwidgets/gimpruler.h
==============================================================================
--- trunk/libgimpwidgets/gimpruler.h	(original)
+++ trunk/libgimpwidgets/gimpruler.h	Wed May 28 09:48:07 2008
@@ -60,7 +60,7 @@
   /* This should be points_per_unit. This is the size of the unit
    * in 1/72nd's of an inch and has nothing to do with screen pixels */
   gdouble      pixels_per_unit;
-  gdouble      ruler_scale[10];
+  gdouble      ruler_scale[16];
   gint         subdivide[5];        /* five possible modes of subdivision */
 };
 

Modified: trunk/libgimpwidgets/gimpvruler.c
==============================================================================
--- trunk/libgimpwidgets/gimpvruler.c	(original)
+++ trunk/libgimpwidgets/gimpvruler.c	Wed May 28 09:48:07 2008
@@ -33,7 +33,6 @@
 #define RULER_WIDTH           13
 #define MINIMUM_INCR          5
 #define MAXIMUM_SUBDIVIDE     5
-#define MAXIMUM_SCALES        10
 
 
 typedef struct
@@ -188,12 +187,12 @@
   g_snprintf (unit_str, sizeof (unit_str), "%d", scale);
   text_height = strlen (unit_str) * digit_height + 1;
 
-  for (scale = 0; scale < MAXIMUM_SCALES; scale++)
+  for (scale = 0; scale <  G_N_ELEMENTS (metric->ruler_scale); scale++)
     if (metric->ruler_scale[scale] * fabs (increment) > 2 * text_height)
       break;
 
-  if (scale == MAXIMUM_SCALES)
-    scale = MAXIMUM_SCALES - 1;
+  if (scale ==  G_N_ELEMENTS (metric->ruler_scale))
+    scale = G_N_ELEMENTS (metric->ruler_scale) - 1;
 
   /* drawing starts here */
   length = 0;



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