Project JEDI - Issue Tracker
Mantis Bugtracker

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0002537 [JEDI VCL] 00 JVCL Components tweak always 2005-01-21 17:35 2005-04-12 07:24
Reporter anonymous View Status public  
Assigned To obones
Priority normal Resolution fixed  
Status resolved   Product Version
Summary 0002537: JvgRuler does not show correct units
Description
In pixel mode, it's fine.
In centimeter mode, it's fine.
In inches mode, there's a problem. Based on what I see on the screen, it looks like a simple error in the formula. When showing inches, it appears to be multiplying the cm. value instead of dividing it.

The correct setting should be: inches := cm / 2.54
Right now it appears to be set for: inches := cm * 2.54

I'm using 3.00 RC1
Additional Information
Tags No tags attached.
Attached Files

- Relationships

-  Notes
(0006240)
user72
2005-01-22 00:06

Sounds reasonable. After all, one inch == 2.54 cm (approx.)
(0006249)
obones (administrator)
2005-01-22 06:21

I've insvestigated this, and it seems the whole formula is wrong. It gets the Pixels Per Inch value for the screen, and then for an unknown reason multiplies it by 1.541 and divides it by 10. I have no idea why that is, as it should directly use the value from the system without adjustments.
After all, if there are 96 pixels per inch, then a ruler of 192 pixels should show 2 inches and not 25 !
I propose to change, in run\JvgUtils the following functions, starting at line 302, by the following code:

function InchesToPixels(DC: HDC; Value: Single; IsHorizontal: Boolean): Integer;
const
  LogPixels: array [Boolean] of Integer = (LOGPIXELSY, LOGPIXELSX);
begin
  Result := Round(Value * GetDeviceCaps(DC, LogPixels[IsHorizontal]));
end;

function CentimetersToPixels(DC: HDC; Value: Single; IsHorizontal: Boolean): Integer;
const
  LogPixels: array [Boolean] of Integer = (LOGPIXELSY, LOGPIXELSX);
begin
  Result := Round(Value * GetDeviceCaps(DC, LogPixels[IsHorizontal])/2.54);
end;


With this, the ruler seems to be much more logical to me.
Could anyone confirm this is alright, so that I can commit those changes?
(0006960)
obones (administrator)
2005-04-12 07:24

Well, this is in CVS and since no one complained about it, I'll assume it is resolved.

- Issue History
Date Modified Username Field Change
2005-01-21 17:35 anonymous New Issue
2005-01-22 00:06 user72 Note Added: 0006240
2005-01-22 06:21 obones Note Added: 0006249
2005-01-22 06:21 obones Assigned To => obones
2005-01-22 06:21 obones Status new => feedback
2005-04-12 07:24 obones Status feedback => resolved
2005-04-12 07:24 obones Resolution open => fixed
2005-04-12 07:24 obones Note Added: 0006960


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker