issue-#73 Custom tags in headers and footers

Merged to the master branch
Post Reply
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

issue-#73 Custom tags in headers and footers

Post by Josef Templ »

I have created issue-#73 from the CPC 1.7 rc5 change list number 56.
For the issue see http://redmine.blackboxframework.org/issues/73.
I will work on the changes for this issue after issue-#69 has been committed because
otherwise we would create a merge conflict.

A general discussion topic is the fact that the proposal in CPC 1.7 rc5 contains
in addition to the proposed hook also an extended set of standard tags (see docu of Printing)
that I have proposed earlier. With the later invention of an "ExpandHook" the need for
those extended standard-tags went away for me. I leave it to the center if they should
be included as well. The extended standard-tags cover
+ printing on the first page only
+ printing on follow up pages only
+ printing the next page number in arabic numbers

- Josef
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: issue-#73 Custom tags in headers and footers

Post by Josef Templ »

For the changes see http://redmine.blackboxframework.org/pr ... 8e79cdae64.

The set of standard tags is unchanged so far.

- Josef
User avatar
Robert
Posts: 1024
Joined: Sat Sep 28, 2013 11:04 am
Location: Edinburgh, Scotland

Re: issue-#73 Custom tags in headers and footers

Post by Robert »

I thought that we were trying to get a new stable version of BlackBox out with the known bugs removed; we were not trying to choose and implement new features at this time. This feels like a new feature - have I misunderstood?

By only providing the new Hook and not the expanded set of features each user will have to reinvent them for themselves. Have these features, with their implementations, been described somewhere?

We are talking featureS, plural. Might it be easier to have several simple Hooks, each of which implements just one. Then if we wanted several features at once we would want to specify a list of Hooks. This, I suspect, would be easy to implement just by adding a next field to each Hook?
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: issue-#73 Custom tags in headers and footers

Post by Josef Templ »

Robert wrote:I thought that we were trying to get a new stable version of BlackBox out with the known bugs removed; we were not trying to choose and implement new features at this time. This feels like a new feature - have I misunderstood?
We are in alpha 1 phase (a1) working through the CPC 1.7 rc5/6 change list, which contains both bugs and features.
Most of the simple issues have been resolved by now. There are a couple of more heavy weight changes
which I postponed so far because they involve a large set of files and that would block working on multiple
issues in parallel.
Robert wrote:By only providing the new Hook and not the expanded set of features each user will have to reinvent them for themselves. Have these features, with their implementations, been described somewhere?
The hook must be seen as application specific extension. For example, I once got the requirement to
print not only the page number in the footer but also the number of the follow-up page if there was one.
This was a legal requirement for the kind of document (a contract) printed in this application.
If you get such a requirement you need a way to solve it.
So far I had to create a copy of module Printing and modify it but this is
a maintenance nightmare. With the hook such problems can be solved easily and I am well prepared for any
similar future request.
Now, if some of my application specific extensions are of general interest, I am happy to share them
but for me the hook is the more important thing.
The extensions that may be of general interest are documented in the CPC 1.7 rc5 change list.
In detail

Code: Select all

&q - page number + 1 as arabic numeral
&1 - range [&~, &1] in section is cleared if page number is > 1; i.e. print on first page only
&2 - range [&~, &2] in section is cleared if page number is < 2; i.e. do not print on first page
&~ specifies delimiter for &1, &2
Robert wrote: We are talking featureS, plural. Might it be easier to have several simple Hooks, each of which implements just one. Then if we wanted several features at once we would want to specify a list of Hooks. This, I suspect, would be easy to implement just by adding a next field to each Hook?
For that we could simply (read-only) export the Printing.expandHook proc var.
Then you can chain the calls without maintaining an explicit list.
For such a rarely used feature maintaining an extra list seems an overkill
and the chaining of the calls gives you full control over the execution order.

- Josef
User avatar
Robert
Posts: 1024
Joined: Sat Sep 28, 2013 11:04 am
Location: Edinburgh, Scotland

Re: issue-#73 Custom tags in headers and footers

Post by Robert »

I haven't studied the code in detail, so forgive me if I still misunderstand ...

The current proposal seems to be:

1 - Provide for the capability of adding additional tags - new features.
2 - Make very small changes to BlackBox
3 - Most of the new capability and code will be in the user's private Modules in a Hook routine.

I suspect that we could stay with this approach, but provide much more capability. I am thinking of multi-line Headers with possibly several colours and Fonts, and maybe bitmaps of company logos etc.

The idea is for BlackBox to create a Text initialised with the current header. It would then pass it to the user, with the Info record, in the Hook procedure. The user could then alter this Text in any way she wanted.

Maybe a potential problem is if BlackBox needs to know the size (height) of the headers at the start of the printing process? This could be handled by another Hook procedure that optionally replaces the current height, passed it as a default, by the new height allowance. If a header Text becomes bigger than this then BlackBox would simply clip it.
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: issue-#73 Custom tags in headers and footers

Post by Josef Templ »

Multi-line headers and footers are an extension far beyond this issue.
The issue-#73 is only related to single line headers and footers as used in BB1.6.
It is a minimalistic extension in the sense that it allows for custom tags.
If the mentioned new tags are also included it would still be a small change
compared to introducing multi-line headers and footers.

I have added the export of the expandHook in order to allow for chaining of expandHooks.
See the diffs at http://redmine.blackboxframework.org/pr ... 4ee1c80ebc.

- Josef
Post Reply