diff options
| author | Alex Valavanis <valavanisalex@gmail.com> | 2012-12-31 13:38:00 +0000 |
|---|---|---|
| committer | Alex Valavanis <valavanisalex@gmail.com> | 2012-12-31 13:38:00 +0000 |
| commit | cf96e2170b696c55977ed90b020813684b9d0000 (patch) | |
| tree | d27de59d5ebf9eff22b3c054e8c81c96a65a114f /src/widgets/ruler.cpp | |
| parent | Replace C-style pointer casts in event contexts (diff) | |
| download | inkscape-cf96e2170b696c55977ed90b020813684b9d0000.tar.gz inkscape-cf96e2170b696c55977ed90b020813684b9d0000.zip | |
rulers: (Merge from GIMP) Set range in ruler units, not in px
(bzr r12002)
Diffstat (limited to 'src/widgets/ruler.cpp')
| -rw-r--r-- | src/widgets/ruler.cpp | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/src/widgets/ruler.cpp b/src/widgets/ruler.cpp index 733de2239..34d8f1bc5 100644 --- a/src/widgets/ruler.cpp +++ b/src/widgets/ruler.cpp @@ -88,15 +88,15 @@ typedef struct /// Ruler metrics. static SPRulerMetric const sp_ruler_metrics[] = { // NOTE: the order of records in this struct must correspond to the SPMetric enum. - {1, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }}, // SP_NONE - {PX_PER_MM, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }}, // SP_MM - {PX_PER_CM, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }}, // SP_CM - {PX_PER_IN, { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512 }, { 1, 2, 4, 8, 16 }}, // SP_IN - {PX_PER_FT, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }}, // SP_FT - {PX_PER_PT, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }}, // SP_PT - {PX_PER_PC, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }}, // SP_PC - {PX_PER_PX, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }}, // SP_PX - {PX_PER_M, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }}, // SP_M + {{ 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }}, // SP_NONE + {{ 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }}, // SP_MM + {{ 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }}, // SP_CM + {{ 1, 2, 4, 8, 16, 32, 64, 128, 256, 512 }, { 1, 2, 4, 8, 16 }}, // SP_IN + {{ 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }}, // SP_FT + {{ 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }}, // SP_PT + {{ 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }}, // SP_PC + {{ 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }}, // SP_PX + {{ 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }}, // SP_M }; @@ -1252,11 +1252,6 @@ sp_ruler_draw_ticks (SPRuler *ruler) sp_ruler_get_range (ruler, &lower, &upper, &max_size); - upper /= priv->metric->pixels_per_unit; // upper and lower are expressed in ruler units - lower /= priv->metric->pixels_per_unit; - /* "pixels_per_unit" 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 */ - if ((upper - lower) == 0) goto out; @@ -1272,7 +1267,7 @@ sp_ruler_draw_ticks (SPRuler *ruler) * actually measuring the text width, so that the result for the * scale looks consistent with an accompanying vruler */ - scale = (gint)(ceil(priv->max_size / priv->metric->pixels_per_unit)); + scale = ceil (priv->max_size); sprintf (unit_str, "%d", scale); text_size = strlen (unit_str) * digit_height + 1; |
