libgimpwidgets/gimpruler.[ch] libgimpwidgets/gimphruler.c enlarge the

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).


svn path=/trunk/; revision=25835
This commit is contained in:
Sven Neumann 2008-05-28 09:48:07 +00:00 committed by Sven Neumann
parent 6653d0bb1f
commit 305e672d3c
5 changed files with 21 additions and 13 deletions

View File

@ -1,3 +1,10 @@
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).
2008-05-27 Michael Natterer <mitch@gimp.org>
* plug-ins/help-browser/dialog.c: undef

View File

@ -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 @@ gimp_hruler_draw_ticks (GimpRuler *ruler)
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;

View File

@ -75,15 +75,18 @@ static const GimpRulerMetric const ruler_metrics[] =
{
{
"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 }
}
};

View File

@ -60,7 +60,7 @@ struct _GimpRulerMetric
/* 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 */
};

View File

@ -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 @@ gimp_vruler_draw_ticks (GimpRuler *ruler)
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;