projects
/
platform
/
core
/
uifw
/
dali-toolkit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Text Fit
[platform/core/uifw/dali-toolkit.git]
/
dali-toolkit
/
internal
/
text
/
text-controller-impl.cpp
diff --git
a/dali-toolkit/internal/text/text-controller-impl.cpp
b/dali-toolkit/internal/text/text-controller-impl.cpp
old mode 100644
(file)
new mode 100755
(executable)
index
5f34488
..
e333be2
--- a/
dali-toolkit/internal/text/text-controller-impl.cpp
+++ b/
dali-toolkit/internal/text/text-controller-impl.cpp
@@
-67,9
+67,9
@@
namespace Toolkit
namespace Text
{
namespace Text
{
-EventData::EventData( DecoratorPtr decorator )
+EventData::EventData( DecoratorPtr decorator
, InputMethodContext& inputMethodContext
)
: mDecorator( decorator ),
: mDecorator( decorator ),
- mI
mfManager(
),
+ mI
nputMethodContext( inputMethodContext
),
mPlaceholderFont( NULL ),
mPlaceholderTextActive(),
mPlaceholderTextInactive(),
mPlaceholderFont( NULL ),
mPlaceholderTextActive(),
mPlaceholderTextInactive(),
@@
-112,7
+112,6
@@
EventData::EventData( DecoratorPtr decorator )
mPlaceholderEllipsisFlag( false ),
mShiftSelectionFlag( true )
{
mPlaceholderEllipsisFlag( false ),
mShiftSelectionFlag( true )
{
- mImfManager = ImfManager::Get();
}
EventData::~EventData()
}
EventData::~EventData()
@@
-180,7
+179,7
@@
bool Controller::Impl::ProcessInputEvents()
if( mEventData->mUpdateCursorPosition ||
mEventData->mUpdateHighlightBox )
{
if( mEventData->mUpdateCursorPosition ||
mEventData->mUpdateHighlightBox )
{
- NotifyI
mfManager
();
+ NotifyI
nputMethodContext
();
}
// The cursor must also be repositioned after inserts into the model
}
// The cursor must also be repositioned after inserts into the model
@@
-329,9
+328,9
@@
bool Controller::Impl::ProcessInputEvents()
return decoratorUpdated;
}
return decoratorUpdated;
}
-void Controller::Impl::NotifyI
mfManager
()
+void Controller::Impl::NotifyI
nputMethodContext
()
{
{
- if( mEventData && mEventData->mI
mfManager
)
+ if( mEventData && mEventData->mI
nputMethodContext
)
{
CharacterIndex cursorPosition = GetLogicalCursorPosition();
{
CharacterIndex cursorPosition = GetLogicalCursorPosition();
@@
-347,17
+346,17
@@
void Controller::Impl::NotifyImfManager()
cursorPosition -= numberOfWhiteSpaces;
}
cursorPosition -= numberOfWhiteSpaces;
}
- mEventData->mI
mfManager
.SetCursorPosition( cursorPosition );
- mEventData->mI
mfManager
.NotifyCursorPosition();
+ mEventData->mI
nputMethodContext
.SetCursorPosition( cursorPosition );
+ mEventData->mI
nputMethodContext
.NotifyCursorPosition();
}
}
}
}
-void Controller::Impl::NotifyI
mf
MultiLineStatus()
+void Controller::Impl::NotifyI
nputMethodContext
MultiLineStatus()
{
{
- if ( mEventData )
+ if ( mEventData
&& mEventData->mInputMethodContext
)
{
Text::Layout::Engine::Type layout = mLayoutEngine.GetLayout();
{
Text::Layout::Engine::Type layout = mLayoutEngine.GetLayout();
- mEventData->mI
mfManager
.NotifyTextInputMultiLine( layout == Text::Layout::Engine::MULTI_LINE_BOX );
+ mEventData->mI
nputMethodContext
.NotifyTextInputMultiLine( layout == Text::Layout::Engine::MULTI_LINE_BOX );
}
}
}
}
@@
-933,7
+932,15
@@
bool Controller::Impl::UpdateModel( OperationsMask operationsRequired )
{
// Set the normal font and the placeholder font.
defaultFontDescription = mFontDefaults->mFontDescription;
{
// Set the normal font and the placeholder font.
defaultFontDescription = mFontDefaults->mFontDescription;
- defaultPointSize = mFontDefaults->mDefaultPointSize * 64u;
+
+ if( mTextFitEnabled )
+ {
+ defaultPointSize = mFontDefaults->mFitPointSize * 64u;
+ }
+ else
+ {
+ defaultPointSize = mFontDefaults->mDefaultPointSize * 64u;
+ }
}
// Validates the fonts. If there is a character with no assigned font it sets a default one.
}
// Validates the fonts. If there is a character with no assigned font it sets a default one.
@@
-964,7
+971,9
@@
bool Controller::Impl::UpdateModel( OperationsMask operationsRequired )
lineBreakInfo,
startIndex,
requestedNumberOfCharacters,
lineBreakInfo,
startIndex,
requestedNumberOfCharacters,
- bidirectionalInfo );
+ bidirectionalInfo,
+ mModel->mMatchSystemLanguageDirection,
+ mLayoutDirection );
if( 0u != bidirectionalInfo.Count() )
{
if( 0u != bidirectionalInfo.Count() )
{
@@
-1320,11
+1329,11
@@
void Controller::Impl::OnCursorKeyEvent( const Event& event )
if ( selecting )
{
if ( selecting )
{
- // Notify the cursor position to the
imf manager
.
- if( mEventData->mI
mfManager
)
+ // Notify the cursor position to the
InputMethodContext
.
+ if( mEventData->mI
nputMethodContext
)
{
{
- mEventData->mI
mfManager
.SetCursorPosition( mEventData->mPrimaryCursorPosition );
- mEventData->mI
mfManager
.NotifyCursorPosition();
+ mEventData->mI
nputMethodContext
.SetCursorPosition( mEventData->mPrimaryCursorPosition );
+ mEventData->mI
nputMethodContext
.NotifyCursorPosition();
}
ChangeState( EventData::SELECTING );
}
ChangeState( EventData::SELECTING );
@@
-1396,11
+1405,11
@@
void Controller::Impl::OnTapEvent( const Event& event )
mEventData->mScrollAfterUpdatePosition = true;
mEventData->mUpdateInputStyle = true;
mEventData->mScrollAfterUpdatePosition = true;
mEventData->mUpdateInputStyle = true;
- // Notify the cursor position to the
imf manager
.
- if( mEventData->mI
mfManager
)
+ // Notify the cursor position to the
InputMethodContext
.
+ if( mEventData->mI
nputMethodContext
)
{
{
- mEventData->mI
mfManager
.SetCursorPosition( mEventData->mPrimaryCursorPosition );
- mEventData->mI
mfManager
.NotifyCursorPosition();
+ mEventData->mI
nputMethodContext
.SetCursorPosition( mEventData->mPrimaryCursorPosition );
+ mEventData->mI
nputMethodContext
.NotifyCursorPosition();
}
}
else if( 2u == tapCount )
}
}
else if( 2u == tapCount )
@@
-1846,15
+1855,13
@@
void Controller::Impl::OnSelectAllEvent()
if( mEventData->mSelectionEnabled )
{
if( mEventData->mSelectionEnabled )
{
- ChangeState( EventData::SELECTING );
+ // Calculates the logical position from the start.
+ RepositionSelectionHandles( 0.f - mModel->mScrollPosition.x,
+ 0.f - mModel->mScrollPosition.y,
+ Controller::NoTextTap::HIGHLIGHT );
mEventData->mLeftSelectionPosition = 0u;
mEventData->mRightSelectionPosition = mModel->mLogicalModel->mText.Count();
mEventData->mLeftSelectionPosition = 0u;
mEventData->mRightSelectionPosition = mModel->mLogicalModel->mText.Count();
-
- mEventData->mScrollAfterUpdatePosition = true;
- mEventData->mUpdateLeftSelectionPosition = true;
- mEventData->mUpdateRightSelectionPosition = true;
- mEventData->mUpdateHighlightBox = true;
}
}
}
}
@@
-2418,8
+2425,8
@@
void Controller::Impl::RepositionSelectionHandles( float visualX, float visualY,
mEventData->mUpdateRightSelectionPosition = true;
mEventData->mUpdateHighlightBox = true;
mEventData->mUpdateRightSelectionPosition = true;
mEventData->mUpdateHighlightBox = true;
- // It may happen an I
MF
commit event arrives before the selection event
- // if the I
MF manager
is in pre-edit state. The commit event will set the
+ // It may happen an I
nputMethodContext
commit event arrives before the selection event
+ // if the I
nputMethodContext
is in pre-edit state. The commit event will set the
// mEventData->mUpdateCursorPosition flag to true. If it's not set back
// to false, the highlight box won't be updated.
mEventData->mUpdateCursorPosition = false;
// mEventData->mUpdateCursorPosition flag to true. If it's not set back
// to false, the highlight box won't be updated.
mEventData->mUpdateCursorPosition = false;
@@
-2740,11
+2747,24
@@
void Controller::Impl::GetCursorPosition( CharacterIndex logical,
cursorInfo.lineHeight = GetDefaultFontLineHeight();
cursorInfo.primaryCursorHeight = cursorInfo.lineHeight;
cursorInfo.lineHeight = GetDefaultFontLineHeight();
cursorInfo.primaryCursorHeight = cursorInfo.lineHeight;
+ bool isRTL = false;
+ if( mModel->mMatchSystemLanguageDirection )
+ {
+ isRTL = mLayoutDirection == LayoutDirection::RIGHT_TO_LEFT;
+ }
+
switch( mModel->mHorizontalAlignment )
{
case Text::HorizontalAlignment::BEGIN :
{
switch( mModel->mHorizontalAlignment )
{
case Text::HorizontalAlignment::BEGIN :
{
- cursorInfo.primaryPosition.x = 0.f;
+ if( isRTL )
+ {
+ cursorInfo.primaryPosition.x = mModel->mVisualModel->mControlSize.width - mEventData->mDecorator->GetCursorWidth();
+ }
+ else
+ {
+ cursorInfo.primaryPosition.x = 0.f;
+ }
break;
}
case Text::HorizontalAlignment::CENTER:
break;
}
case Text::HorizontalAlignment::CENTER:
@@
-2754,7
+2774,14
@@
void Controller::Impl::GetCursorPosition( CharacterIndex logical,
}
case Text::HorizontalAlignment::END:
{
}
case Text::HorizontalAlignment::END:
{
- cursorInfo.primaryPosition.x = mModel->mVisualModel->mControlSize.width - mEventData->mDecorator->GetCursorWidth();
+ if( isRTL )
+ {
+ cursorInfo.primaryPosition.x = 0.f;
+ }
+ else
+ {
+ cursorInfo.primaryPosition.x = mModel->mVisualModel->mControlSize.width - mEventData->mDecorator->GetCursorWidth();
+ }
break;
}
}
break;
}
}