wiki:ANCHORING_MODE_COMMONS_R0

Version 19 (modified by diana, 16 years ago) (diff)

--

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

Error: Macro TicketQuery(summary=ANCHORING_MODE_COMMONS_R0, 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 are different anchoring modes defining the way a frame should move according to the frame it is anchored to: In this revision of the task only character mode anchor will be implemented. Since drag n drop is not ready yet, the anchor hud will be used for defining where to anchor the frame. The goal of this revision is to implement anchoring support and demonstrate it's working.

Task requirements

  • Create anchor halo. It should be draggable and clickable halo.
  • Create anchor HUD with two dropdowns - Frame (frame list) and position (numbers) (like in trigger HUD). When the anchor is implemented, position dropdown won't be needed and will be removed.
    • Frame defines to which frame will this be anchored and position - to which position of the text.
  • When a frame is attached to a position, when position is moved the frame is moved with the same offset as the position. This means that if the character is moved with 10 px right and down, the frame will be moved too.
  • The frame can be moved by the user
  • A frame cannot be attached to itself.

Task result

The result of this task is source code.

Implementation idea

Create an interface named Attachment.

ANCHOR_HALO_R0

How to demo

  • Create a book, insert text frame, type in some text
  • Insert second frame, click anchor halo, select the first frame from the dropdown and position 3 for example
  • Move cursor in position 1 and type in some more text.

Design

In order to provide the anchoring prototype the following changes are made:

  • in org.sophie2.base.model.text package add interface Attachable which is used to determine which elements could be attached to other ones.
  • in ImmHotText class add Map<Interval,Attachment> and change the constructors of the class(in order to initialize the new map)
  • in ImmHotText class add getter method getAttachmentMap that returns the map with the text's attachments.
  • in org.sophie2.main.func.text.content.view package add a new enum AnchorMode. It holds the six modes of the anchoring.
  • add a new package org.sophie2.base.model.text.anchoring
  • in org.sophie2.base.model.text.anchoring package add a new class AnchorText implements Attachment. It is used for anchoring in the text. This class contains :
    • final mode : AnchorMode
    • final resourceRef : ResourceRefR4
    • constructor with two parameters and getters for the mode and for the resourceRef.
  • in org.sophie2.main.app.commons.frame package add a new class AnchorView extends ElementView. It's idea is to visualize the anchor as an element in the frame. It's chiledView prop is of type FrameView. This class has public abstract ResourceH getAnchoredModel() method.
  • in org.sophie2.main.func.text.anchoring package add a new class AnchorTextView extends AnchorView that represents views of the anchors in the text.
  • in HotTextResourceH add a new method public ImmList<ResourceRefR4> getChildren()(this class owns the anchored resources).
  • in FrameView add ListProp<AnchorView> that holds all the anchored views in the frame(with annotation Own)
  • in HotTextLogic class add ON_INSERT_ANCHOR that contains the logic of adding an anchor to the current text.
  • in org.sophie2.main.func.text.anchoring package add a new class TextAnchorHaloButton extends HudHaloButton for the anchoring hud.
  • in org.sophie2.main.func.text.anchoring package add a new class TextAnchorHud with two children TextAnchorHud.TextAttachmentComboBox.class,

TextAnchorHud.TextCharacterComboBox.class - the first is to show all the available frames to be attached and the second is to show the available positions in the text that the resource can be attached to.

source:branches/private/diana/new-res-anchor1/sophie2-platform/doc/uml-design-diagrams/anchoring_view_model.png source:branches/private/diana/new-res-anchor1/sophie2-platform/doc/uml-design-diagrams/anchoring_model.png

tests can be found here: [6639][6641]

Implementation

(Implementation results should be described and linked here (from the wiki or the repository))

Testing

Comments

(Write comments for this or later revisions here.)