48 | | * create a new class {{{ TextLink }}} in org.sophie2.main.func.text.model package |
49 | | * it will extend {{{ Link }}} and implement {{{ Attachment }}} |
50 | | * it will have 4 ImmColor private fields that are used for highlighting the link in its 4 different states - normal, hover, visited, pressed. |
51 | | * ? maybe the normal state is unnecessary, because the normal style is defined using the text font hud. |
| 49 | * create a new class {{{ LinkAttachment }}} implementing in org.sophie2.main.func.text.model package |
| 50 | * it will implement {{{ Attachment }}} and have a {{{ Link }}} as private field. |
| 51 | * in addition, it will have 4 ImmColor private fields that are used for highlighting the link in its 4 different states - normal, hover, visited, pressed. |
54 | | * Highlights will be added in {{{HeadTextFrameView}}}. |
55 | | * add a new property that contains a list of all hovered links - {{{ ListProp<TextLink> hoveredLinks() }}} |
56 | | * use this property to create the appropriate highlights in {{{ HeadTextFrameView.textView()...textFlow().getExtraHighlights() }}} |
57 | | * override {{{ void touch() }}} in {{{ HotTextElementHelper }}} to depend on the highlights, so that the scene gets repainted when the highlights change. |
58 | | |
59 | | * A new logic will handle switching between the different states and firing {{{ LinkEvent.LINK_ACTION_TRIGGERED }}} when a link has been triggered. |
60 | | * create a new class {{{ TextFrameLogic }}} in org.sophie2.main.func.text.view package with the following operations: |
61 | | * ON_MOUSE_MOVED - takes care of highlighting hovered text links and firing an event if the MOUSE_ENTER and MOUSE_LEAVE triggers have been evoked while the mouse moves over a text frame view. This operation does not cover the case when there are some hovered links and the mouse leaves the frame. |
62 | | * ON_MOUSE_EXITED_FRAME - removes all text links highlights and if necessary fire events for MOUSE_LEAVE trigger evocation. |
63 | | * ON_MOUSE_PRESSED, ON_MOUSE_RELEASED and ON_MOUSE_DOUBLE_CLICKED take care to fire an event if the MOUSE_PRESSED, MOUSE_RELEASED and MOUSE_DOUBLE_CLICKED triggers of a text link have been evoked. |
64 | | * The last 3 operations use a helper method - {{{ private static void fireLinkTriggeredEvents(EventR3 event, LinkTrigger trigger) }}}. |
| 55 | * Highlights |
| 56 | * Highlights will be added in {{{HeadTextFrameView}}}. |
| 57 | * add a new property that contains a list of all hovered links - {{{ ListProp<TextLink> hoveredLinks() }}} |
| 58 | * use this property to create the appropriate highlights in {{{ HeadTextFrameView.textView()...textFlow().getExtraHighlights() }}} |
| 59 | * override {{{ void touch() }}} in {{{ HotTextElementHelper }}} to depend on the highlights, so that the scene gets repainted when the highlights change. |
| 60 | * A new logic will handle switching between the different states and firing InputR3Events related to text links. |
| 61 | * create a new class {{{ TextFrameLogic }}} in org.sophie2.main.func.text.view package with the following operations: |
| 62 | * ON_MOUSE_MOVED - takes care of highlighting hovered text links and firing an MOUSE_ENTERED and MOUSE_EXITED events. This operation does not cover the case when there are some hovered links and the mouse leaves the frame. |
| 63 | * ON_MOUSE_EXITED_FRAME - removes all text links highlights and if necessary fires MOUSE_EXITED events. |
| 64 | * ON_MOUSE_PRESSED, ON_MOUSE_RELEASED and ON_MOUSE_DOUBLE_CLICKED take care to fire MOUSE_PRESSED, MOUSE_RELEASED and MOUSE_CLICKED events connected with text links. |
66 | | * Executing the link actions should be done by already existing logics. |
67 | | * ? However they require a ResourceView in order to use its access to open an access to their argument (frame, page). |
68 | | * ? Maybe we will use the current BookView. In order to do so, we should make sure that all ResourceRef-s in huds are relative to the book. |
| 66 | * Executing links |
| 67 | * {{{ LinkProcessorLogic }}} will take care to fire LINK_ACTION_TRIGGERED events if appropriately. The following operations should be added: |
| 68 | * ON_TEXT_LINK_ENTERED |
| 69 | * ON_TEXT_LINK_EXITED |
| 70 | * ON_TEXT_LINK_PRESSED |
| 71 | * ON_TEXT_LINK_RELEASED |
| 72 | * ON_TEXT_LINK_DOUBLE_CLICKED |
| 73 | * All of them have TextFrameView as source and TextLink as context. |
| 74 | * Executing link actions should be done by already existing logics. |
| 75 | * If a link contains a resource ref, it will be relative to the text frame. |
| 76 | * Therefore, the ResourceView these logics use to open an access to the target will be TextFrameView. |
70 | | * Hud ? |
| 78 | * Huds - general |
| 79 | * The existing {{{ LinksHud }}} should be used for creating links for both elements (frames and pages) and for text attachments. |
| 80 | * The holder property's type will be changed from ElementH to LinkHolder. |
| 81 | * Create a new interface {{{ LinkHolder }}} in org.sophie2.main.app.commons.links with the following methods: |
| 82 | * Link getLink() - gets the link model of this holder. |
| 83 | * ResourceRefR4 getRef() - gets a reference to the owner of this holder. |
| 84 | * List<LinkTrigger> getTriggers() - gets a list of all possible triggers for this holder's link. |
| 85 | * A nested class {{{ SimpleLinkHolder }}} exdending LinkHolder will be added in {{{ ElementView }}}. |
| 86 | * It will need one additional method - ResourceAccess getAccess(). |
| 87 | * A new property will be added in ElementView - public Prop<SimpleLinkHolder> linkHolder() |
| 88 | * A nested class {{{ TextLinkHolder }}} exdending LinkHolder will be added in {{{ HeadTextFrameView }}}. |
| 89 | * It will need one additional method - public TextLink getTextLink(). |
| 90 | * A new property will be added in HeadTextFrameView - public Prop<TextLinkHolder> textLinkHolder() |
| 91 | * Two subclasses of LinksHud will be created: |
| 92 | * ElementLinksHud with a SimpleLinkHolder |
| 93 | * TextLinksHud with a TextLinkHolder and additional controls for selecting link colours in {{{ org.sophie2.main.func.text.view package }}}. |
| 94 | * The operations in {{{ LinksHudLogic }}} should be modified to make the new link and to throw a new SET_LINK event instead of setting the link in the model. |
| 95 | * A new operation ON_SET_ELEMENT_LINK in {{{ LinksHudLogic }}} will register an autoaction to set the link of ElementLinksHud's model. |
| 96 | * A new operation ON_SET_TEXT_LINK in {{{ TextLinksHudLogic }}} will create a new ImmHotText object with the changed link and fire a SET_TEXT event. |
72 | | * Source code: [7801] |
73 | | * Tests: TextLinksDemo |
| 98 | * TextLinksHud's hierarchy: |
| 99 | * {{{ ColorTitleBar }}} extending HudTitleBar |
| 100 | * {{{ ColorSubHudButton }}} extending SubHudButton - shows TextLinkColorHud |
| 101 | * {{{ TextLinkColorHud }}} - a hud with 4 color picker fields (see the picture in the analysis) |
| 102 | * {{{ NormalColorField }}} extends ColorPickerHudField - a color picker field that changes the link's normal color. |
| 103 | * {{{ HoverColorField }}} extends ColorPickerHudField - a color picker field that changes the link's hover color. |
| 104 | * {{{ VisitedColorField }}} extends ColorPickerHudField - a color picker field that changes the link's visited color. |
| 105 | * {{{ PressedColorField }}} extends ColorPickerHudField - a color picker field that changes the link's pressed color. |
| 106 | * {{{ TextLinkColorHudLogic }}} with 4 operation, each one changing the color for a different state. |
| 107 | * {{{ ColorField }}} extends ColorPickerHudField - a color picker field that changes all links colors simultaneously. |
| 108 | * {{{ TextLinksHudLogic }}} with 2 operations: |
| 109 | * ON_SET_TEXT_LINK described above |
| 110 | * ON_COLOR_SUBMIT changes the color of all link's states simultaneously |
| 111 | |
| 112 | * Source code: [7801], [7874] |