Version 7 (modified by vlado, 16 years ago) (diff) |
---|
Analysis
- The goal of this task is to integrate the new text into Sophie with all existing old functionality and addition of new features.
Overview
- Handle Priority 2 and 3 tasks specified in HOT_TEXT_REDESIGN_R1.
- Integrate text with new resources
- Make persisters for all needed classes
- Make AutoActions for all Operations in the Logic that change the text
- Text and Text Layout performance
- Use a profiler to find problems
- Control memory consumption
- Implement Chaining using the existing old functionality and the new design.
- Implement Anchoring (as a separate task)
- Extend the text usability documentation with proper uses of text by the client code.
Task requirements
- Implement the tasks specified in the Overview
- Anchoring is optional
Task result
- Source code
- Wiki page (text documentation)
Implementation idea
- Specified in the Overview section
Related
How to demo
Design
- Integration of the new text into Sophie
- Models
- Views
- Text Views
- A new TextView abstract class is added that contains:
- A TextViewFlow holding the data needed by the view
- Text
- Areas
- Text layout
- Mark position
- Caret position
- Extra highlights (from searches, etc.)
- Editable flag
- Note: By extending the flow the text view's state could be diversified.
- The index of the view in a possible sequence of views (chaining or other)
- Interaction map
- Note: By extending the TextView itself its drawing logic could be diversified.
- A TextViewFlow holding the data needed by the view
- SceneTextView inheriting TextView is added.
- It is abstract to allow overriding of its model.
- Contains the scene element.
- SwingTextView inheriting TextView is added to use swing drawing.
- A new TextView abstract class is added that contains:
- Text Views
- Element views
- A new HotTextView interface is added to enforce the usage of TextView class.
- HeadTextFrameView is created to represent either a single view or a view which is the head of a chain.
- It contains the (shared) flow of the whole chain.
- TailTextFrameView is created to represent a view which is chained.
- It refers to its related HeadTextFrameView in the chaining.
- Through the head view it accessed its TextViewFlow.
- Logics
- Modify the operation for creation of a text frame (ON_ADD_TEXT_FRAME) to use AutoActions, new resources and new text.
- Create a new TextFlowLogic class with the following responsibilities
- It is a basic logic and has no knowledge of how to set the model.
- Handles all text events.
- Calculates the needed changes to the text.
- Fires a new SET_TEXT event to be handled by the logics that should set the model.
- Updates the flow (the view state).
- Create the logics that modify the model
- SimpleTextLogic
- Directly sets the text to the SimpleTextFlow of the view
- Mainly used for testing purposes
- HotTextLogic
- Sets text to the model through AutoAction.
- Adding a new text frame moved to HotTextLogic.
- SimpleTextLogic
- Styling
- Can be applied in two ways
- For a whole interval - range of positions
- Default behaviour: The style is applied from the position before the first character of the interval to the position before the first character after the interval.
- Typing interactions before the interval are not styled with the applied style
- Typing interactions right after the interval are styled with the applied style
- Example:
- Styled text - "Test text"
- Input chars - "Test tTexTt"
- For a single position
- Default behaviour: The style is applied only for the position itself.
- Typing interactions at the position are styled with the applied style
- Example:
- Styled text - "Test text" with applied style between 'x' and 't'.
- Input chars - "Test texTt"
- For a whole interval - range of positions
- Styles are applied through the TextFontHud on the current selection interval.
- TextView.EventIds.APPLY_STYLE event id is fired to handle styling interactions.
- It has two parameters - style attribute and value.
- The event is handled the same way as other modifying operations on text - a new SET_TEXT event is fired to set the new text with applied style.
- Can be applied in two ways
- Testing
- Use SwingDemoTest and LineEndsDemoTest.
- Chaining will be done in a separate task.
Implementation
(Describe and link the implementation results here (from the wiki or the repository).)
Testing
(Place the testing results here.)
Comments
(Write comments for this or later revisions here.)
Attachments
- text-views.png (98.4 KB) - added by vlado 16 years ago.
- text-frame-views.png (53.9 KB) - added by vlado 16 years ago.