{
CharacterIndex startOfSelectedText = 0u;
Length lengthOfSelectedText = 0u;
- FontDescriptionRun& fontDescriptionRun = UpdateSelectionFontStyleRun( mImpl->mEventData,
- mImpl->mModel->mLogicalModel,
- startOfSelectedText,
- lengthOfSelectedText );
- fontDescriptionRun.familyLength = fontFamily.size();
- fontDescriptionRun.familyName = new char[fontDescriptionRun.familyLength];
- memcpy( fontDescriptionRun.familyName, fontFamily.c_str(), fontDescriptionRun.familyLength );
- fontDescriptionRun.familyDefined = true;
+ if( EventData::SELECTING == mImpl->mEventData->mState )
+ {
+ // Update a font description run for the selecting state.
+ FontDescriptionRun& fontDescriptionRun = UpdateSelectionFontStyleRun( mImpl->mEventData,
+ mImpl->mModel->mLogicalModel,
+ startOfSelectedText,
+ lengthOfSelectedText );
- // The memory allocated for the font family name is freed when the font description is removed from the logical model.
+ fontDescriptionRun.familyLength = fontFamily.size();
+ fontDescriptionRun.familyName = new char[fontDescriptionRun.familyLength];
+ memcpy( fontDescriptionRun.familyName, fontFamily.c_str(), fontDescriptionRun.familyLength );
+ fontDescriptionRun.familyDefined = true;
+
+ // The memory allocated for the font family name is freed when the font description is removed from the logical model.
+
+ mImpl->mTextUpdateInfo.mCharacterIndex = startOfSelectedText;
+ mImpl->mTextUpdateInfo.mNumberOfCharactersToRemove = lengthOfSelectedText;
+ mImpl->mTextUpdateInfo.mNumberOfCharactersToAdd = lengthOfSelectedText;
+ }
+ else
+ {
+ mImpl->mTextUpdateInfo.mCharacterIndex = 0;
+ mImpl->mTextUpdateInfo.mNumberOfCharactersToRemove = mImpl->mTextUpdateInfo.mPreviousNumberOfCharacters;
+ mImpl->mTextUpdateInfo.mNumberOfCharactersToAdd = mImpl->mModel->mLogicalModel->mText.Count();
+ }
// Request to relayout.
mImpl->mOperationsPending = static_cast<OperationsMask>( mImpl->mOperationsPending |
mImpl->mRecalculateNaturalSize = true;
mImpl->RequestRelayout();
- mImpl->mTextUpdateInfo.mCharacterIndex = startOfSelectedText;
- mImpl->mTextUpdateInfo.mNumberOfCharactersToRemove = lengthOfSelectedText;
- mImpl->mTextUpdateInfo.mNumberOfCharactersToAdd = lengthOfSelectedText;
-
// As the font changes, recalculate the handle positions is needed.
mImpl->mEventData->mUpdateLeftSelectionPosition = true;
mImpl->mEventData->mUpdateRightSelectionPosition = true;
{
CharacterIndex startOfSelectedText = 0u;
Length lengthOfSelectedText = 0u;
- FontDescriptionRun& fontDescriptionRun = UpdateSelectionFontStyleRun( mImpl->mEventData,
- mImpl->mModel->mLogicalModel,
- startOfSelectedText,
- lengthOfSelectedText );
- fontDescriptionRun.weight = weight;
- fontDescriptionRun.weightDefined = true;
+ if( EventData::SELECTING == mImpl->mEventData->mState )
+ {
+ // Update a font description run for the selecting state.
+ FontDescriptionRun& fontDescriptionRun = UpdateSelectionFontStyleRun( mImpl->mEventData,
+ mImpl->mModel->mLogicalModel,
+ startOfSelectedText,
+ lengthOfSelectedText );
+
+ fontDescriptionRun.weight = weight;
+ fontDescriptionRun.weightDefined = true;
+
+ mImpl->mTextUpdateInfo.mCharacterIndex = startOfSelectedText;
+ mImpl->mTextUpdateInfo.mNumberOfCharactersToRemove = lengthOfSelectedText;
+ mImpl->mTextUpdateInfo.mNumberOfCharactersToAdd = lengthOfSelectedText;
+ }
+ else
+ {
+ mImpl->mTextUpdateInfo.mCharacterIndex = 0;
+ mImpl->mTextUpdateInfo.mNumberOfCharactersToRemove = mImpl->mTextUpdateInfo.mPreviousNumberOfCharacters;
+ mImpl->mTextUpdateInfo.mNumberOfCharactersToAdd = mImpl->mModel->mLogicalModel->mText.Count();
+ }
// Request to relayout.
mImpl->mOperationsPending = static_cast<OperationsMask>( mImpl->mOperationsPending |
mImpl->mRecalculateNaturalSize = true;
mImpl->RequestRelayout();
- mImpl->mTextUpdateInfo.mCharacterIndex = startOfSelectedText;
- mImpl->mTextUpdateInfo.mNumberOfCharactersToRemove = lengthOfSelectedText;
- mImpl->mTextUpdateInfo.mNumberOfCharactersToAdd = lengthOfSelectedText;
-
// As the font might change, recalculate the handle positions is needed.
mImpl->mEventData->mUpdateLeftSelectionPosition = true;
mImpl->mEventData->mUpdateRightSelectionPosition = true;
{
CharacterIndex startOfSelectedText = 0u;
Length lengthOfSelectedText = 0u;
- FontDescriptionRun& fontDescriptionRun = UpdateSelectionFontStyleRun( mImpl->mEventData,
- mImpl->mModel->mLogicalModel,
- startOfSelectedText,
- lengthOfSelectedText );
- fontDescriptionRun.width = width;
- fontDescriptionRun.widthDefined = true;
+ if( EventData::SELECTING == mImpl->mEventData->mState )
+ {
+ // Update a font description run for the selecting state.
+ FontDescriptionRun& fontDescriptionRun = UpdateSelectionFontStyleRun( mImpl->mEventData,
+ mImpl->mModel->mLogicalModel,
+ startOfSelectedText,
+ lengthOfSelectedText );
+
+ fontDescriptionRun.width = width;
+ fontDescriptionRun.widthDefined = true;
+
+ mImpl->mTextUpdateInfo.mCharacterIndex = startOfSelectedText;
+ mImpl->mTextUpdateInfo.mNumberOfCharactersToRemove = lengthOfSelectedText;
+ mImpl->mTextUpdateInfo.mNumberOfCharactersToAdd = lengthOfSelectedText;
+ }
+ else
+ {
+ mImpl->mTextUpdateInfo.mCharacterIndex = 0;
+ mImpl->mTextUpdateInfo.mNumberOfCharactersToRemove = mImpl->mTextUpdateInfo.mPreviousNumberOfCharacters;
+ mImpl->mTextUpdateInfo.mNumberOfCharactersToAdd = mImpl->mModel->mLogicalModel->mText.Count();
+ }
// Request to relayout.
mImpl->mOperationsPending = static_cast<OperationsMask>( mImpl->mOperationsPending |
mImpl->mRecalculateNaturalSize = true;
mImpl->RequestRelayout();
- mImpl->mTextUpdateInfo.mCharacterIndex = startOfSelectedText;
- mImpl->mTextUpdateInfo.mNumberOfCharactersToRemove = lengthOfSelectedText;
- mImpl->mTextUpdateInfo.mNumberOfCharactersToAdd = lengthOfSelectedText;
-
// As the font might change, recalculate the handle positions is needed.
mImpl->mEventData->mUpdateLeftSelectionPosition = true;
mImpl->mEventData->mUpdateRightSelectionPosition = true;
{
CharacterIndex startOfSelectedText = 0u;
Length lengthOfSelectedText = 0u;
- FontDescriptionRun& fontDescriptionRun = UpdateSelectionFontStyleRun( mImpl->mEventData,
- mImpl->mModel->mLogicalModel,
- startOfSelectedText,
- lengthOfSelectedText );
- fontDescriptionRun.slant = slant;
- fontDescriptionRun.slantDefined = true;
+ if( EventData::SELECTING == mImpl->mEventData->mState )
+ {
+ // Update a font description run for the selecting state.
+ FontDescriptionRun& fontDescriptionRun = UpdateSelectionFontStyleRun( mImpl->mEventData,
+ mImpl->mModel->mLogicalModel,
+ startOfSelectedText,
+ lengthOfSelectedText );
+
+ fontDescriptionRun.slant = slant;
+ fontDescriptionRun.slantDefined = true;
+
+ mImpl->mTextUpdateInfo.mCharacterIndex = startOfSelectedText;
+ mImpl->mTextUpdateInfo.mNumberOfCharactersToRemove = lengthOfSelectedText;
+ mImpl->mTextUpdateInfo.mNumberOfCharactersToAdd = lengthOfSelectedText;
+ }
+ else
+ {
+ mImpl->mTextUpdateInfo.mCharacterIndex = 0;
+ mImpl->mTextUpdateInfo.mNumberOfCharactersToRemove = mImpl->mTextUpdateInfo.mPreviousNumberOfCharacters;
+ mImpl->mTextUpdateInfo.mNumberOfCharactersToAdd = mImpl->mModel->mLogicalModel->mText.Count();
+ }
// Request to relayout.
mImpl->mOperationsPending = static_cast<OperationsMask>( mImpl->mOperationsPending |
mImpl->mRecalculateNaturalSize = true;
mImpl->RequestRelayout();
- mImpl->mTextUpdateInfo.mCharacterIndex = startOfSelectedText;
- mImpl->mTextUpdateInfo.mNumberOfCharactersToRemove = lengthOfSelectedText;
- mImpl->mTextUpdateInfo.mNumberOfCharactersToAdd = lengthOfSelectedText;
-
// As the font might change, recalculate the handle positions is needed.
mImpl->mEventData->mUpdateLeftSelectionPosition = true;
mImpl->mEventData->mUpdateRightSelectionPosition = true;
{
CharacterIndex startOfSelectedText = 0u;
Length lengthOfSelectedText = 0u;
- FontDescriptionRun& fontDescriptionRun = UpdateSelectionFontStyleRun( mImpl->mEventData,
- mImpl->mModel->mLogicalModel,
- startOfSelectedText,
- lengthOfSelectedText );
- fontDescriptionRun.size = static_cast<PointSize26Dot6>( size * 64.f );
- fontDescriptionRun.sizeDefined = true;
+ if( EventData::SELECTING == mImpl->mEventData->mState )
+ {
+ // Update a font description run for the selecting state.
+ FontDescriptionRun& fontDescriptionRun = UpdateSelectionFontStyleRun( mImpl->mEventData,
+ mImpl->mModel->mLogicalModel,
+ startOfSelectedText,
+ lengthOfSelectedText );
+
+ fontDescriptionRun.size = static_cast<PointSize26Dot6>( size * 64.f );
+ fontDescriptionRun.sizeDefined = true;
+
+ mImpl->mTextUpdateInfo.mCharacterIndex = startOfSelectedText;
+ mImpl->mTextUpdateInfo.mNumberOfCharactersToRemove = lengthOfSelectedText;
+ mImpl->mTextUpdateInfo.mNumberOfCharactersToAdd = lengthOfSelectedText;
+ }
+ else
+ {
+ mImpl->mTextUpdateInfo.mCharacterIndex = 0;
+ mImpl->mTextUpdateInfo.mNumberOfCharactersToRemove = mImpl->mTextUpdateInfo.mPreviousNumberOfCharacters;
+ mImpl->mTextUpdateInfo.mNumberOfCharactersToAdd = mImpl->mModel->mLogicalModel->mText.Count();
+ }
// Request to relayout.
mImpl->mOperationsPending = static_cast<OperationsMask>( mImpl->mOperationsPending |
mImpl->mRecalculateNaturalSize = true;
mImpl->RequestRelayout();
- mImpl->mTextUpdateInfo.mCharacterIndex = startOfSelectedText;
- mImpl->mTextUpdateInfo.mNumberOfCharactersToRemove = lengthOfSelectedText;
- mImpl->mTextUpdateInfo.mNumberOfCharactersToAdd = lengthOfSelectedText;
-
// As the font might change, recalculate the handle positions is needed.
mImpl->mEventData->mUpdateLeftSelectionPosition = true;
mImpl->mEventData->mUpdateRightSelectionPosition = true;