margins pref no longer works

RESOLVED FIXED

Status

()

Core
Printing: Output
RESOLVED FIXED
15 years ago
15 years ago

People

(Reporter: Jessica Blanco, Unassigned)

Tracking

Trunk
x86
All
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 2 obsolete attachments)

(Reporter)

Description

15 years ago
In Mozilla you use to be able to have the following prefs set in all.js and
mozilla would print all documents with no margins.

pref("print.print_margin_bottom", "0.0");
pref("print.print_margin_left", "0.0");
pref("print.print_margin_right", "0.0");
pref("print.print_margin_top", "0.0");

You cannot do this anymore.  Now Mozilla will look to see if a specific printer
will have the settings and if not will then set the default margin values to
0.5.  I think the above prefs should still be able to be used.  They are
generic, not printer specific, and can be used as the default settings for every
printer that's used in Mozilla. This allows the user to set the default printer
margin settings to whatever they wish.
(Reporter)

Comment 1

15 years ago
Created attachment 133855 [details] [diff] [review]
patch to be able to use non printer specific margin prefs

What mozilla does now is look for the specific printer setting and use that
margin setting. If there is no pref set, it will set the margin to 0.5. With my
patch mozilla will look for the specific printer setting first and will use
that margin setting. If the margin pref is not set, it will then look for the
generic pref without the appended printer name and will use that setting.  If
there is no specific printer or non specific printer margin pref set, it will
set the margin to 0.5.

Comment 2

15 years ago
Comment on attachment 133855 [details] [diff] [review]
patch to be able to use non printer specific margin prefs

strcmpi is so not portable :)
Attachment #133855 - Flags: review-

Comment 3

15 years ago
use:

nsCRT::strcasecmp
(Reporter)

Comment 4

15 years ago
Created attachment 134042 [details] [diff] [review]
using nsCRT::strcasecmp
(Reporter)

Updated

15 years ago
Attachment #133855 - Attachment is obsolete: true
Comment on attachment 134042 [details] [diff] [review]
using nsCRT::strcasecmp

> void nsPrintOptions::ReadInchesToTwipsPref(const char * aPrefId, 
>-                                           nscoord&     aTwips)
>+                                           nscoord&     aTwips,
>+                                           const char * aMarginPref)
> {
>   if (!mPrefBranch) {
>     return;
>@@ -1153,6 +1141,8 @@
>       aTwips = 0;
>     }
>     nsMemory::Free(str);
>+  } else if (nsCRT::strcasecmp(aPrefId, aMarginPref) ) {
>+      ReadInchesToTwipsPref(aMarginPref, aTwips, aMarginPref);
>   }
> }

sr=dbaron if, instead of adding a recursive call here, you do something like:

   nsresult rv = mPrefBranch->GetCharPref(aPrefId, &str);
+  if (NS_FAILED(rv) || !str)
+    rv = mPrefBranch->GetCharPref(aMarginPref, &str);
   if (NS_SUCCEEDED(rv) && str) {
(Reporter)

Comment 6

15 years ago
Created attachment 134517 [details] [diff] [review]
not recursive anymore
Attachment #134042 - Attachment is obsolete: true

Updated

15 years ago
Attachment #134517 - Flags: review?(mkaply)

Updated

15 years ago
Attachment #134517 - Flags: review?(mkaply) → review+
I checked this in now
Status: NEW → RESOLVED
Last Resolved: 15 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.