END_TEST;
}
+int UtcDaliTextControllerImfPreeditStyle(void)
+{
+ tet_infoline(" UtcDaliTextControllerImfPreeditStyle");
+ ToolkitTestApplication application;
+
+ // Creates a text controller.
+ ControllerPtr controller = Controller::New();
+
+ std::string text;
+ InputMethodContext::EventData imfEvent;
+
+ DALI_TEST_CHECK( controller );
+
+ // Configures the text controller similarly to the text-field.
+ ConfigureTextField( controller );
+
+ InputMethodContext inputMethodContext = InputMethodContext::New();
+
+ // Send COMMIT event.
+ imfEvent = InputMethodContext::EventData( InputMethodContext::COMMIT, "Hello ", 0, 6 );
+ controller->OnInputMethodContextEvent( inputMethodContext, imfEvent );
+
+ // Force to update the model.
+ controller->GetNaturalSize();
+
+ controller->GetText( text );
+ DALI_TEST_EQUALS( "Hello ", text, TEST_LOCATION );
+
+ // Send PRE_EDIT event
+ imfEvent = InputMethodContext::EventData( InputMethodContext::PRE_EDIT, "w", 6, 1 );
+ controller->OnInputMethodContextEvent( inputMethodContext, imfEvent );
+ inputMethodContext.SetPreeditStyle( InputMethodContext::PreeditStyle::NONE );
+ controller->GetNaturalSize();
+
+ controller->GetText( text );
+ DALI_TEST_EQUALS( "Hello w", text, TEST_LOCATION );
+
+ imfEvent = InputMethodContext::EventData( InputMethodContext::PRE_EDIT, "w", 6, 1 );
+ controller->OnInputMethodContextEvent( inputMethodContext, imfEvent );
+
+ // Set the preedit style as REVERSE
+ inputMethodContext.SetPreeditStyle( InputMethodContext::PreeditStyle::REVERSE );
+ controller->GetNaturalSize();
+
+ controller->GetText( text );
+ DALI_TEST_EQUALS( "Hello w", text, TEST_LOCATION );
+
+ imfEvent = InputMethodContext::EventData( InputMethodContext::PRE_EDIT, "w", 6, 1 );
+ controller->OnInputMethodContextEvent( inputMethodContext, imfEvent );
+
+ // Set the preedit style as HIGHLIGHT
+ inputMethodContext.SetPreeditStyle( InputMethodContext::PreeditStyle::HIGHLIGHT );
+ controller->GetNaturalSize();
+
+ controller->GetText( text );
+ DALI_TEST_EQUALS( "Hello w", text, TEST_LOCATION );
+
+ imfEvent = InputMethodContext::EventData( InputMethodContext::PRE_EDIT, "w", 6, 1 );
+ controller->OnInputMethodContextEvent( inputMethodContext, imfEvent );
+
+ // Set the preedit style as CUSTOM_PLATFORM_STYLE_1
+ inputMethodContext.SetPreeditStyle( InputMethodContext::PreeditStyle::CUSTOM_PLATFORM_STYLE_1 );
+ controller->GetNaturalSize();
+
+ controller->GetText( text );
+ DALI_TEST_EQUALS( "Hello w", text, TEST_LOCATION );
+
+ imfEvent = InputMethodContext::EventData( InputMethodContext::PRE_EDIT, "w", 6, 1 );
+ controller->OnInputMethodContextEvent( inputMethodContext, imfEvent );
+
+ // Set the preedit style as CUSTOM_PLATFORM_STYLE_2
+ inputMethodContext.SetPreeditStyle( InputMethodContext::PreeditStyle::CUSTOM_PLATFORM_STYLE_2 );
+ controller->GetNaturalSize();
+
+ controller->GetText( text );
+ DALI_TEST_EQUALS( "Hello w", text, TEST_LOCATION );
+
+ imfEvent = InputMethodContext::EventData( InputMethodContext::PRE_EDIT, "w", 6, 1 );
+ controller->OnInputMethodContextEvent( inputMethodContext, imfEvent );
+
+ // Set the preedit style as CUSTOM_PLATFORM_STYLE_3
+ inputMethodContext.SetPreeditStyle( InputMethodContext::PreeditStyle::CUSTOM_PLATFORM_STYLE_3 );
+ controller->GetNaturalSize();
+
+ controller->GetText( text );
+ DALI_TEST_EQUALS( "Hello w", text, TEST_LOCATION );
+
+ imfEvent = InputMethodContext::EventData( InputMethodContext::PRE_EDIT, "w", 6, 1 );
+ controller->OnInputMethodContextEvent( inputMethodContext, imfEvent );
+
+ // Set the preedit style as CUSTOM_PLATFORM_STYLE_4
+ inputMethodContext.SetPreeditStyle( InputMethodContext::PreeditStyle::CUSTOM_PLATFORM_STYLE_4 );
+ controller->GetNaturalSize();
+
+ controller->GetText( text );
+ DALI_TEST_EQUALS( "Hello w", text, TEST_LOCATION );
+
+ tet_result(TET_PASS);
+ END_TEST;
+}
+
int UtcDaliTextControllerTextPopupButtonTouched(void)
{
tet_infoline(" UtcDaliTextControllerTextPopupButtonTouched");
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
void ApplyOptions( const InputMethodOptions& options );
bool FilterEventKey( const Dali::KeyEvent& keyEvent );
void SetPreeditStyle( Dali::InputMethodContext::PreeditStyle type );
- Dali::InputMethodContext::PreeditStyle GetPreeditStyle() const;
+ void GetPreeditStyle( Vector< Dali::InputMethodContext::PreeditAttributeData >& attrs ) const;
public: // Signals
ActivatedSignalType& ActivatedSignal() { return mActivatedSignal; }
bool mRestoreAfterFocusLost:1; ///< Whether the keyboard needs to be restored (activated ) after focus regained.
bool mIdleCallbackConnected:1; ///< Whether the idle callback is already connected.
InputMethodOptions mOptions;
- Dali::InputMethodContext::PreeditStyle mPreeditStyle;
+ Vector< Dali::InputMethodContext::PreeditAttributeData > mPreeditAttrs; ///< Stores preedit attr data
ActivatedSignalType mActivatedSignal;
KeyboardEventSignalType mEventSignal;
: mIMFCursorPosition( 0 ),
mSurroundingText(),
mRestoreAfterFocusLost( false ),
- mIdleCallbackConnected( false ),
- mPreeditStyle( Dali::InputMethodContext::PreeditStyle::NONE )
+ mIdleCallbackConnected( false )
{
CreateContext( /*ecoreXwin*/ );
ConnectCallbacks();
void InputMethodContext::SetPreeditStyle( Dali::InputMethodContext::PreeditStyle type )
{
- mPreeditStyle = type;
+ Dali::InputMethodContext::PreeditAttributeData data;
+ data.preeditType = type;
+ mPreeditAttrs.PushBack( data );
}
-Dali::InputMethodContext::PreeditStyle InputMethodContext::GetPreeditStyle() const
+void InputMethodContext::GetPreeditStyle( Vector< Dali::InputMethodContext::PreeditAttributeData >& attrs ) const
{
- return mPreeditStyle;
+ attrs = mPreeditAttrs;
}
} // Adaptor
Internal::Adaptor::InputMethodContext::GetImplementation(*this).SetPreeditStyle( type );
}
-Dali::InputMethodContext::PreeditStyle InputMethodContext::GetPreeditStyle() const
+void InputMethodContext::GetPreeditStyle( Vector< Dali::InputMethodContext::PreeditAttributeData >& attrs ) const
{
- return Internal::Adaptor::InputMethodContext::GetImplementation(*this).GetPreeditStyle();
+ Internal::Adaptor::InputMethodContext::GetImplementation(*this).GetPreeditStyle( attrs );
}
// Signals
*/
enum class PreeditStyle
{
- NONE, ///< None style
- UNDERLINE, ///< Underline substring style
- REVERSE, ///< Reverse substring style
- HIGHLIGHT ///< Highlight substring style
+ NONE, ///< None style
+ UNDERLINE, ///< Underline substring style
+ REVERSE, ///< Reverse substring style
+ HIGHLIGHT, ///< Highlight substring style
+ CUSTOM_PLATFORM_STYLE_1, ///< Custom style for platform
+ CUSTOM_PLATFORM_STYLE_2, ///< Custom style for platform
+ CUSTOM_PLATFORM_STYLE_3, ///< Custom style for platform
+ CUSTOM_PLATFORM_STYLE_4 ///< Custom style for platform
+ };
+
+ /**
+ * @brief This structure is for the preedit style types and indices.
+ */
+ struct PreeditAttributeData
+ {
+ PreeditStyle preeditType; /// The preedit style type
+ unsigned int startIndex; /// The start index of preedit
+ unsigned int endIndex; /// The end index of preedit
};
/**
void SetPreeditStyle( PreeditStyle type );
/**
- * @brief Gets the preedit type.
+ * @brief Gets the preedit attrs data.
*
- * @return The preedit style type
+ * @param[out] attrs The preedit attrs data.
*/
- PreeditStyle GetPreeditStyle() const;
+ void GetPreeditStyle( Vector<PreeditAttributeData>& attrs ) const;
public:
map = dummyControl.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL );
value = map.Find( DevelImageVisual::Property::PLAY_STATE );
- DALI_TEST_CHECK( value->Get< int >() == DevelImageVisual::PlayState::PAUSED );
+ DALI_TEST_CHECK( value->Get< int >() == DevelImageVisual::PlayState::STOPPED );
tet_infoline( "On stage again" );
Stage::GetCurrent().Add( dummyControl );
map = dummyControl.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL );
value = map.Find( DevelImageVisual::Property::PLAY_STATE );
- DALI_TEST_CHECK( value->Get< int >() == DevelImageVisual::PlayState::PAUSED );
+ DALI_TEST_CHECK( value->Get< int >() == DevelImageVisual::PlayState::STOPPED );
tet_infoline( "Test Play action" );
DevelControl::DoAction( dummyControl, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PLAY, attributes );
const char* const PROPERTY_NAME_ENABLE_GRAB_HANDLE = "enableGrabHandle";
const char* const PROPERTY_NAME_MATCH_SYSTEM_LANGUAGE_DIRECTION = "matchSystemLanguageDirection";
const char* const PROPERTY_NAME_ENABLE_GRAB_HANDLE_POPUP = "enableGrabHandlePopup";
+const char* const PROPERTY_NAME_BACKGROUND = "textBackground";
const Vector4 PLACEHOLDER_TEXT_COLOR( 0.8f, 0.8f, 0.8f, 0.8f );
const Dali::Vector4 LIGHT_BLUE( 0.75f, 0.96f, 1.f, 1.f ); // The text highlight color.
DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_ENABLE_GRAB_HANDLE ) == DevelTextField::Property::ENABLE_GRAB_HANDLE );
DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_MATCH_SYSTEM_LANGUAGE_DIRECTION ) == DevelTextField::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION );
DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_ENABLE_GRAB_HANDLE_POPUP ) == DevelTextField::Property::ENABLE_GRAB_HANDLE_POPUP );
+ DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_BACKGROUND ) == DevelTextField::Property::BACKGROUND );
END_TEST;
}
field.SetProperty( DevelTextField::Property::ENABLE_GRAB_HANDLE_POPUP, false );
DALI_TEST_CHECK( !field.GetProperty<bool>( DevelTextField::Property::ENABLE_GRAB_HANDLE_POPUP ) );
+ // Check the background property
+ field.SetProperty( DevelTextField::Property::BACKGROUND, Color::RED );
+ DALI_TEST_EQUALS( field.GetProperty<Vector4>( DevelTextField::Property::BACKGROUND ), Color::RED, TEST_LOCATION );
+
application.SendNotification();
application.Render();
* @details Name "enableGrabHandlePopup", type Property::BOOLEAN.
* @note The default value is true, which means the grab handle popup is enabled by default.
*/
- ENABLE_GRAB_HANDLE_POPUP = ELLIPSIS + 4
+ ENABLE_GRAB_HANDLE_POPUP = ELLIPSIS + 4,
+
+ /**
+ * @brief The default text background parameters.
+ * @details Name "textBackground", type Property::VECTOR4.
+ * @note Use "textBackground" as property name to avoid conflict with Control's "background" property.
+ * @note The default value is Color::TRANSPARENT.
+ */
+ BACKGROUND = ELLIPSIS + 5
};
} // namespace Property
// currently not called from code so compiler will optimize these away, kept here for future debugging
#define FLEX_CONTAINER_TAG "DALI Toolkit::FlexContainer "
-#define FC_LOG(fmt, args...) Debug::LogMessage(Debug::DebugInfo, FLEX_CONTAINER_TAG fmt, ## args)
+#define FC_LOG(fmt, args,...) Debug::LogMessage(Debug::DebugInfo, FLEX_CONTAINER_TAG fmt, ## args)
// #define FLEX_CONTAINER_DEBUG 1
#if defined(FLEX_CONTAINER_DEBUG)
// currently not called from code so compiler will optimize these away, kept here for future debugging
#define TABLEVIEW_TAG "DALI Toolkit::TableView "
-#define TV_LOG(fmt, args...) Debug::LogMessage(Debug::DebugInfo, TABLEVIEW_TAG fmt, ## args)
+#define TV_LOG(fmt, args,...) Debug::LogMessage(Debug::DebugInfo, TABLEVIEW_TAG fmt, ## args)
//#define TABLEVIEW_DEBUG 1
#if defined(TABLEVIEW_DEBUG)
DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextField, "enableGrabHandle", BOOLEAN, ENABLE_GRAB_HANDLE )
DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextField, "matchSystemLanguageDirection", BOOLEAN, MATCH_SYSTEM_LANGUAGE_DIRECTION )
DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextField, "enableGrabHandlePopup", BOOLEAN, ENABLE_GRAB_HANDLE_POPUP )
+DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextField, "textBackground", VECTOR4, BACKGROUND )
DALI_SIGNAL_REGISTRATION( Toolkit, TextField, "textChanged", SIGNAL_TEXT_CHANGED )
DALI_SIGNAL_REGISTRATION( Toolkit, TextField, "maxLengthReached", SIGNAL_MAX_LENGTH_REACHED )
}
case Toolkit::DevelTextField::Property::ENABLE_GRAB_HANDLE_POPUP:
{
- if (impl.mController)
+ if( impl.mController )
{
const bool grabHandlePopupEnabled = value.Get<bool>();
DALI_LOG_INFO(gLogFilter, Debug::General, "TextField %p ENABLE_GRAB_HANDLE_POPUP %d\n", impl.mController.Get(), grabHandlePopupEnabled);
break;
}
}
+ case Toolkit::DevelTextField::Property::BACKGROUND:
+ {
+ if( impl.mController )
+ {
+ const Vector4 backgroundColor = value.Get< Vector4 >();
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p BACKGROUND %f,%f,%f,%f\n", impl.mController.Get(), backgroundColor.r, backgroundColor.g, backgroundColor.b, backgroundColor.a );
+
+ impl.mController->SetBackgroundEnabled( true );
+ impl.mController->SetBackgroundColor( backgroundColor );
+ }
+ break;
+ }
} // switch
} // textfield
}
}
case Toolkit::DevelTextField::Property::ENABLE_GRAB_HANDLE_POPUP:
{
- if (impl.mController)
+ if( impl.mController )
{
value = impl.mController->IsGrabHandlePopupEnabled();
}
break;
}
+ case Toolkit::DevelTextField::Property::BACKGROUND:
+ {
+ if( impl.mController )
+ {
+ value = impl.mController->GetBackgroundColor();
+ }
+ break;
+ }
} //switch
}
Vector< unsigned short > mIndices; ///< container of indices
};
+const Dali::Vector4 LIGHT_BLUE( 0.75f, 0.96f, 1.f, 1.f );
+const Dali::Vector4 BACKGROUND_SUB4( 0.58f, 0.87f, 0.96f, 1.f );
+const Dali::Vector4 BACKGROUND_SUB5( 0.83f, 0.94f, 0.98f, 1.f );
+const Dali::Vector4 BACKGROUND_SUB6( 1.f, 0.5f, 0.5f, 1.f );
+const Dali::Vector4 BACKGROUND_SUB7( 1.f, 0.8f, 0.8f, 1.f );
+
} // namespace
namespace Dali
mEventData->mPreEditFlag &&
( 0u != mModel->mVisualModel->mCharactersToGlyph.Count() ) )
{
- Dali::InputMethodContext::PreeditStyle type = mEventData->mInputMethodContext.GetPreeditStyle();
+ Vector< Dali::InputMethodContext::PreeditAttributeData > attrs;
+ mEventData->mInputMethodContext.GetPreeditStyle( attrs );
+ Dali::InputMethodContext::PreeditStyle type = Dali::InputMethodContext::PreeditStyle::NONE;
- switch( type )
+ // Check the type of preedit and run it.
+ for( Vector<Dali::InputMethodContext::PreeditAttributeData>::Iterator it = attrs.Begin(), endIt = attrs.End(); it != endIt; it++ )
{
- case Dali::InputMethodContext::PreeditStyle::UNDERLINE:
- {
- // Add the underline for the pre-edit text.
- const GlyphIndex* const charactersToGlyphBuffer = mModel->mVisualModel->mCharactersToGlyph.Begin();
- const Length* const glyphsPerCharacterBuffer = mModel->mVisualModel->mGlyphsPerCharacter.Begin();
+ Dali::InputMethodContext::PreeditAttributeData attrData = *it;
+ DALI_LOG_INFO( gLogFilter, Debug::General, "Controller::UpdateModel PreeditStyle type : %d start %d end %d \n", attrData.preeditType, attrData.startIndex, attrData.endIndex );
+ type = attrData.preeditType;
- const GlyphIndex glyphStart = *( charactersToGlyphBuffer + mEventData->mPreEditStartPosition );
- const CharacterIndex lastPreEditCharacter = mEventData->mPreEditStartPosition + ( ( mEventData->mPreEditLength > 0u ) ? mEventData->mPreEditLength - 1u : 0u );
- const Length numberOfGlyphsLastCharacter = *( glyphsPerCharacterBuffer + lastPreEditCharacter );
- const GlyphIndex glyphEnd = *( charactersToGlyphBuffer + lastPreEditCharacter ) + ( numberOfGlyphsLastCharacter > 1u ? numberOfGlyphsLastCharacter - 1u : 0u );
+ // Check the number of commit characters for the start position.
+ unsigned int numberOfCommit = mEventData->mPrimaryCursorPosition - mEventData->mPreEditLength;
+ Length numberOfIndices = attrData.endIndex - attrData.startIndex;
- GlyphRun underlineRun;
- underlineRun.glyphIndex = glyphStart;
- underlineRun.numberOfGlyphs = 1u + glyphEnd - glyphStart;
-
- mModel->mVisualModel->mUnderlineRuns.PushBack( underlineRun );
- break;
+ switch( type )
+ {
+ case Dali::InputMethodContext::PreeditStyle::UNDERLINE:
+ {
+ // Add the underline for the pre-edit text.
+ GlyphRun underlineRun;
+ underlineRun.glyphIndex = attrData.startIndex + numberOfCommit;
+ underlineRun.numberOfGlyphs = attrData.endIndex - attrData.startIndex;
+ mModel->mVisualModel->mUnderlineRuns.PushBack( underlineRun );
+ break;
+ }
+ case Dali::InputMethodContext::PreeditStyle::REVERSE:
+ {
+ Vector4 textColor = mModel->mVisualModel->GetTextColor();
+ ColorRun backgroundColorRun;
+ backgroundColorRun.characterRun.characterIndex = attrData.startIndex + numberOfCommit;
+ backgroundColorRun.characterRun.numberOfCharacters = numberOfIndices;
+ backgroundColorRun.color = textColor;
+ mModel->mLogicalModel->mBackgroundColorRuns.PushBack( backgroundColorRun );
+
+ Vector4 backgroundColor = mModel->mVisualModel->GetBackgroundColor();
+ Vector<ColorRun> colorRuns;
+ colorRuns.Resize( 1u );
+ ColorRun& colorRun = *( colorRuns.Begin() );
+ colorRun.color = backgroundColor;
+ colorRun.characterRun.characterIndex = attrData.startIndex + numberOfCommit;
+ colorRun.characterRun.numberOfCharacters = numberOfIndices;
+
+ mModel->mLogicalModel->mColorRuns.PushBack( colorRun );
+ break;
+ }
+ case Dali::InputMethodContext::PreeditStyle::HIGHLIGHT:
+ {
+ ColorRun backgroundColorRun;
+ backgroundColorRun.characterRun.characterIndex = attrData.startIndex + numberOfCommit;
+ backgroundColorRun.characterRun.numberOfCharacters = numberOfIndices;
+ backgroundColorRun.color = LIGHT_BLUE;
+ mModel->mLogicalModel->mBackgroundColorRuns.PushBack( backgroundColorRun );
+ break;
+ }
+ case Dali::InputMethodContext::PreeditStyle::CUSTOM_PLATFORM_STYLE_1:
+ {
+ // CUSTOM_PLATFORM_STYLE_1 should be drawn with background and underline together.
+ ColorRun backgroundColorRun;
+ backgroundColorRun.characterRun.characterIndex = attrData.startIndex + numberOfCommit;
+ backgroundColorRun.characterRun.numberOfCharacters = numberOfIndices;
+ backgroundColorRun.color = BACKGROUND_SUB4;
+ mModel->mLogicalModel->mBackgroundColorRuns.PushBack( backgroundColorRun );
+
+ GlyphRun underlineRun;
+ underlineRun.glyphIndex = attrData.startIndex + numberOfCommit;
+ underlineRun.numberOfGlyphs = attrData.endIndex - attrData.startIndex;
+ mModel->mVisualModel->mUnderlineRuns.PushBack( underlineRun );
+ break;
+ }
+ case Dali::InputMethodContext::PreeditStyle::CUSTOM_PLATFORM_STYLE_2:
+ {
+ // CUSTOM_PLATFORM_STYLE_2 should be drawn with background and underline together.
+ ColorRun backgroundColorRun;
+ backgroundColorRun.characterRun.characterIndex = attrData.startIndex + numberOfCommit;
+ backgroundColorRun.characterRun.numberOfCharacters = numberOfIndices;
+ backgroundColorRun.color = BACKGROUND_SUB5;
+ mModel->mLogicalModel->mBackgroundColorRuns.PushBack( backgroundColorRun );
+
+ GlyphRun underlineRun;
+ underlineRun.glyphIndex = attrData.startIndex + numberOfCommit;
+ underlineRun.numberOfGlyphs = attrData.endIndex - attrData.startIndex;
+ mModel->mVisualModel->mUnderlineRuns.PushBack( underlineRun );
+ break;
+ }
+ case Dali::InputMethodContext::PreeditStyle::CUSTOM_PLATFORM_STYLE_3:
+ {
+ // CUSTOM_PLATFORM_STYLE_3 should be drawn with background and underline together.
+ ColorRun backgroundColorRun;
+ backgroundColorRun.characterRun.characterIndex = attrData.startIndex + numberOfCommit;
+ backgroundColorRun.characterRun.numberOfCharacters = numberOfIndices;
+ backgroundColorRun.color = BACKGROUND_SUB6;
+ mModel->mLogicalModel->mBackgroundColorRuns.PushBack( backgroundColorRun );
+
+ GlyphRun underlineRun;
+ underlineRun.glyphIndex = attrData.startIndex + numberOfCommit;
+ underlineRun.numberOfGlyphs = attrData.endIndex - attrData.startIndex;
+ mModel->mVisualModel->mUnderlineRuns.PushBack( underlineRun );
+ break;
+ }
+ case Dali::InputMethodContext::PreeditStyle::CUSTOM_PLATFORM_STYLE_4:
+ {
+ // CUSTOM_PLATFORM_STYLE_4 should be drawn with background and underline together.
+ ColorRun backgroundColorRun;
+ backgroundColorRun.characterRun.characterIndex = attrData.startIndex + numberOfCommit;
+ backgroundColorRun.characterRun.numberOfCharacters = numberOfIndices;
+ backgroundColorRun.color = BACKGROUND_SUB7;
+ mModel->mLogicalModel->mBackgroundColorRuns.PushBack( backgroundColorRun );
+
+ GlyphRun underlineRun;
+ underlineRun.glyphIndex = attrData.startIndex + numberOfCommit;
+ underlineRun.numberOfGlyphs = attrData.endIndex - attrData.startIndex;
+ mModel->mVisualModel->mUnderlineRuns.PushBack( underlineRun );
+ break;
+ }
+ case Dali::InputMethodContext::PreeditStyle::NONE:
+ default:
+ {
+ break;
+ }
}
- // TODO : At this moment, other styles for preedit are not implemented yet.
- case Dali::InputMethodContext::PreeditStyle::REVERSE:
- case Dali::InputMethodContext::PreeditStyle::HIGHLIGHT:
- case Dali::InputMethodContext::PreeditStyle::NONE:
- default:
- break;
}
+ attrs.Clear();
+ updated = true;
}
if( NO_OPERATION != ( COLOR & operations ) )
const Vector4* const backgroundColorsBuffer = mView.GetBackgroundColors();
const ColorIndex* const backgroundColorIndicesBuffer = mView.GetBackgroundColorIndices();
+ const Vector4& defaultBackgroundColor = mModel->mVisualModel->IsBackgroundEnabled() ? mModel->mVisualModel->GetBackgroundColor() : Color::TRANSPARENT;
Vector4 quad;
uint32_t numberOfQuads = 0u;
// Get the background color of the character.
// The color index zero is reserved for the default background color (i.e. Color::TRANSPARENT)
const ColorIndex backgroundColorIndex = ( nullptr == backgroundColorsBuffer ) ? 0u : *( backgroundColorIndicesBuffer + i );
- const Vector4& backgroundColor = ( 0u == backgroundColorIndex ) ? Color::TRANSPARENT : *( backgroundColorsBuffer + backgroundColorIndex - 1u );
+ const Vector4& backgroundColor = ( 0u == backgroundColorIndex ) ? defaultBackgroundColor : *( backgroundColorsBuffer + backgroundColorIndex - 1u );
// Only create quads for glyphs with a background color
if ( backgroundColor != Color::TRANSPARENT )
// it means all texts should be removed and all Preedit variables should be initialized.
if( ( currentText.Count() - numberOfCharacters == 0 ) && ( cursorIndex == 0 ) )
{
- if( mImpl->mEventData )
- {
- mImpl->mEventData->mPreEditStartPosition = 0;
- mImpl->mEventData->mPreEditLength = 0;
- }
+ mImpl->ClearPreEditFlag();
}
// Updates the text style runs by removing characters. Runs with no characters are removed.
mShadowColor( Color::BLACK ),
mUnderlineColor( Color::BLACK ),
mOutlineColor( Color::WHITE ),
- mBackgroundColor( Color::CYAN ),
+ mBackgroundColor( Color::TRANSPARENT ),
mControlSize(),
mShadowOffset(),
mUnderlineHeight( 0.0f ),
void AnimatedVectorImageVisual::DoSetOffStage( Actor& actor )
{
- PauseAnimation();
+ StopAnimation();
if( mImpl->mRenderer )
{
}
}
-void AnimatedVectorImageVisual::PauseAnimation()
+void AnimatedVectorImageVisual::StopAnimation()
{
- if( mActionStatus == DevelAnimatedVectorImageVisual::Action::PLAY )
+ if( mActionStatus != DevelAnimatedVectorImageVisual::Action::STOP )
{
- mVectorAnimationTask->PauseAnimation();
+ mVectorAnimationTask->StopAnimation();
- mActionStatus = DevelAnimatedVectorImageVisual::Action::PAUSE;
+ mActionStatus = DevelAnimatedVectorImageVisual::Action::STOP;
if( mImpl->mRenderer )
{
{
if( !visible )
{
- PauseAnimation();
+ StopAnimation();
DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "AnimatedVectorImageVisual::OnControlVisibilityChanged: invisibile. Pause animation [%p]\n", this );
}
{
if( !visible )
{
- PauseAnimation();
+ StopAnimation();
DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "AnimatedVectorImageVisual::OnWindowVisibilityChanged: invisibile. Pause animation [%p]\n", this );
}
void SetVectorImageSize();
/**
- * @brief Pause the animation.
+ * @brief Stop the animation.
*/
- void PauseAnimation();
+ void StopAnimation();
/**
* @brief Callback when the world scale factor changes.
if( value.Get( alphaUrl ) )
{
AllocateMaskData();
- // Immediately trigger the alpha mask loading (it may just get a cached value)
mMaskingData->mAlphaMaskUrl = alphaUrl;
}
break;
TextureSet TextureManager::LoadTexture(
const VisualUrl& url, Dali::ImageDimensions desiredSize, Dali::FittingMode::Type fittingMode,
- Dali::SamplingMode::Type samplingMode, const MaskingDataPointer& maskInfo,
+ Dali::SamplingMode::Type samplingMode, MaskingDataPointer& maskInfo,
bool synchronousLoading, TextureManager::TextureId& textureId, Vector4& textureRect,
Dali::ImageDimensions& textureRectSize, bool& atlasingStatus, bool& loadingStatus,
Dali::WrapMode::Type wrapModeU, Dali::WrapMode::Type wrapModeV, TextureUploadObserver* textureObserver,
}
else
{
- TextureId alphaMaskId = RequestMaskLoad( maskInfo->mAlphaMaskUrl );
+ maskInfo->mAlphaMaskId = RequestMaskLoad( maskInfo->mAlphaMaskUrl );
textureId = RequestLoad( url,
- alphaMaskId,
+ maskInfo->mAlphaMaskId,
maskInfo->mContentScaleFactor,
desiredSize,
fittingMode, samplingMode,
* @param[in] desiredSize The size the image is likely to appear at. This can be set to 0,0 for automatic
* @param[in] fittingMode The FittingMode to use
* @param[in] samplingMode The SamplingMode to use
- * @param[in] maskInfo Mask info structure
+ * @param[in, out] maskInfo Mask info structure
* @param[in] synchronousLoading true if the URL should be loaded synchronously
* @param[out] textureId, The textureId of the URL
* @param[out] textureRect The rectangle within the texture atlas that this URL occupies,
Dali::ImageDimensions desiredSize,
Dali::FittingMode::Type fittingMode,
Dali::SamplingMode::Type samplingMode,
- const MaskingDataPointer& maskInfo,
+ MaskingDataPointer& maskInfo,
bool synchronousLoading,
TextureManager::TextureId& textureId,
Vector4& textureRect,