wiki:TEXT_AUTO_CHAIN_BEHAVIOUR_R1
Last modified 15 years ago Last modified on 10/05/09 17:11:04

Error: Macro BackLinksMenu(None) failed
compressed data is corrupt

Error: Macro TicketQuery(summary=TEXT_AUTO_CHAIN_BEHAVIOUR_R1, format=table, col=summary|owner|status|type|component|priority|effort|importance, rows=description|analysis_owners|analysis_reviewers|analysis_score|design_owners|design_reviewers|design_score|implementation_owners|implementation_reviewers|implementation_score|test_owners|test_reviewers|test_score|) failed
current transaction is aborted, commands ignored until end of transaction block

Analysis

Overview

There should be an automatic chaining availability when text frame is used.

Task requirements

  • Add a new object in the frame list for chaining: "Auto chain".
  • When setting auto chaining to a text frame and it overflows, the following things should be acquired:
    • If next page exist and it is empty (without any content) and not modified then the next page takes the previous page's template and therefore text frame is created with the same properties as the first one (position, size, background etc.).The both frames are linked.
    • If next page exist and it is not empty then a new page with the previous page's template is created after the current page and therefore a text frame is created with the same properties as the first one (position, size, background etc.).The both frames are linked. All the pages after the new created one are shifted after it.
    • If there is no next page, then it's created with the previous page's template and therefore with a text frame with the same properties as the first one (position, size, background etc.).The both frames are linked.
    • If there are some text frames(not one) on the page and the last text frame overflow then a new page with the previous page's template and therefore with the same number, location, size and style of the linked text frames is created and the new created frames are linked in the same way as in the previous page and they are linked with the last one of the first page.
    • When a new frame is created by overflowing of other one then the new created frame's link should automatic becomes auto chain.
  • Deleting a text frame which is part of linked text frames deletes the frame and:
    • If the frame is the first one in the chain, then the frame and all the text in the chain is deleted but the text is saved in Resources . The links between the others are saved as if there are not modified pages, having only empty text frames, these pages are deleted without loosing the links in the chain.
    • If the frame is a middle frame in the chain, then in case of no destructing the links between the frames before and after the deleted frame link them, save the links between the other frames in the new created chain and save the text.
    • If the frame is the last one then the frame is deleted without destroying the chain before it and the text in the chain is saved.
  • Deleting a page that contains linked text frames with other pages' frames should act in the same way as deleting a frame but including all the linked frames in the page.
  • Unlinking text frames
    • If the unlinked text frame is the first one in the chain, then all the text in the chain is saved in this frame. The links between the other text frames in the chain are saved as if there are not modified pages, having only empty text frames, these pages are deleted without loosing the links in the chain.
    • If the unlinked text frame is a middle one in the chain, then the text frame is divided from the chain as the text frame before it is linked to the text frame after it and the links between the other text frames in the chain and the text are preserved.
    • If the text frame is the last one then it is divided from the chain without destroying the chain before it and the text in the chain is saved.

Task result

The result is code.

Implementation idea

Add auto chain in the list of chained frames:



Auto chain should always be available for a text frame.

TEXT_AUTO_CHAIN_BEHAVIOUR_R0
TEXT_CHAINING_BEHAVIOUR_R0
TEXT_AUTO_CHAIN_MULTI_FLOW_R0
TEXT_CHAIN_HALOS_R0

How to demo

  1. Create a new book.
  2. Insert a frame in it.
  3. Choose an Auto chain for the frame.
  4. Overflow by writing in the frame.

Expected behavior: A new page with the same template and therefore a frame with the same properties as the first one (position, size, background etc.) should be created and it should be linked with the overflowed one.

  1. Insert a new frame on the second page.
  2. Link the two frames.
  3. Overflow the second text frame by writing in the frame.

Expected behavior: A new page with the same template and therefore the same two linked text frames with the same properties as the first one (position, size, background etc.) should be created and they should be linked with the overflowed one from the previous page.

  1. Delete the second page.

Expected behavior:The second page is deleted and the last frame of the first page is linked to the first added frame of the third frame. A new page is created at the end of the book with the same template as the page before it because of the default auto chain of the last frame of ex-last page.

  1. Change the link of the last frame in the last book from auto chain to none.
  2. Delete the current second page.

Expected behavior: The second page is deleted and the last frame of the first page is linked to the first added frame of the third frame. A new page at the end is not created.

  1. Unlink the first frame of the current second page.

Expected behavior: The first frame in the second frame is unlinked from the chain but it doesn't destruct the link between the other two frames in the chain. They are directly linked.

Design

This design depends to a great extent on the design of TEXT_CHAINING_BEHAVIOUR_R1. Please have a look at it for details. This task will change only the logic and fix some bugs left after the previous task.

At this iteration, auto chaining will not be fully automatic. A button will be added in the TextChainHud that will reflow the text. That is, when the user clicks it, it will automatically add new pages and frames and chain them to the currently selected one until the text fits in the flow. Since chaining will not be really "automatic", the KEY_CHAIN_MODE in HeadTextFrameR4 will not be set now. Chaining mode will be used when the chaining becomes truly automatic. Here's how the initial version of the hud will look like:

For the needs of this task, the HotLayout class will be extended with two methods:

  • isTextConsumed(ImmHotText text) will return a boolean value indicating whether the text fits in the areas of the current flow or not (needed for overflowing).
  • getNeededAreasCount(ImmHotText text) will return an integer value indicating how many areas of the same size as the first one are needed for laying out the whole text (needed for underflowing).

Since deleting pages is currently quite buggy recomputing underflowed text might not be implemented at this iteration.

Here's an updated version of the test for chaining: TextChainingSystemTest.java, commited at revision [6906].

Implementation

Implemented with the following known issues:

  • If you chain to a frame with a text in it, it is hidden instead of appended.
  • When you link two chains, references to the head are not updated. This might lead to strange behaviour and/or crashes.
  • Auto-chaining does not copy the properties of the selected frame to the newly inserted frames. Templating is requred for this.
  • Auto-chaining does not delete unnecessary frames if the text underflows.
  • Sometimes test fails with strange pro-lib errors.
  • Text does not wrap correctly with rotation.
  • HUD stays open after you chain a frame.
  • Grouping chained frames may cause crashes.

These will be fixed as bugs after the integration of the current task. Commited in the following changesets: [6758], [6759] - merged from trunk, [6768], [6840], [6906] - test and design, [6917], [6923], [6934] Created a clean branch at [7003], merged from the old one (with no merge properties) at [7033].

Commited second implementation in [7050], [7067], [7158], [7172], [7182], [7189]. Merged from trunk in [7204], fixed a wrongly commited dir in [7205] and some bugs in [7207], [7234].

This task also fixes bugs 2040, 2056, 2058, 2079, 2089, 2090.

Known issues:

  • Auto-chaining does not copy the properties of the selected frame to the newly inserted frames.
  • Auto-chaining does not delete unnecessary frames if the text underflows.
  • Grouping chained frames may cause crashes.
  • Rotate halo sometimes overlaps with chain halo.
  • Undo/redo does not work properly with chaining.

Merged to the trunk in [7259].

Testing

Place the testing results here.

Comments

Write comments for this or later revisions here.

Attachments