Issue #230: ruler subdivision is wrong for inches.

Make better subvision, as well as ruler steps, based on what seems to be
the common trends for rulers of these 3 units (inch, foot and yard), but
also based on common conversion needs.

Main changes are:
- Always subdivide inches by 2, down to 1/256, and get rid of the gap
  where inches division jumped from 1/16 to 1/192 (which is not even a
  multiple of 2).
- Add the 72 steps to inch ruler (1 fathom).
- Replace the 2 feet by a 3 feet (1 yard) step.
- Use base-10 steps for yard (there don't seem to be bigger units in the
  imperial/US measurement system which needs specific steps).
- Add the 1/36 yard (= 1 inch) division.
- Below 1/12 feet and 1/36 yard, divide by multiples of 2 (inch-style).
This commit is contained in:
Jehan 2019-06-23 16:29:47 +02:00
parent 39c71c6fb3
commit 2b22dffc49
1 changed files with 26 additions and 6 deletions

View File

@ -94,20 +94,33 @@ static const RulerMetric ruler_metric_decimal =
static const RulerMetric ruler_metric_inches =
{
{ 1, 2, 6, 12, 36, 100, 250, 500, 1000, 2500, 5000, 10000, 25000, 50000, 100000 },
{ 1, 4, 8, 16, 12 * 16 }
/* 12 inch = 1 foot; 36 inch = 1 yard; 72 inchs = 1 fathom */
{ 1, 2, 6, 12, 36, 72, 100, 250, 500, 1000, 2500, 5000, 10000, 25000, 50000, 100000 },
/* Inches are divided by multiples of 2. */
{ 1, 2, 4, 8, 16, 32, 64, 128, 256 }
};
static const RulerMetric ruler_metric_feet =
{
{ 1, 2, 6, 12, 36, 100, 250, 500, 1000, 2500, 5000, 10000, 25000, 50000, 100000 },
{ 1, 3, 6, 12, 12 * 8 }
/* 3 feet = 1 yard; 6 feet = 1 fathom */
{ 1, 3, 6, 12, 36, 100, 250, 500, 1000, 2500, 5000, 10000, 25000, 50000, 100000 },
/* 1 foot = 12 inches, so let's divide up to 12. */
{ 1, 3, 6, 12,
/* then since inches are divided by 2, continue by 2-divisions. */
24, 48, 96, 192 }
};
static const RulerMetric ruler_metric_yards =
{
{ 1, 2, 6, 12, 36, 100, 250, 500, 1000, 2500, 5000, 10000, 25000, 50000, 100000 },
{ 1, 3, 6, 12, 12 * 12 }
/* 1 fathom = 2 yards. Should we go back to base-10 digits? */
{ 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000, 2500, 5000, 10000, 25000, 50000, 100000 },
/* 1 yard = 3 feet = 36 inches. */
{ 1, 3, 6, 12, 36,
/* Then divide by 2, inch style */
72, 144, 288 }
};
@ -1389,6 +1402,13 @@ gimp_ruler_get_metric (GimpUnit unit)
{
return &ruler_metric_inches;
}
/* XXX: recognizing feet or yard unit this way definitely sucks.
* Actually the subdvision and rule scale rules should probably become
* settable values in unitrc instead of hardcoded rules.
* This way, people would be able to set how they want a unit to be
* shown (we could definitely imagine someone wanting to see inches
* with base-10 divisions).
*/
else if (FACTOR_EQUAL (unit, 0.083333))
{
return &ruler_metric_feet;