[NUI] Add MinLineSize in RendererParameters (#1892)
authorJoogabYun <40262755+JoogabYun@users.noreply.github.com>
Tue, 11 Aug 2020 01:33:35 +0000 (10:33 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Mon, 8 Feb 2021 05:30:08 +0000 (14:30 +0900)
src/Tizen.NUI/src/internal/Interop/Interop.TextUtils.cs
src/Tizen.NUI/src/public/BaseComponents/TextUtils.cs
src/Tizen.NUI/src/public/Utility/TextPageUtil.cs

index 81d719b..904725c 100755 (executable)
@@ -126,6 +126,12 @@ namespace Tizen.NUI
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_RendererParameters_isTextColorSet_get")]
             public static extern bool RendererParameters_isTextColorSet_get(global::System.Runtime.InteropServices.HandleRef jarg1);
 
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_RendererParameters_minLineSize_set")]
+            public static extern void RendererParameters_minLineSize_set(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_RendererParameters_minLineSize_get")]
+            public static extern float RendererParameters_minLineSize_get(global::System.Runtime.InteropServices.HandleRef jarg1);
+
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_delete_RendererParameters")]
             public static extern void delete_RendererParameters(global::System.Runtime.InteropServices.HandleRef jarg1);
         }
index 8c963f0..e0945ae 100755 (executable)
@@ -38,6 +38,9 @@ namespace Tizen.NUI.BaseComponents
             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
         }
 
+        /// <summary>
+        /// Dispose
+        /// </summary>
         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
         {
             Interop.RendererParameters.delete_RendererParameters(swigCPtr);
@@ -585,6 +588,26 @@ namespace Tizen.NUI.BaseComponents
             }
         }
 
+        /// <summary>
+        /// Minimum size of line.
+        /// </summary>
+        // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public float MinLineSize
+        {
+            set
+            {
+                Interop.RendererParameters.RendererParameters_minLineSize_set(swigCPtr, value);
+                if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            }
+            get
+            {
+                float ret = Interop.RendererParameters.RendererParameters_minLineSize_get(swigCPtr);
+                if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+                return ret;
+            }
+        }
+
     }
 
     /// <summary>
@@ -604,6 +627,9 @@ namespace Tizen.NUI.BaseComponents
             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
         }
 
+        /// <summary>
+        /// Dispose
+        /// </summary>
         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
         {
             Interop.EmbeddedItemInfo.delete_EmbeddedItemInfo(swigCPtr);
@@ -777,6 +803,9 @@ namespace Tizen.NUI.BaseComponents
             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
         }
 
+        /// <summary>
+        /// Dispose
+        /// </summary>
         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
         {
             Interop.ShadowParameters.delete_ShadowParameters(swigCPtr);
@@ -893,6 +922,8 @@ namespace Tizen.NUI.BaseComponents
         }
     }
 
+    /// <summary>
+    /// </summary>
     // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
     [EditorBrowsable(EditorBrowsableState.Never)]
     public static partial class TextUtils
@@ -1004,7 +1035,8 @@ namespace Tizen.NUI.BaseComponents
         /// <summary>
         /// Splits the text in pages of the size given in @p textParameters
         /// @note The returned indices are indices to utf32 characters. The input text is encoded in utf8.
-        /// <returns> An array with the indices of the last character of each page
+        /// <returns> An array with the indices of the last character of each page </returns>
+        /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
         public static Tizen.NUI.PropertyArray GetLastCharacterIndex(RendererParameters textParameters)
         {
index c188f7a..ac75314 100755 (executable)
@@ -54,23 +54,21 @@ namespace Tizen.NUI.Utility
   /// This is utility class for paging very long text.
   /// </summary>
   [EditorBrowsable(EditorBrowsableState.Never)]
-  public class TextPageUtil
+  public class TextPageUtil : Disposable
   {
     private static char LESS_THAN      = '<';
     private static char GREATER_THAN   = '>';
     private static char EQUAL          = '=';
     private static char QUOTATION_MARK = '\'';
     private static char SLASH          = '/';
-    private static char BACK_SLASH     = '\\';
-    private static char AMPERSAND      = '&';
-    private static char HASH           = '#';
-    private static char SEMI_COLON     = ';';
-    private static char CHAR_ARRAY_END = '\0';
-    private static char HEX_CODE       = 'x';
+    // private static char BACK_SLASH     = '\\';
+    // private static char AMPERSAND      = '&';
+    // private static char HASH           = '#';
+    // private static char SEMI_COLON     = ';';
+    // private static char CHAR_ARRAY_END = '\0';
+    // private static char HEX_CODE       = 'x';
     private static byte WHITE_SPACE    = 0x20;
 
-    private static int TEXTPAGE_TEXT_CHUNK = 20000;
-
     private int totalPageCnt;
 
     private List<PageData> pageList;
@@ -86,7 +84,7 @@ namespace Tizen.NUI.Utility
     [EditorBrowsable(EditorBrowsableState.Never)]
     public int SetText(TextLabel label, string str)
     {
-      if(str == null) return 0;
+      if(label == null || str == null) return 0;
 
       // perform this operation to match the utf32 character used in native Dali.
       bool previousMarkup = label.EnableMarkup;
@@ -124,6 +122,7 @@ namespace Tizen.NUI.Utility
       textParameters.TextHeight = (uint)label.Size.Height;
       textParameters.EllipsisEnabled = true;
       textParameters.MarkupEnabled = previousMarkup;
+      textParameters.MinLineSize = label.MinLineSize;
 
 
       Tizen.NUI.PropertyArray cutOffIndexArray = TextUtils.GetLastCharacterIndex( textParameters );
@@ -154,6 +153,8 @@ namespace Tizen.NUI.Utility
           if(offset <= 0 ) break;
       }
 
+      textParameters.Dispose();
+      cutOffIndexArray.Dispose();
       stream = null;
       return totalPageCnt;
     }
@@ -287,9 +288,6 @@ namespace Tizen.NUI.Utility
 
       pageData.startOffset = offset;
 
-      bool isPreviousLessThan = false;
-      bool isPreviousSlash = false;
-
       // If the markup was previously open, the markup tag should be attached to the front.
       string tag ="";
       foreach (TagData data in tagList)