tracing is easy, just add "writeln" after the function call
...
now, compile the project (you should see lazprinters component to be recompiled as well).
open terminal
cd to your project directory
cd to you bundle (project1.app ? )
cd to Contents/MacOS
and launch binary (./project1)
now just get to the point where printers DPI is received and watch the output in your terminal window. It should print the value for you.
Good idea. However, it will work with non-GUI applications only. Most applications on a Mac are GUI-based. They run when launched from Terminal, but they don't allow any interaction via Quartz.
Anyway, please change the code to:
function TCarbonPrinter.GetOutputResolution: PMResolution;
var
res: OSStatus;
Major, Minor: SInt32;
theError: SInt16;
begin
theError := Gestalt(gestaltSystemVersionMajor, Major);
if theError <> 0 then
Major := 0;
theError := Gestalt(gestaltSystemVersionMinor, Minor);
if theError <> 0 then
Minor := 0;
if (Major < 10) or (Minor < 5) then
res := noErr+1;
else
res := PMPrinterGetOutputResolution(GetCurrentPrinter, PrintSettings, Result{%H-});
writeln('PMPrinterGetOutputResolution ', res);
if res<>noErr then
begin
Result.vRes:=72;
Result.hRes:=72;
end;
end;
This avoids the old bug, where the processor architecture, which is totally unimportant in this context, is confused with the OS version.
If your code depends on GUI-based interaction you might want to replace the
writeln statement, so that it writes to a file rather than to the terminal. Alternatively, you could use
DbgAppendToFile() from the
LCLProc unit, which writes debug output to a specified file.