You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by gm...@apache.org on 2005/05/05 06:54:08 UTC

cvs commit: xml-fop/src/java/org/apache/fop/layoutmgr PageSequenceLayoutManager.java

gmazza      2005/05/04 21:54:08

  Modified:    src/java/org/apache/fop/layoutmgr Tag:
                        Temp_KnuthStylePageBreaking
                        PageSequenceLayoutManager.java
  Log:
  More clarifications to PSLM.
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.50.2.22 +33 -34    xml-fop/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java
  
  Index: PageSequenceLayoutManager.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java,v
  retrieving revision 1.50.2.21
  retrieving revision 1.50.2.22
  diff -u -r1.50.2.21 -r1.50.2.22
  --- PageSequenceLayoutManager.java	30 Apr 2005 22:57:08 -0000	1.50.2.21
  +++ PageSequenceLayoutManager.java	5 May 2005 04:54:08 -0000	1.50.2.22
  @@ -133,7 +133,7 @@
           if (pageSeq.getTitleFO() != null) {
               ContentLayoutManager clm = new ContentLayoutManager(pageSeq
                       .getTitleFO(), this);
  -            title = (LineArea) clm.getParentArea(null); // can improve
  +            title = (LineArea) clm.getParentArea(null);
           }
   
           areaTreeHandler.getAreaTreeModel().startPageSequence(title);
  @@ -207,8 +207,8 @@
                           // if this is the first page that will be created by
                           // the current BlockSequence, it could have a break
                           // condition that must be satisfied;
  -                        // otherwise, we simply need a new page
  -                        handleBreak(bIsFirstPage ? list.getStartOn() : Constants.EN_PAGE);
  +                        // otherwise, we may simply need a new page
  +                        handleBreakBefore(bIsFirstPage ? list.getStartOn() : Constants.EN_PAGE);
                       }
                   }
               }
  @@ -474,14 +474,14 @@
   
       private void prepareNormalFlowArea(Area childArea) {
           // Need span, break
  -        int breakVal = Constants.EN_AUTO;
  +        int breakBeforeVal = Constants.EN_AUTO;
           Integer breakBefore = (Integer)childArea.getTrait(Trait.BREAK_BEFORE);
           if (breakBefore != null) {
  -            breakVal = breakBefore.intValue();
  +            breakBeforeVal = breakBefore.intValue();
           }
  -        if (breakVal != Constants.EN_AUTO) {
  +        if (breakBeforeVal != Constants.EN_AUTO) {
               // We may be forced to make new page
  -            handleBreak(breakVal);
  +            handleBreakBefore(breakBeforeVal);
           }
           /* Determine if a new span is needed.  From the XSL
            * fo:region-body definition, if an fo:block has a span="ALL"
  @@ -544,23 +544,25 @@
        * or page. May need to make an empty page if next page would
        * not have the desired "handedness".
        *
  -     * @param breakVal the break value to handle
  +     * @param breakBefore - the break-before trait of the area
  +     * currently being processed.
        */
  -    private void handleBreak(int breakVal) {
  -        if (breakVal == Constants.EN_COLUMN) {
  +    private void handleBreakBefore(int breakBefore) {
  +        if (breakBefore == Constants.EN_COLUMN) {
               if (curFlowIdx < curPV.getCurrentSpan().getColumnCount()) {
                   // Move to next column
                   curFlowIdx++;
  -                return;
  +            } else {
  +                curPV = makeNewPage(false, false, false);
               }
  -            // else need new page
  -            breakVal = Constants.EN_PAGE;
  +            return;
           }
  -        log.debug("handling break after page " + currentPageNum + " breakVal=" + breakVal);
  -        if (needEmptyPage(breakVal)) {
  +        log.debug("handling break-before after page " + currentPageNum 
  +            + " breakVal=" + breakBefore);
  +        if (needEmptyPage(breakBefore)) {
               curPV = makeNewPage(true, false, false);
           }
  -        if (needNewPage(breakVal)) {
  +        if (needNewPage(breakBefore)) {
               curPV = makeNewPage(false, false, false);
           }
       }
  @@ -573,36 +575,33 @@
        * it will flow onto another page or not, so we'd probably better
        * block until the queue of layoutable stuff is empty!
        */
  -    private boolean needEmptyPage(int breakValue) {
  -
  -        if (breakValue == Constants.EN_PAGE || ((curPV != null) && curPV.getPage().isEmpty())) {
  +    private boolean needEmptyPage(int breakBefore) {
  +        if (breakBefore == Constants.EN_PAGE || (curPV.getPage().isEmpty())) {
               // any page is OK or we already have an empty page
               return false;
           } else {
               /* IF we are on the kind of page we need, we'll need a new page. */
  -            if (currentPageNum % 2 != 0) {
  -                // Current page is odd
  -                return (breakValue == Constants.EN_ODD_PAGE);
  -            } else {
  -                return (breakValue == Constants.EN_EVEN_PAGE);
  +            if (currentPageNum % 2 == 0) { // even page
  +                return (breakBefore == Constants.EN_EVEN_PAGE);
  +            } else { // odd page
  +                return (breakBefore == Constants.EN_ODD_PAGE);
               }
           }
       }
   
       /**
  -     * See if need to generate a new page for a forced break condition.
  +     * See if need to generate a new page
        */
  -    private boolean needNewPage(int breakValue) {
  -        if (curPV != null && curPV.getPage().isEmpty()) {
  -            if (breakValue == Constants.EN_PAGE) {
  +    private boolean needNewPage(int breakBefore) {
  +        if (curPV.getPage().isEmpty()) {
  +            if (breakBefore == Constants.EN_PAGE) {
                   return false;
               }
  -            else if (currentPageNum % 2 != 0) {
  -                // Current page is odd
  -                return (breakValue == Constants.EN_EVEN_PAGE);
  +            else if (currentPageNum % 2 == 0) { // even page
  +                return (breakBefore == Constants.EN_ODD_PAGE);
               }
  -            else {
  -                return (breakValue == Constants.EN_ODD_PAGE);
  +            else { // odd page
  +                return (breakBefore == Constants.EN_EVEN_PAGE);
               }
           } else {
               return true;
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org


Re: cvs commit: xml-fop/src/java/org/apache/fop/layoutmgr PageSequenceLayoutManager.java

Posted by The Web Maestro <th...@gmail.com>.
On May 6, 2005, at 2:56 AM, Chris Bowditch wrote:
> Andreas L. Delmelle wrote:
>>> -----Original Message-----
>>> From: Jeremias Maerki [mailto:dev.jeremias@greenmail.ch]
>>>>> Glen:
>>>>> Ja, jetzt sollen wir das alterer Kodierung (pNFA() usw.) 
>>>>> entfernen. ...
>>>
>>> English: Yes, we should remove the old code now.
>> Of course 'should', got my modal verbs mixed up again :-)
>
> Thanks for the translation. Am I the only non-german speaking 
> committer on the FOP project?!?
>
> Chris

No... and you're quite right, that 'official' FOP business should be in 
English. But niceties tend to go back and forth in this group, and I 
don't mind. It adds a bit of spice IMHO.

In any case, I tend to use Babelfish or Google's Language Tools when I 
come across something I don't completely understand... In addition, I 
wrote it off as not really being important, as it was written in 
German. I don't say that to be particularly snobbish... but if it were 
important, I figured it would've been in English.

Regards,

Web Maestro Clay
-- 
<th...@gmail.com> - <http://homepage.mac.com/webmaestro/>
My religion is simple. My religion is kindness.
- HH The 14th Dalai Lama of Tibet


Re: cvs commit: xml-fop/src/java/org/apache/fop/layoutmgr PageSequenceLayoutManager.java

Posted by Chris Bowditch <bo...@hotmail.com>.
Andreas L. Delmelle wrote:

>>-----Original Message-----
>>From: Jeremias Maerki [mailto:dev.jeremias@greenmail.ch]
> 
> 
>>>>Glen:
>>>>Ja, jetzt sollen wir das alterer Kodierung 
>>>>(pNFA() usw.) entfernen. ...
>>
>>English: Yes, we should remove the old code now. 
> 
> 
> Of course 'should', got my modal verbs mixed up again :-)

Thanks for the translation. Am I the only non-german speaking committer on the 
FOP project?!?

Chris


RE: cvs commit: xml-fop/src/java/org/apache/fop/layoutmgr PageSequenceLayoutManager.java

Posted by "Andreas L. Delmelle" <a_...@pandora.be>.
> -----Original Message-----
> From: Jeremias Maerki [mailto:dev.jeremias@greenmail.ch]

> > > Glen:
> > > Ja, jetzt sollen wir das alterer Kodierung 
> > > (pNFA() usw.) entfernen. ...
> 
> English: Yes, we should remove the old code now. 

Of course 'should', got my modal verbs mixed up again :-)


Greetz,

Andreas

Re: cvs commit: xml-fop/src/java/org/apache/fop/layoutmgr PageSequenceLayoutManager.java

Posted by Jeremias Maerki <de...@greenmail.ch>.
> Jeremias/Glen:
> 
> could you translate this for me? Sorry but I dont speak German!

Here you are:

On 06.05.2005 09:47:33 Chris Bowditch wrote:
> Glen Mazza wrote:
> 
> > Jeremias Maerki wrote:
> > 
> >> Glen,
> >>
> >> I'd like you to revert that one and take a different approach if any.
> >>  
> >>
> > 
> > Kein Problem.  Bald werde ich dass machen, aber nicht dieser Nacht, weil 
> > ich ziemlich muede bin.

English: No problem. I'll do that soon, but not tonight because I'm
rather tired.

> >> handleBreak does really handle break-before AND break-after, so the name
> >> was ok.
> > 
> > 
> > Ja, Sie haben Recht.  Leider habe ich nur die ehemalige 
> > PSLM.prepareNormalFlowArea() gelesen, und von da irrtumlich gelernen, 
> > dass "break-before" die einzel Benutzung war.

English: Yes, you're right. I'm afraid I've read but the former
PSLM.prepareNormalFlowArea(), and erroneously assumed that only "break-before"
was used.

> >> What can be is that there is some left-over code from the
> >> previous approach.
> > 
> > 
> > Ja, jetzt sollen wir das alterer Kodierung (pNFA() usw.) entfernen.  
> > Letztes Januar war PSLM ungefaehr 930 LVK, aber bald wird es vielleicht 
> > nur 560 LVK sein!

English: Yes, we should remove the old code now. Last January, PSLM was
about 930 lines of code, but soon it'll be but 560!


Jeremias Maerki


RE: cvs commit: xml-fop/src/java/org/apache/fop/layoutmgr PageSequenceLayoutManager.java

Posted by "Andreas L. Delmelle" <a_...@pandora.be>.
> -----Original Message-----
> From: Chris Bowditch [mailto:bowditch_chris@hotmail.com]
>

Hi Chris,

Let me have a go...

> Glen Mazza wrote:
> >
> > Kein Problem.  Bald werde ich dass machen, aber nicht
> > dieser Nacht, weil ich ziemlich muede bin.

"No prob. I'll do it soon, but not tonight, because I'm quite tired."

> > Ja, Sie haben Recht.  Leider habe ich nur die ehemalige
> > PSLM.prepareNormalFlowArea() gelesen, und von da irrtumlich gelernen,
> > dass "break-before" die einzel Benutzung war.

(I think it should be 'gelernt' here... but ok, Glen was tired :-) )

"Yes, you're right. Unfortunately, I've only read the former
PSLM.prepareNormalFlowArea(), and inferred from there that "break-before"
was the only use."


> > Ja, jetzt sollen wir das alterer Kodierung (pNFA() usw.) entfernen.
> > Letztes Januar war PSLM ungefaehr 930 LVK, aber bald wird es vielleicht
> > nur 560 LVK sein!

"Yes, and now we will remove the older code (pNFA() etc.). Last January,
PSLM was about 930 LOC, but soon there will be only 560 LOC left!"


Cheers,

Andreas


Re: cvs commit: xml-fop/src/java/org/apache/fop/layoutmgr PageSequenceLayoutManager.java

Posted by Chris Bowditch <bo...@hotmail.com>.
Glen Mazza wrote:

> Jeremias Maerki wrote:
> 
>> Glen,
>>
>> I'd like you to revert that one and take a different approach if any.
>>  
>>
> 
> Kein Problem.  Bald werde ich dass machen, aber nicht dieser Nacht, weil 
> ich ziemlich muede bin.
> 
>> handleBreak does really handle break-before AND break-after, so the name
>> was ok.
> 
> 
> Ja, Sie haben Recht.  Leider habe ich nur die ehemalige 
> PSLM.prepareNormalFlowArea() gelesen, und von da irrtumlich gelernen, 
> dass "break-before" die einzel Benutzung war.
> 
>> What can be is that there is some left-over code from the
>> previous approach.
> 
> 
> Ja, jetzt sollen wir das alterer Kodierung (pNFA() usw.) entfernen.  
> Letztes Januar war PSLM ungefaehr 930 LVK, aber bald wird es vielleicht 
> nur 560 LVK sein!

Jeremias/Glen:

could you translate this for me? Sorry but I dont speak German!

Chris

> 
> Danke,
> Glen
> 
> 
> 



Re: cvs commit: xml-fop/src/java/org/apache/fop/layoutmgr PageSequenceLayoutManager.java

Posted by Glen Mazza <gm...@apache.org>.
Jeremias Maerki wrote:

>Glen,
>
>I'd like you to revert that one and take a different approach if any.
>  
>

Kein Problem.  Bald werde ich dass machen, aber nicht dieser Nacht, weil 
ich ziemlich muede bin.

>handleBreak does really handle break-before AND break-after, so the name
>was ok. 
>

Ja, Sie haben Recht.  Leider habe ich nur die ehemalige 
PSLM.prepareNormalFlowArea() gelesen, und von da irrtumlich gelernen, 
dass "break-before" die einzel Benutzung war.

>What can be is that there is some left-over code from the
>previous approach. 
>

Ja, jetzt sollen wir das alterer Kodierung (pNFA() usw.) entfernen.  
Letztes Januar war PSLM ungefaehr 930 LVK, aber bald wird es vielleicht 
nur 560 LVK sein!

Danke,
Glen


Re: cvs commit: xml-fop/src/java/org/apache/fop/layoutmgr PageSequenceLayoutManager.java

Posted by Jeremias Maerki <de...@greenmail.ch>.
Glen,

I'd like you to revert that one and take a different approach if any.
handleBreak does really handle break-before AND break-after, so the name
was ok. What can be is that there is some left-over code from the
previous approach. I'm not sure but I think we don't even need the
break-* traits anymore because this is already handled during the
creation of element lists. Break-before and break-after are normalized
to the startOn value held by BlockSequence.

On 05.05.2005 06:54:08 gmazza wrote:
> gmazza      2005/05/04 21:54:08
> 
>   Modified:    src/java/org/apache/fop/layoutmgr Tag:
>                         Temp_KnuthStylePageBreaking
>                         PageSequenceLayoutManager.java
>   Log:
>   More clarifications to PSLM.
>   
>   Revision  Changes    Path
>   No                   revision
>   No                   revision
>   1.50.2.22 +33 -34    xml-fop/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java
>   
>   Index: PageSequenceLayoutManager.java
>   ===================================================================
>   RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java,v
<snip/>
>   -                        // otherwise, we simply need a new page
>   -                        handleBreak(bIsFirstPage ? list.getStartOn() : Constants.EN_PAGE);
>   +                        // otherwise, we may simply need a new page
>   +                        handleBreakBefore(bIsFirstPage ? list.getStartOn() : Constants.EN_PAGE);
<snip/>



Jeremias Maerki