Revert "[Tizen] Add Text Preedit Style"
authorHeeyong Song <heeyong.song@samsung.com>
Tue, 12 Nov 2019 06:50:02 +0000 (15:50 +0900)
committerHeeyong Song <heeyong.song@samsung.com>
Tue, 12 Nov 2019 06:50:05 +0000 (15:50 +0900)
This reverts commit 475cc146d15d455f955e524a92f5cee25ac58b6b.

automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Controller.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-input-method-context.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-input-method-context.h
dali-toolkit/internal/text/text-controller-impl.cpp

index e1787c9..e581626 100755 (executable)
@@ -258,9 +258,6 @@ int UtcDaliTextControllerImfEvent(void)
   controller->GetText( text );
   DALI_TEST_EQUALS( "Hello ", text, TEST_LOCATION );
 
-  // for coverage
-  inputMethodContext.SetPreeditStyle( InputMethodContext::PreeditStyle::UNDERLINE );
-
   // Send PRE_EDIT event
   imfEvent = InputMethodContext::EventData( InputMethodContext::PRE_EDIT, "wo", 6, 2 );
   controller->OnInputMethodContextEvent( inputMethodContext, imfEvent );
index f316e50..74a2bd5 100755 (executable)
@@ -59,8 +59,6 @@ public:
   const std::string& GetSurroundingText() const;
   void ApplyOptions( const InputMethodOptions& options );
   bool FilterEventKey( const Dali::KeyEvent& keyEvent );
-  void SetPreeditStyle( Dali::InputMethodContext::PreeditStyle type );
-  Dali::InputMethodContext::PreeditStyle GetPreeditStyle() const;
 
 public:  // Signals
   ActivatedSignalType& ActivatedSignal() { return mActivatedSignal; }
@@ -87,7 +85,6 @@ private:
   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;
 
   ActivatedSignalType      mActivatedSignal;
   KeyboardEventSignalType  mEventSignal;
@@ -128,8 +125,7 @@ InputMethodContext::InputMethodContext( /*Ecore_X_Window ecoreXwin*/ )
 : mIMFCursorPosition( 0 ),
   mSurroundingText(),
   mRestoreAfterFocusLost( false ),
-  mIdleCallbackConnected( false ),
-  mPreeditStyle( Dali::InputMethodContext::PreeditStyle::NONE )
+  mIdleCallbackConnected( false )
 {
   CreateContext( /*ecoreXwin*/ );
   ConnectCallbacks();
@@ -216,16 +212,6 @@ bool InputMethodContext::FilterEventKey( const Dali::KeyEvent& keyEvent )
 {
   return false;
 }
-
-void InputMethodContext::SetPreeditStyle( Dali::InputMethodContext::PreeditStyle type )
-{
-  mPreeditStyle = type;
-}
-
-Dali::InputMethodContext::PreeditStyle InputMethodContext::GetPreeditStyle() const
-{
-  return mPreeditStyle;
-}
 } // Adaptor
 
 } // Internal
@@ -322,17 +308,6 @@ bool InputMethodContext::FilterEventKey( const Dali::KeyEvent& keyEvent )
   return Internal::Adaptor::InputMethodContext::GetImplementation(*this).FilterEventKey( keyEvent );
 }
 
