wiki:ANNOTATIONS_STICKIES_R1
Last modified 16 years ago Last modified on 07/09/09 12:38:10

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

Error: Macro TicketQuery(summary=ANNOTATIONS_STICKIES_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

The goal of this revision is to add more interactivity to stickies - text editing and dragging.

Task requirements

  • The default background color should be yellow, semitransparent (red=100%, green=100%, blue=20%, alpha=75%).
  • The text color of stickies should be non-transparent and:
    • Black - if the brightness (see below) of the background is more than 50%
    • White - otherwise (optional, if HotText allows it).
    • The brightness is the luma, the Y component of the color in YUV color space.
  • Add Hot Text to stickies so they can be edited.
    • Only plain text editing functionality is required.
    • When removing a sticky, confirmation dialog should be displayed only for non-empty stickies.
  • Create a halo button for moving stickies with the mouse.
    • Use the same button as the frame move button.
    • Place the button to the left of the remove button.
    • In later revisions a title bar like frame's future title bar will be needed.
  • (optional) Create a halo button for changing sticky's background color. The alpha value should not be changed (75%).
  • Reuse as much as possible of the code for the same functionality for frames.

Task result

Source code.

Implementation idea

  • The halo button should be of type MoveHaloButton.
  • Add it to StickyHaloMenu.
  • In StickyRemoveButton change the condition to if (sticky.text().get().length() > 0).

How to demo

  • Run Sophie and create a new book (if no book is available).
  • Go to the Stickies palette.
  • Create a new sticky.
  • Type some text in it.
  • Drag the move halo button to move the sticky.

Design

  • Rename the classes SceneStickyView and SceneAudioAnnotationView to StickyView and AudioAnnotationView, respectively.

source:/trunk/sophie2-platform/doc/uml-design-diagrams/PageElementMoveHalo.png

  • Create a class org.sophie2.main.app.halos.pageelement.PageElementMoveHaloButton which extends MoveHaloButton.
    • method protected ImmRect translateRect(ImmRect bounds, int newX, int newY) that translates a rectangle.
    • pull up the property workArea (from FrameMoveHaloButton).
  • Create a class StickyMoveHaloButton.
  • FrameMoveHaloButton and StickyMoveHaloButton should extend PageElementMoveButton.
  • Add StickyMoveHaloButton to StickyHaloMenu.
  • In StickyRemoveButton change the condition to if (sticky.text().get().length() > 0).
  • HotText:
    • Create a class DefaultHotTextSceneElement
      • in org.sophie2.base.scene.impl
      • extends DefaultSceneElement
      • implements HotTextSceneElement
      • Move the setupStatic method from HotTextContentView.HotTextSceneElementImpl.
      • Create a layoutArea property of type ImmArea which returns the value of bounds property.
      • textLayout should be an auto property which returns HotTextLayout for the value of text and layoutArea.
    • Refactor HotTextContentView.HotTextSceneElementImpl:
      • extends DefaultHotTextSceneElement
      • override layoutArea to distract the area of the overlapping frames (move the existing functionality).
    • Create a class StickyTextSceneElement
      • inner class for StickyView
      • extends DefaultHotTextSceneElement
      • override setupDynamic to set the bounds of the element - the sticky bounds without the title area
      • override text - auto property returning new NaiveHotText with the sticky's text.
    • Create a class InteractionMapUtil in org.sophie2.main.func.text.utils
      • move the logic in HotTextContentView.defineSkin to a new method InteractionMapUtil.addInteractions.
      • add defineSkin in StickyView and add a call to InteractionMapUtil.addInteractions in it.
  • Text color:
    • Create textColor auto property of type ImmColor in StickyView.
    • Return color according to the analysis requirements above.
    • Use the following formula for the brightness:
      • Y = 0.2126 R + 0.7152 G + 0.0722 B.
    • Apply that color to the sticky's title.

Implementation

Merged to the trunk in [4116].

Testing

(Place the testing results here.)

Comments

(Write comments for this or later revisions here.)