wiki:TEXT_CHAR_COLOR_R0
Last modified 14 years ago Last modified on 06/17/09 14:43:29

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

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

  • User should be able to change the color (and the background in later revisions) of the text as well as to change the color only to selected text. The behavior should be the same as changing fonts.
    • If there is a selection, the font color should be applied to it.
    • If there is no selection, but the caret is inside a word, the change should be applied to the word containing the caret.
    • If a selection is in empty position (before, after or not in word) the color is applied for this position only. This means that if later the user starts typing from there, the font will be with this color.
  • This functionality should present inside of character settings hud and detached frame editor.
  • There should be change color button that evokes color picker dialog(hud).
  • There should be live preview for this. Text color changes before the user confirm the operation from color picker dialog. If the change is canceled the previous color is applied.

Task requirements

  • Add change color button in the character settings hud.
  • Create live preview.

Task result

  • The result should be code.

Implementation idea

  • Please review TEXT_CHARACTER_FORMAT_COMMONS_R0 and don't get into conflict with it.
  • See what has already been implemented. Probably you should use org.sophie2.main.view.halos.buttons.clickable.ChangeColorButton.

TEXT_CHARACTER_FORMAT_COMMONS_R0
TEXT_CHAR_SPACING_R0
TEXT_CHAR_STYLE_FLAGS_R0
TEXT_CHAR_SPACE_OVERLAP_R0
TEXT_FONTS_SUPPORT_R0
TEXT_FONTS_INTERFACE_R0

TEXT_HALO_MENU_R0

DETACHED_TEXT_FRAME_EDITOR_R0

APP_COLOR_PICKER_R0

How to demo

  • Run the application
  • Create a new book and place text frame inside
  • Populate some lorem ipsum text inside with a number of paragraphs(lorem ipsum generator --> http://www.lipsum.com/)
  • Open character settings hud and change the color of the entire text. After this select part of the text and again change the color.

Design

Two new control will be added to TextFontHud. These controls will be BoundColorField type. The first control will represent text color and the second one will be text background color.

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

Also a refactoring to BackgroundGradientField, BackgroundImageField and BackgroundPatternField will be made, in order to minimize code duplication and easier test maintenance. These three class use dialog window for user preferences and this is the only difference between them. The goal of this refactoring will be to have only one class - BackgroundDialogField, which will handle the code for manipulating Dialog window. Also it will declare two abstract methods :

  • one that will construct the actual DialogInput
  • one that will return the default value for initialization of JPanel

This refactor won't fix acutal holes in the implementation but will reduce code duplication :

  • getBackgroundModel() : BackgroundStyle - this will replace the actual getBackgroundModel() which is static and is copied through the Background*Field classes
  • dataInputControl () : Prop <JPanel> - this method will ne moved to BackgroundDialogFiled in it will be initialized with the two introduced abstract methods
  • validate () and computeEnabled() will have default behaivour
  • createDialogInput() : DialogInput - this abstract method should create DialogInput that is needed in actual implementation of BackgroundDialogField
  • getDefaultValue () : Color - this abstract method return value that is used to initializa JPanel's background. This functionality is part of the implementation done so far and won't be fixed.

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

Changeset:

[3383]

Implementation

Implementation is done according to design

Changeset:

[3456]

Merged to the trunk in [3543].

Testing

(Place the testing results here.)

Comments

(Write comments for this or later revisions here.)