[comp.sys.mac.programmer] Problems using PrGeneral

nebel@wam.umd.edu (Chris D. Nebel) (12/07/90)

I'm attempting to write a page setup routine that allows the user to select
any of the resolutions that the current printer claims it can handle, e.g.
300 dpi on a Laserwriter.  Getting the possible resolutions and setting a
new one is no problem; the problem I'm having is in allowing the user to turn
the hi-res stuff off.  Basically, I want the print record to look as if I
never called SetRsl at all.  Now, IM-V claims that calling SetRsl with an
unsupported resolution will set the print record back to the default
resolution, but it seems to do nothing at all!  Say I call SetRsl (150,150).
Checking prInfo.iHRes, I see that it is now 150.  I call SetRsl with (0,0),
it gives me a NoSuchRsl error, but if I look at prInfo.iHRes, it's still 150!
Am I doing something wrong, or is IM just lying?

If the SetRsl (0,0) business just doesn't work, then what's the best tack to
take?  I considered calling SetRsl (72,72), but I've heard that a default print
record is different from one that's been SetRsl'd to 72 dpi.  Is this true?  If
so, how?

Thanks,
Chris Nebel
nebel@wam.umd.edu

neil@odin.ucsd.edu (Neil Rhodes) (12/07/90)

In article <1990Dec6.204027.13037@wam.umd.edu> nebel@wam.umd.edu (Chris D. Nebel) writes:
>I'm attempting to write a page setup routine that allows the user to select
>any of the resolutions that the current printer claims it can handle, e.g.
>300 dpi on a Laserwriter.  Getting the possible resolutions and setting a
>new one is no problem; the problem I'm having is in allowing the user to turn
>the hi-res stuff off.  Basically, I want the print record to look as if I
>never called SetRsl at all.  Now, IM-V claims that calling SetRsl with an
>unsupported resolution will set the print record back to the default
>resolution, but it seems to do nothing at all!  Say I call SetRsl (150,150).
>Checking prInfo.iHRes, I see that it is now 150.  I call SetRsl with (0,0),
>it gives me a NoSuchRsl error, but if I look at prInfo.iHRes, it's still 150!
>Am I doing something wrong, or is IM just lying?
>
>If the SetRsl (0,0) business just doesn't work, then what's the best tack to
>take?  I considered calling SetRsl (72,72), but I've heard that a default print
>record is different from one that's been SetRsl'd to 72 dpi.  Is this true?  If
>so, how?
>
>Thanks,
>Chris Nebel
>nebel@wam.umd.edu


It is a bug in the Laserwriter driver that SetRsl(0, 0) doesn't give you a 
default print record.

Driver			0, 0		72, 72
Laserwriter		noOp		resets to default
Imagewriter	resets to default	sets to 72 NOT DEFAULT
PaintWriter	resets to default	resets to default
PaintJet	resets to default	resets to default
PlotterGeist	resets to default	resets to default
Deswriter	resets to default	resets to default

Given the differences, I think the safest bet is:
SetRsl(72, 72);	/* works for all drivers except imagewriter */
SetRsl(0,0);	/* doesn't hurt, and fixes Imagewriter */

The combination of these two SetRsls in a row should take care of every case.
-- 
Neil Rhodes    Calliope Enterprises, Inc.  neil@odin.ucsd.edu

CXT105@psuvm.psu.edu (Christopher Tate) (12/12/90)

What happens if you do a SetRsl(-1, -1) instead of SetRsl(0,0) ?  Is that
a sufficiently "undefined" resolution to force the default, or do the two
behave alike?

-------
Christopher Tate                  |
                                  |        "Joy is the serious
cxt105@psuvm.psu.edu              |         business of heaven."
{...}!psuvax1!psuvm.bitnet!cxt105 |
cxt105@psuvm.bitnet               |           -- C. S. Lewis