One line fixes for 2.6.3: print preview
Olly Betts
olly at survex.com
Wed Jul 5 12:15:43 PDT 2006
On 2006-07-03, Vadim Zeitlin wrote:
> On Sun, 2 Jul 2006 13:45:46 +0000 (UTC) Olly Betts wrote:
> > On 2006-07-02, Daniel Walter wrote:
> > > Using a single zoom scale for print preview will only work nicely when
> > > both the printer and the monitor are isotropic.
> >
> > I discovered this when testing on a machine where this wasn't the case,
> > so now I have code to deal with this in my OnPrintPage:
> >
> > GetPageSizePixels(&xpPageWidth, &ypPageDepth);
> > pdc = GetDC();
> > if (IsPreview()) {
> > int dcx, dcy;
> > pdc->GetSize(&dcx, &dcy);
> > pdc->SetUserScale((double)dcx / xpPageWidth, (double)dcy / ypPageDepth);
> > }
>
> Can this be integrated in wx somehow?
Quite possibly. I didn't realise that the current behaviour was
unintentional...
You couldn't just stick it in the userscale like that since that
presumably should default to (1,1) (though wxDC's documentation doesn't
actually say that...), but I guess wxPrinterDC could implement
SetUserScale and GetUserScale itself, and call the base class versions
with the extra scaling applied/removed.
It really needs someone who can actually test it though...
> AFAICS the old calculation was just wrong anyhow so even if we kept using
> Y-direction values, the result would still be different.
Ah, I'd not noticed that one term was incorrectly reciprocated in the
old version.
Cheers,
Olly
More information about the wx-dev
mailing list