-void InputMethodContext::SetPreeditStyle( Dali::InputMethodContext::PreeditStyle type )
-{
-  Internal::Adaptor::InputMethodContext::GetImplementation(*this).SetPreeditStyle( type );
-}
-
-Dali::InputMethodContext::PreeditStyle InputMethodContext::GetPreeditStyle() const
-{
-  return Internal::Adaptor::InputMethodContext::GetImplementation(*this).GetPreeditStyle();
-}
-
-// Signals
 InputMethodContext::ActivatedSignalType& InputMethodContext::ActivatedSignal()
 {
   return Internal::Adaptor::InputMethodContext::GetImplementation(*this).ActivatedSignal();
index a56ea81..cf174cf 100755 (executable)
@@ -47,16 +47,7 @@ class InputMethodContext : public BaseHandle
 public:
 
   /**
-  * @brief The direction of text.
-  */
-  enum TextDirection
-  {
-    LeftToRight,
-    RightToLeft,
-  };
-
-  /**
-   * @brief Events that are generated by the InputMethodContext.
+   * @brief Events that are generated by the input method context.
    */
   enum EventType
   {
@@ -69,47 +60,7 @@ public:
   };
 
   /**
-   * @brief Enumeration for state of the input panel.
-   */
-  enum State
-  {
-    DEFAULT = 0,   ///< Unknown state
-    SHOW,          ///< Input panel is shown
-    HIDE,          ///< Input panel is hidden
-    WILL_SHOW      ///< Input panel in process of being shown
-  };
-
-  /**
-   * @brief Enumeration for the type of Keyboard.
-   */
-  enum KeyboardType
-  {
-    SOFTWARE_KEYBOARD,  ///< Software keyboard (Virtual keyboard) is default
-    HARDWARE_KEYBOARD   ///< Hardware keyboard
-  };
-
-  /**
-   * @brief Enumeration for the language mode of the input panel.
-   */
-  enum class InputPanelLanguage
-  {
-    AUTOMATIC,    ///< IME Language automatically set depending on the system display
-    ALPHABET      ///< Latin alphabet at all times
-  };
-
-  /**
-   * @brief Enumeration for the preedit style types.
-   */
-  enum class PreeditStyle
-  {
-    NONE,         ///< None style
-    UNDERLINE,    ///< Underline substring style
-    REVERSE,      ///< Reverse substring style
-    HIGHLIGHT     ///< Highlight substring style
-  };
-
-  /**
-   * @brief This structure is used to pass on data from the InputMethodContext regarding predictive text.
+   * @brief This structure is used to pass on data from the input method cotext regarding predictive text.
    */
   struct EventData
   {
@@ -301,20 +252,6 @@ public:
    */
   bool FilterEventKey( const Dali::KeyEvent& keyEvent );
 
-  /**
-   * @brief Sets the preedit type.
-   *
-   * @param[in] type The preedit style type
-   */
-  void SetPreeditStyle( PreeditStyle type );
-
-  /**
-   * @brief Gets the preedit type.
-   *
-   * @return The preedit style type
-   */
-  PreeditStyle GetPreeditStyle() const;
-
 public:
 
   // Signals
index 2c9a78d..2686153 100755 (executable)
@@ -1072,35 +1072,21 @@ bool Controller::Impl::UpdateModel( OperationsMask operationsRequired )
       mEventData->mPreEditFlag &&
       ( 0u != mModel->mVisualModel->mCharactersToGlyph.Count() ) )
   {
-    Dali::InputMethodContext::PreeditStyle type = mEventData->mInputMethodContext.GetPreeditStyle();
+    // Add the underline for the pre-edit text.
+    const GlyphIndex* const charactersToGlyphBuffer = mModel->mVisualModel->mCharactersToGlyph.Begin();
+    const Length* const glyphsPerCharacterBuffer = mModel->mVisualModel->mGlyphsPerCharacter.Begin();
 
-    switch( type )
-    {
-      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();
+    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 );
 
-        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 );
+    GlyphRun underlineRun;
+    underlineRun.glyphIndex = glyphStart;
+    underlineRun.numberOfGlyphs = 1u + glyphEnd - glyphStart;
 
-        GlyphRun underlineRun;
-        underlineRun.glyphIndex = glyphStart;
-        underlineRun.numberOfGlyphs = 1u + glyphEnd - glyphStart;
-
-        mModel->mVisualModel->mUnderlineRuns.PushBack( underlineRun );
-        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;
-    }
+    // TODO: At the moment the underline runs are only for pre-edit.
+    mModel->mVisualModel->mUnderlineRuns.PushBack( underlineRun );
   }
 
   // The estimated number of lines. Used to avoid reallocations when layouting.