Closed Bug 272386 Opened 20 years ago Closed 19 years ago

For print preview header/footer, put several special codes at the same place

Categories

(Core :: Printing: Output, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: atremon, Assigned: atremon)

Details

Attachments

(1 file, 1 obsolete file)

For print preview header/footer, I would like to be able to put several special
codes at the same place (eg headerLeft, footerCenter, etc.), and have a special
code to put total number of pages.
Attachment #167416 - Flags: review?(smontagu)
Comment on attachment 167416 [details] [diff] [review]
&PT1 special code and no return after &PT treatment

If you want to allow any arbitrary combination of codes (which makes more sense
to me than allowing some combinations and not others), you need to remove the
return at the end of each block.

I would rather have a single letter code for "page total", to preserve the
pattern that single letter codes insert one piece of data and the double letter
code &PT inserts two. &T is already taken, of course, but you could use &O, &A,
or &L.

The change also needs to be reflected in the Help files, but that could be done
in a separate bug.
Attachment #167416 - Flags: review?(smontagu) → review-
Component: Layout: Misc Code → Printing
OS: Windows 2000 → All
Hardware: PC → All
> you need to remove the
> return at the end of each block.

The problem is that the SubstValueForCode function used for the next patterns do a 
Truncate() on the string passed if there is no title or url for the document.
So if I set one of the header fields to "Title: &T" and there is no <title>, no
header at all will appear? That seems bogus to me.
Alexandre, if I were you I would remove SubstValueForCode completely and replace
calls to 
 SubstValueForCode(aNewStr, foo, bar);
by
 aNewStr.ReplaceSubstring(foo, bar);

As far as I can tell everything that SubstValueForCode is doing is either wrong
or a workaround for some problem in string code which no longer exists.
(In reply to comment #5)
> ... replace calls to 
>  SubstValueForCode(aNewStr, foo, bar);
> by
>  aNewStr.ReplaceSubstring(foo, bar);

... that might be going too far: better at least do a null-check on "bar" like
the current code for &D
(In reply to comment #6)
> (In reply to comment #5)
> > ... replace calls to 
> >  SubstValueForCode(aNewStr, foo, bar);
> > by
> >  aNewStr.ReplaceSubstring(foo, bar);
> 
> ... that might be going too far: better at least do a null-check on "bar" like
> the current code for &D

Thanks Simon, I think that's what I'm going to do. That SubstValueForCode
function seemed strange to me because of that 'fixingSubstr' stuff. Makes sense
that this was to avoid a bogus behavior of ReplaceSubstring.
Comment on attachment 167623 [details] [diff] [review]
replaced call for SubstValueForCode by ReplaceSubstring, removed all "return;" statements

Hi Simon,

Can you review this new patch for me?
I can't find any doc on setting header footer using nsIPrintSettings.
I looked in embedding docs. Do you know where this might be?
Alex
Attachment #167623 - Flags: review?(smontagu)
Comment on attachment 167623 [details] [diff] [review]
replaced call for SubstValueForCode by ReplaceSubstring, removed all "return;" statements

r=smontagu. Thank you, Alexandre, this is an excellent enhancement.

The help files that mention custom headers and footers are
extensions/help/resources/locale/en-US/nav_help.xhtml and
browser/components/help/locale/en-US/using_firebird.xhtml
Attachment #167623 - Flags: review?(smontagu) → review+
Attachment #167623 - Flags: superreview?(bryner)
Attachment #167623 - Flags: superreview?(bryner) → superreview?(roc)
Attachment #167623 - Flags: superreview?(roc) → superreview+
Does this still need to be checked in?
Let me know if you'd like me to check this in. It looks as if bug 232850 is
about to be fixed, so you may not need me :)
Simon, Kenneth,

It would be nice if this could be checked in, but I thought checkin was only for
drivers until 1.8 is released. So even when I get my write access I'll have to
wait, won't I?
Do I need to change the patch to update the path of the nsPageFrame file?
The freeze seems to have been delayed until after 1.8b2, so this can be checked
in now. You don't need to attach a new patch against the changed location of the
source file.
Alexandre, as Simon said, the tree is actually open right now. Even if it were
closed, it would only mean having to get permission to check in the patch. And
you don't have to check the patch in yourself; you can ask someone else to do it.
Is this still waiting to be checked in? It'd be nice to get this in before the
tree branches...
Yes, Kenneth,
Can you check this in for me?

Or Simon maybe?
Comment on attachment 167623 [details] [diff] [review]
replaced call for SubstValueForCode by ReplaceSubstring, removed all "return;" statements

I will be happy to check this in, if drivers will approve it.
Attachment #167623 - Flags: approval1.8b2?
Comment on attachment 167623 [details] [diff] [review]
replaced call for SubstValueForCode by ReplaceSubstring, removed all "return;" statements

a=asa
Attachment #167623 - Flags: approval1.8b2? → approval1.8b2+
Checked in.
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: