From: Adeel Kazmi Date: Thu, 17 Sep 2020 18:03:38 +0000 (+0000) Subject: Merge "Text selection refactoring" into devel/master X-Git-Tag: dali_1.9.30~2 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=517dab63fca9d69d49a68c8763fe477f53cc6d5f;hp=60d99d04d7677a1b91d4f2fdd9e74bc5e1b5e7bf Merge "Text selection refactoring" into devel/master --- diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp index 18225bb..6bf3ef9 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp @@ -1557,8 +1557,6 @@ int utcDaliTextEditorEvent02(void) application.Render(); Actor layer = editor.GetChildAt( 1u ); - DALI_TEST_CHECK( layer.GetProperty< bool >( Actor::Property::IS_LAYER ) ); - DALI_TEST_EQUALS( layer.GetChildCount(), 1u, TEST_LOCATION ); // The cursor. DALI_TEST_EQUALS( stencil.GetChildCount(), 0u, TEST_LOCATION ); @@ -2157,6 +2155,23 @@ int utcDaliTextEditorEvent07(void) // The text is not selected and not changed because of 'SetProperty( DevelTextEditor::Property::ENABLE_SHIFT_SELECTION, false )' DALI_TEST_EQUALS( "Hello\nld\nHello lo\nworld", editor.GetProperty( TextEditor::Property::TEXT ), TEST_LOCATION ); + // Select all Text + application.ProcessEvent( GenerateKey( "a", "", "a", KEY_A_CODE, KEY_CONTROL_MODIFIER, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + + // Render and notify + application.SendNotification(); + application.Render(); + + // replace text with "c" + application.ProcessEvent( GenerateKey( "c", "", "c", KEY_C_CODE, 0, 0, Integration::KeyEvent::DOWN, "c", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) ); + + // Render and notify + application.SendNotification(); + application.Render(); + + //text is "c" + DALI_TEST_EQUALS( "c", editor.GetProperty( TextEditor::Property::TEXT ), TEST_LOCATION ); + END_TEST; } diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp index 4d8b79e..7b68239 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp @@ -1686,8 +1686,6 @@ int utcDaliTextFieldEvent02(void) application.Render(); Actor layer = field.GetChildAt( 1u ); - DALI_TEST_CHECK( layer.GetProperty< bool >( Actor::Property::IS_LAYER ) ); - DALI_TEST_EQUALS( layer.GetChildCount(), 1u, TEST_LOCATION ); // The cursor. DALI_TEST_EQUALS( stencil.GetChildCount(), 0u, TEST_LOCATION ); diff --git a/automated-tests/src/dali-toolkit/utc-Dali-VideoView.cpp b/automated-tests/src/dali-toolkit/utc-Dali-VideoView.cpp index 54cb6f7..b0aa75e 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-VideoView.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-VideoView.cpp @@ -692,6 +692,8 @@ int UtcDaliVideoViewSyncAniamtionForCoverage(void) VideoView videoView = DevelVideoView::New( Dali::VideoSyncMode::ENABLED ); DALI_TEST_CHECK( videoView ); + application.GetScene().Add( videoView ); + // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); @@ -732,6 +734,8 @@ int UtcDaliVideoViewASyncAniamtionForCoverage(void) VideoView videoView = DevelVideoView::New( Dali::VideoSyncMode::DISABLED ); DALI_TEST_CHECK( videoView ); + application.GetScene().Add( videoView ); + // Build the animation float durationSeconds(1.0f); Animation animation = Animation::New(durationSeconds); diff --git a/dali-toolkit/devel-api/controls/text-controls/text-selection-popup.cpp b/dali-toolkit/devel-api/controls/text-controls/text-selection-popup.cpp index cfc5e43..9f92518 100644 --- a/dali-toolkit/devel-api/controls/text-controls/text-selection-popup.cpp +++ b/dali-toolkit/devel-api/controls/text-controls/text-selection-popup.cpp @@ -64,7 +64,7 @@ void TextSelectionPopup::EnableButtons(Toolkit::TextSelectionPopup::Buttons butt GetImpl(*this).EnableButtons(buttonsToEnable); } -void TextSelectionPopup::RaiseAbove(Layer target) +void TextSelectionPopup::RaiseAbove(Actor target) { GetImpl(*this).RaiseAbove(target); } diff --git a/dali-toolkit/devel-api/controls/text-controls/text-selection-popup.h b/dali-toolkit/devel-api/controls/text-controls/text-selection-popup.h index c46d138..551066f 100644 --- a/dali-toolkit/devel-api/controls/text-controls/text-selection-popup.h +++ b/dali-toolkit/devel-api/controls/text-controls/text-selection-popup.h @@ -235,11 +235,11 @@ public: void EnableButtons(Toolkit::TextSelectionPopup::Buttons buttonsToEnable); /** - * @brief Raises the toolbar's layer above the given @e target layer. + * @brief Raises the toolbar's actor above the given @e target actor. * - * @param[in] target The layer to get above of. + * @param[in] target The actor to get above of. */ - void RaiseAbove(Layer target); + void RaiseAbove(Actor target); /** * @brief Show the Popup if not being shown diff --git a/dali-toolkit/devel-api/controls/text-controls/text-selection-toolbar.cpp b/dali-toolkit/devel-api/controls/text-controls/text-selection-toolbar.cpp index 276dfe4..64515fc 100644 --- a/dali-toolkit/devel-api/controls/text-controls/text-selection-toolbar.cpp +++ b/dali-toolkit/devel-api/controls/text-controls/text-selection-toolbar.cpp @@ -69,7 +69,7 @@ void TextSelectionToolbar::ResizeDividers(Size& size) GetImpl(*this).ResizeDividers(size); } -void TextSelectionToolbar::RaiseAbove(Layer target) +void TextSelectionToolbar::RaiseAbove(Actor target) { GetImpl(*this).RaiseAbove(target); } diff --git a/dali-toolkit/devel-api/controls/text-controls/text-selection-toolbar.h b/dali-toolkit/devel-api/controls/text-controls/text-selection-toolbar.h index 71e7419..98b4e7d 100644 --- a/dali-toolkit/devel-api/controls/text-controls/text-selection-toolbar.h +++ b/dali-toolkit/devel-api/controls/text-controls/text-selection-toolbar.h @@ -119,11 +119,11 @@ public: void ResizeDividers(Size& size); /** - * @brief Raises the layer above the given @e target layer. + * @brief Raises the actor above the given @e target actor. * - * @param[in] target The layer to get above of. + * @param[in] target The actor to get above of. */ - void RaiseAbove(Layer target); + void RaiseAbove(Actor target); /** * @copydoc Toolkit::ScrollView::ScrollTo(const Vector2&) diff --git a/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp index e88adbe..6631898 100644 --- a/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp @@ -344,7 +344,7 @@ void TextSelectionPopup::EnableButtons( Toolkit::TextSelectionPopup::Buttons but mButtonsChanged = true; } -void TextSelectionPopup::RaiseAbove( Layer target ) +void TextSelectionPopup::RaiseAbove( Actor target ) { if( mToolbar ) { diff --git a/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.h b/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.h index 09066c0..a94fee9 100644 --- a/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.h +++ b/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.h @@ -122,7 +122,7 @@ public: /** * @copydoc Toolkit::TextSelectionPopup::RaiseAbove() */ - void RaiseAbove( Layer target ); + void RaiseAbove( Actor target ); /** * @copydoc Toolkit::TextSelectionPopup::ShowPopup() diff --git a/dali-toolkit/internal/controls/text-controls/text-selection-toolbar-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-selection-toolbar-impl.cpp index 4a06886..8cdd32a 100644 --- a/dali-toolkit/internal/controls/text-controls/text-selection-toolbar-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-selection-toolbar-impl.cpp @@ -184,10 +184,10 @@ void TextSelectionToolbar::OnRelayout( const Vector2& size, RelayoutContainer& c void TextSelectionToolbar::SetPopupMaxSize( const Size& maxSize ) { mMaxSize = maxSize; - if (mScrollView && mToolbarLayer ) + if( mScrollView && mToolbarActor ) { mScrollView.SetProperty( Actor::Property::MAXIMUM_SIZE, mMaxSize ); - mToolbarLayer.SetProperty( Actor::Property::MAXIMUM_SIZE, mMaxSize ); + mToolbarActor.SetProperty( Actor::Property::MAXIMUM_SIZE, mMaxSize ); } } @@ -224,11 +224,11 @@ void TextSelectionToolbar::SetUp() self.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::ALL_DIMENSIONS ); - // Create Layer to house the toolbar. - mToolbarLayer = Layer::New(); - mToolbarLayer.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::ALL_DIMENSIONS ); - mToolbarLayer.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); - mToolbarLayer.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); + // Create Actor to house the toolbar. + mToolbarActor = Actor::New(); + mToolbarActor.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::ALL_DIMENSIONS ); + mToolbarActor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); + mToolbarActor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); if( !mScrollView ) { @@ -243,9 +243,9 @@ void TextSelectionToolbar::SetUp() mTableOfButtons.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER_LEFT ); mScrollView.Add( mTableOfButtons ); - mToolbarLayer.Add( mScrollView ); + mToolbarActor.Add( mScrollView ); - self.Add( mToolbarLayer ); + self.Add( mToolbarActor ); } void TextSelectionToolbar::SetUpScrollBar( bool enable ) @@ -316,9 +316,9 @@ void TextSelectionToolbar::ResizeDividers( Size& size ) RelayoutRequest(); } -void TextSelectionToolbar::RaiseAbove( Layer target ) +void TextSelectionToolbar::RaiseAbove( Actor target ) { - mToolbarLayer.RaiseAbove( target ); + mToolbarActor.RaiseAbove( target ); } void TextSelectionToolbar::SetScrollBarPadding( const Vector2& padding ) diff --git a/dali-toolkit/internal/controls/text-controls/text-selection-toolbar-impl.h b/dali-toolkit/internal/controls/text-controls/text-selection-toolbar-impl.h index 5052ded..5cc4fda 100644 --- a/dali-toolkit/internal/controls/text-controls/text-selection-toolbar-impl.h +++ b/dali-toolkit/internal/controls/text-controls/text-selection-toolbar-impl.h @@ -83,7 +83,7 @@ public: /** * @copydoc Toolkit::TextSelectionToolbar::RaiseAbove() */ - void RaiseAbove( Layer target ); + void RaiseAbove( Actor target ); /** * Sets the scroll bar padding. @@ -180,7 +180,7 @@ private: private: // Data - Layer mToolbarLayer; ///< The layer used to house the toolbar. + Actor mToolbarActor; ///< The actor used to house the toolbar. Toolkit::TableView mTableOfButtons; ///< Actor which holds all the buttons, sensitivity can be set on buttons via this actor Toolkit::ScrollView mScrollView; ///< Provides scrolling of Toolbar when content does not fit. Toolkit::ScrollBar mScrollBar; ///< An horizontal scroll bar for the text's popup options. diff --git a/dali-toolkit/internal/text/decorator/text-decorator.cpp b/dali-toolkit/internal/text/decorator/text-decorator.cpp index ad02368..2a57d4d 100644 --- a/dali-toolkit/internal/text/decorator/text-decorator.cpp +++ b/dali-toolkit/internal/text/decorator/text-decorator.cpp @@ -767,7 +767,7 @@ struct Decorator::Impl : public ConnectionTracker { if( !mActiveLayer ) { - mActiveLayer = Layer::New(); + mActiveLayer = Actor::New(); #ifdef DECORATOR_DEBUG mActiveLayer.SetProperty( Actor::Property::NAME, "ActiveLayerActor" ); #endif @@ -1881,7 +1881,7 @@ struct Decorator::Impl : public ConnectionTracker Timer mCursorBlinkTimer; ///< Timer to signal cursor to blink Timer mScrollTimer; ///< Timer used to scroll the text when the grab handle is moved close to the edges. - Layer mActiveLayer; ///< Layer for active handles and alike that ensures they are above all else. + Actor mActiveLayer; ///< Actor for active handles and alike that ensures they are above all else. PropertyNotification mHandleVerticalLessThanNotification; ///< Notifies when the 'y' coord of the active layer is less than a given value. PropertyNotification mHandleVerticalGreaterThanNotification; ///< Notifies when the 'y' coord of the active layer is grater than a given value. PropertyNotification mHandleHorizontalLessThanNotification; ///< Notifies when the 'x' coord of the active layer is less than a given value. diff --git a/dali-toolkit/internal/text/text-controller.cpp b/dali-toolkit/internal/text/text-controller.cpp index 5a8a6e0..9b46fe2 100755 --- a/dali-toolkit/internal/text/text-controller.cpp +++ b/dali-toolkit/internal/text/text-controller.cpp @@ -53,6 +53,8 @@ const std::string EMPTY_STRING(""); const std::string KEY_C_NAME = "c"; const std::string KEY_V_NAME = "v"; const std::string KEY_X_NAME = "x"; +const std::string KEY_A_NAME = "a"; +const std::string KEY_INSERT_NAME = "Insert"; const char * const PLACEHOLDER_TEXT = "text"; const char * const PLACEHOLDER_TEXT_FOCUSED = "textFocused"; @@ -2907,12 +2909,12 @@ bool Controller::KeyEvent( const Dali::KeyEvent& keyEvent ) // Do nothing return false; } - else if ( keyEvent.IsCtrlModifier() ) + else if ( keyEvent.IsCtrlModifier() && !keyEvent.IsShiftModifier()) { bool consumed = false; - if (keyName == KEY_C_NAME) + if (keyName == KEY_C_NAME || keyName == KEY_INSERT_NAME) { - // Ctrl-C to copy the selected text + // Ctrl-C or Ctrl+Insert to copy the selected text TextPopupButtonTouched( Toolkit::TextSelectionPopup::COPY ); consumed = true; } @@ -2928,6 +2930,12 @@ bool Controller::KeyEvent( const Dali::KeyEvent& keyEvent ) TextPopupButtonTouched( Toolkit::TextSelectionPopup::CUT ); consumed = true; } + else if (keyName == KEY_A_NAME) + { + // Ctrl-A to select All the text + TextPopupButtonTouched( Toolkit::TextSelectionPopup::SELECT_ALL ); + consumed = true; + } return consumed; } else if( ( Dali::DALI_KEY_BACKSPACE == keyCode ) || diff --git a/dali-toolkit/public-api/dali-toolkit-version.cpp b/dali-toolkit/public-api/dali-toolkit-version.cpp index d355b35..5afd0b1 100644 --- a/dali-toolkit/public-api/dali-toolkit-version.cpp +++ b/dali-toolkit/public-api/dali-toolkit-version.cpp @@ -29,7 +29,7 @@ namespace Toolkit { const unsigned int TOOLKIT_MAJOR_VERSION = 1; const unsigned int TOOLKIT_MINOR_VERSION = 9; -const unsigned int TOOLKIT_MICRO_VERSION = 28; +const unsigned int TOOLKIT_MICRO_VERSION = 29; const char* const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__; #ifdef DEBUG_ENABLED diff --git a/packaging/dali-toolkit.spec b/packaging/dali-toolkit.spec index df51c53..5f1b9cf 100644 --- a/packaging/dali-toolkit.spec +++ b/packaging/dali-toolkit.spec @@ -1,6 +1,6 @@ Name: dali2-toolkit Summary: Dali 3D engine Toolkit -Version: 1.9.28 +Version: 1.9.29 Release: 1 Group: System/Libraries License: Apache-2.0 and BSD-3-Clause and MIT