From abaf5e6ffd0385d9be2537b57982645c736b61f4 Mon Sep 17 00:00:00 2001 From: dongsug-song <35130733+dongsug-song@users.noreply.github.com> Date: Mon, 1 Oct 2018 16:06:10 +0900 Subject: [PATCH] [NUI] Integration from dalihub/TizenFX to Samsung/TizenFX (#492) * Added LayoutGroup and LayoutItem classes in NUI. This was done by using bindings wrapper classes for LayoutItem, LayoutGroup, LayoutMeasureSpec, LayoutLength, and LayoutMeasuredSize. Change-Id: I19e28bdff59a62cf1c8e8711f50f9f0e8f1c119a * Layouting support in NUI Change-Id: I3d6f688d869faa81c34385db37feceb1d8c1d0c0 * Fixed disposed bug and removed RegisterChildProperties API usage. Change-Id: I7b71bd1a3a03306897abdf3c263c6bbb65c1bff8 * RootLayout added to Window Change-Id: Ie47ceec452b5f254950263bdaf661e9e3fe86d1f * All Layers have an Absolute layout Change-Id: I08281a25b2b73822b45f5c6a567b574b5af74fb4 * Set View.Size2D sets layout minimum size if exists. Change-Id: Ide73c78957d9ee5d4799bfff4aa2232b87ffa536 * [NUI] Minimize public api for xaml Change-Id: Ib1426b1956a2af307bd6128d6b97067b0d732847 * Renaming of rootlayer in Layer.cs Change-Id: I583f49caaad819cabaca83b09c9c7dd9c2b9a331 * Fix NUI nested layout issue Change-Id: I68edd6cf8295e06a52655d84b8ce039a4e1f1008 * [NUI] Back-sync Samsung/TizenFX into dalihub/TizenFX Change-Id: Ib63e792bc3474c9226506f30889994219e237ec1 * [NUI] Remove tabs and redundant spaces Change-Id: I1d512d7f478e532f76629b2529995386820fc764 * Sync dalihub/TizenFX and Samsung/TizenFX - [NUI] Remove apis which are using internal APIs (#324) Some apis are using DALi internal APIs. Clean up these wrong apis to prevent future errors. Signed-off-by: minho.sun Change-Id: I77f773ec84f93f69684c2bdad26d9721f8ed705d Signed-off-by: dongsug.song * Sync dalihub/TizenFX and Samsung/TizenFX for NUI-XAML related changes Change-Id: Ied6a4e33d462712672e65763572c6aa88065a897 Signed-off-by: dongsug.song * Support multi-cascade property setting for Size2D and Position2D Change-Id: Ibeb9e9ec639742b78054fe8592167170ea0f00d2 Signed-off-by: dongsug.song * Add Mouse button type to identify clicked button kind Change-Id: Id336dacccff8192a17cda552ba8ea2ba01121002 Signed-off-by: dongsug.song * [NUI] Fix dereferenced error Value trans, which has null value, is dereferenced in member access expression trans.Name Change-Id: I5b7fa2a0e96689ff0cc0821f2e931ed3c4001e9d Signed-off-by: huiyu.eun * [NUI]Remove ContentProperty attribute and update sample Change-Id: I0fbb60bf00c609779b6f5ff4d8aff58a26a8819e * [NUI] Fix children count of LayoutGroup bug Change-Id: I73c3b597b161a2dbf4a52d37e6f5a0ab4858c11b Signed-off-by: huiyu.eun * [NUI] Make Layout APIs as internal ones (will be changed as public APIs later) Conflicts: src/Tizen.NUI/src/internal/Layouting/LayoutGroupWrapper.cs src/Tizen.NUI/src/internal/Layouting/LayoutItemWrapper.cs Change-Id: Ia64e9216d10ecc986e0e977f2e0633a03813faec Signed-off-by: dongsug.song * Fix View Size2D. We force Size2D by setting fixed width & height specifications. There is no really another way in new layouting without breaking new layouting design. Also MinimumSize will set now Layout.MinimumSize. Change-Id: I65c7eaab8210c83b9097426a14c8877173d11f90 * [NUI] Change Parameter type of KeyboardRepeatInfo APIs - Changed the parameters type of KeyboardRepeatInfo APIs : 'double' type -> 'float' type Change-Id: I3940e44a1a2c116988e8c947ae81d118ac266000 Signed-off-by: Seoyeon Kim * [NUI] Fix getting ClippingMode error Change-Id: I2379ec6adda1442e819d2adbaa9751e5dd154996 * [NUI] Fix animation flickering issue. Change-Id: Idd3e28ac861a6fa33ad316e4bcae6a7b2199c0de Signed-off-by: Feng Jin * [NUI] Remove redundant logs Change-Id: Ic7ec157fe8117b613d0d008f68e74cf7c4bccf64 * [NUI] Fix KeyValue issue Change-Id: I1970a61633fba277379a43035cf84ec2871d1cdd * [NUI]public BindableObject.GetValue and BindableObject.SetValue to enable other modules(EX.Tizen.TV.NUI) to implement data binding. Change-Id: Ibb048e668e765a96f1e8553951e4073b181e9a84 Signed-off-by: Feng Jin * [NUI]Add protect codes in API View::Add 1. Add protect codes, so that if the child is null, this API won't don anything. Change-Id: Icfd7e2cbb08b99ed962660edb88e8797bad2b654 * [NUI] public gesture detector. Change-Id: Ife9902fe77b43f2c422a1a2ebeaf474d13e67589 Signed-off-by: Feng Jin * GridLayout added Change-Id: I67916a0e2a8efde6fd8d28daac79bca39d679d10 * Add PropertyValue.Get function for RelativeVector2, RelativeVector3, and RelativeVector4 type. Change-Id: I181c51a6eea0a94721b28a48d8187673a3f0b88b Signed-off-by: Feng Jin * Explict assigning of Layouts to children Allows legacy GridContainer to display it's children. CustomLayouts children get a LayoutItem and displayed. Change-Id: Ic3f900ae01800de77695b85a57661f886ee060b7 * [NUI] Add DestroyContext call before disposing TextField/TextEditor In order to speed up IME hide, temporarily add DestroyContext call. Change-Id: Id93c99f4d45061d4e406d36ced7a0ec09c8f2c34 * [NUI] VisualMap revising Here are some changes: Add VisualFittingMode property Add Atlasing property Add Shadow,Underline,Outline,Background property Add RenderIfTransparent property Change-Id: I8d85f9d1a438cb6fbb636f79c7438e9134e1df8f * [NUI] Add visual test example Change-Id: I25f41d969f7b98a494a4fa1716b0335c09ab5026 * [NUI] Add friend assembly for Tizen.TV.NUI.Component Change-Id: I2fdc02205c03aa98260035fb81998d68514c030e * View.cs assignement error and logging fix Change-Id: Ic43213bb7e565f03f83d27df153d095b0e9f7143 * [NUI] Add support for changing the Rendering behavior Change-Id: Ibbe3627659132fd40105482761795f62a92d1856 * Size2D set updates measure spec for all Views Previously Size2D set only updated the WIDTH/HEIGHT MEASURESPEC for Views that already had a Layout set. But if the Size2D was set before the View added to it's parent then the set size would not update the measure specs. Change-Id: I28e731e5e6c6318231b5ba25108bf2daa9cd3411 * [NUI] Avoid raising InputMethodContext reference count Change-Id: I25e89f41daa41008c81ae1b46fbb82c75a98a011 * [NUI] Add getter property for VisualFittingMode Change-Id: I1ee389dd4a84f153e4a5d063fe3331a9525757eb * [NUI] VisualMaps revising continue Here are changes: 1. Update VisualFittingMode 2. Remove EditorBrowsable attribute Change-Id: I2f272e822ba227fe255031b3574db325505e90e1 * [NUI] Add LinearLayout Alignment and Weight Change-Id: I0ed3010fd27f8f4cb26126efc5547a301c69cf38 Signed-off-by: Seoyeon Kim * SetLayoutRequired, IsLayoutRequired View API added Change-Id: I6b4351901ad841c04f92b22be62c43f7f20b9263 * Fixes required after https://review.tizen.org/gerrit/#/c/189231/ Removal of dangerous float conversion Change-Id: I6766c8747865c229a1df3ed669a1d9ab90fefdc4 * Update LayoutItem doxygen for Minimum(Width|Height) API. Change-Id: I0ead74f919c73823cb6f4b241bea81cbcdde4c98 * [NUI] Fix LayoutItemWrapperImpl null issue Change-Id: I158533d132eb81c4681d8ff622124ba45bfe0e4b Signed-off-by: huiyu.eun * [NUI] Fix RenderingBehavior issue Change-Id: I35b83e115fd60d2b43ed49c2a35a0f34377e55c2 Signed-off-by: huiyu.eun * [NUI] Support Resource path when using xaml Change-Id: I066c4a6b051bfdcc5fa6b26f9f784a2be5a255a7 * [NUI] Public ChildAdded,ChildRemoved,PropertySet events & properties of TableView.CellPosition Change-Id: I77b58a63e863b16e9eeef8c09da9ae5160f5e735 * [NUI] Public some apis of TableView,Animation,NUIApplication Change-Id: I280e6389cb9d2aa537d72c183b1547ee807fcfd6 * [NUI] Fix Codacy warnings --- .../src/internal/Layouting/LayoutGroup.cs | 9 +++++- src/Tizen.NUI/src/internal/Layouting/LayoutItem.cs | 20 +++++++++--- .../src/internal/Layouting/LayoutLength.cs | 7 ----- .../src/internal/Layouting/LayoutPINVOKE.cs | 36 +++++++++++----------- src/Tizen.NUI/src/internal/VersionCheck.cs | 6 ++-- .../src/public/BaseComponents/TextEditor.cs | 14 ++++++--- .../src/public/BaseComponents/TextField.cs | 14 ++++++--- src/Tizen.NUI/src/public/NUIConstants.cs | 2 +- 8 files changed, 66 insertions(+), 42 deletions(-) diff --git a/src/Tizen.NUI/src/internal/Layouting/LayoutGroup.cs b/src/Tizen.NUI/src/internal/Layouting/LayoutGroup.cs index 9408d69..d2dd3fa 100755 --- a/src/Tizen.NUI/src/internal/Layouting/LayoutGroup.cs +++ b/src/Tizen.NUI/src/internal/Layouting/LayoutGroup.cs @@ -82,8 +82,11 @@ namespace Tizen.NUI /// /// horizontal space requirements as imposed by the parent. /// vertical space requirements as imposed by the parent. - protected virtual void OnMeasure(LayoutMeasureSpec widthMeasureSpec, LayoutMeasureSpec heightMeasureSpec) + protected override void OnMeasure(LayoutMeasureSpec widthMeasureSpec, LayoutMeasureSpec heightMeasureSpec) { + //int width = widthMeasureSpec.Size; + //int height = heightMeasureSpec.Size; + LayoutLength childWidth = new LayoutLength( 0 ); LayoutLength childHeight = new LayoutLength( 0 ); @@ -93,6 +96,10 @@ namespace Tizen.NUI for( uint i = 0; i < ChildCount; ++i ) { var childLayout = GetChildAt( i ); + + //var view = GetOwner(); + //string ownerName = view.Name; + if( childLayout ) { MeasureChild( childLayout, widthMeasureSpec, heightMeasureSpec ); diff --git a/src/Tizen.NUI/src/internal/Layouting/LayoutItem.cs b/src/Tizen.NUI/src/internal/Layouting/LayoutItem.cs index 4d8f1aa..b8b1fbd 100755 --- a/src/Tizen.NUI/src/internal/Layouting/LayoutItem.cs +++ b/src/Tizen.NUI/src/internal/Layouting/LayoutItem.cs @@ -26,8 +26,12 @@ namespace Tizen.NUI /// internal class LayoutItem : LayoutItemWrapper { + //It is called by LayoutGroupWrapper constructor. internal LayoutItem(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn) { + System.IntPtr wrapperImpe_CPtr = LayoutPINVOKE.LayoutItemWrapper_GetImplementation(cPtr); + layoutItemWrapperImpl = new LayoutItemWrapperImpl(wrapperImpe_CPtr, true); + LayoutItemInitialize(layoutItemWrapperImpl); } public LayoutItem() : base(new LayoutItemWrapperImpl()) @@ -221,7 +225,7 @@ namespace Tizen.NUI /// /// Returns the suggested minimum width that the layout should use.
- /// This returns the maximum of the layout's minimum width and the background's minimum width.
+ /// This returns the maximum of the layout's minimum width and the owner's natural width.
///
public LayoutLength SuggestedMinimumWidth { @@ -233,7 +237,7 @@ namespace Tizen.NUI /// /// Returns the suggested minimum width that the layout should use.
- /// This returns the maximum of the layout's minimum width and the background's minimum width.
+ /// This returns the maximum of the layout's minimum width and the owner's natural width.
///
/// The suggested minimum width of the layout. private LayoutLength GetSuggestedMinimumWidth() @@ -243,7 +247,7 @@ namespace Tizen.NUI /// /// Returns the suggested minimum height that the layout should use.
- /// This returns the maximum of the layout's minimum height and the background's minimum height.
+ /// This returns the maximum of the layout's minimum height and the owner's natural height.
///
public LayoutLength SuggestedMinimumHeight { @@ -255,7 +259,7 @@ namespace Tizen.NUI /// /// Returns the suggested minimum height that the layout should use.
- /// This returns the maximum of the layout's minimum height and the background's minimum height.
+ /// This returns the maximum of the layout's minimum height and the owner's natural height.
///
/// The suggested minimum height of the layout. private LayoutLength GetSuggestedMinimumHeight() @@ -267,6 +271,9 @@ namespace Tizen.NUI /// Sets the minimum width of the layout.
/// It is not guaranteed the layout will be able to achieve this minimum width (for example, if its parent /// layout constrains it with less available width).
+ /// 1. if the owner's View.LayoutWidthSpecification has exact value, then that value overrides the minimum size.
+ /// 2. If the owner's View.LayoutWidthSpecification is set to View.ChildLayoutData.WrapContent, then the view's width is set based on the suggested minimum width. (@see GetSuggestedMinimumWidth()).
+ /// 3. If the owner's View.LayoutWidthSpecification is set to View.ChildLayoutData.MatchParent, then the parent width takes precedence over the minimum width.
/// public LayoutLength MinimumWidth { @@ -295,6 +302,9 @@ namespace Tizen.NUI /// Sets the minimum height of the layout.
/// It is not guaranteed the layout will be able to achieve this minimum height (for example, if its parent /// layout constrains it with less available height).
+ /// 1. if the owner's View.LayoutHeightSpecification has exact value, then that value overrides the minimum size.
+ /// 2. If the owner's View.LayoutHeightSpecification is set to View.ChildLayoutData.WrapContent, then the view's height is set based on the suggested minimum height. (@see GetSuggestedMinimumHeight()).
+ /// 3. If the owner's View.LayoutHeightSpecification is set to View.ChildLayoutData.MatchParent, then the parent height takes precedence over the minimum height.
/// public LayoutLength MinimumHeight { @@ -375,4 +385,4 @@ namespace Tizen.NUI { } } -} \ No newline at end of file +} diff --git a/src/Tizen.NUI/src/internal/Layouting/LayoutLength.cs b/src/Tizen.NUI/src/internal/Layouting/LayoutLength.cs index 0712ac1..422aa43 100755 --- a/src/Tizen.NUI/src/internal/Layouting/LayoutLength.cs +++ b/src/Tizen.NUI/src/internal/Layouting/LayoutLength.cs @@ -295,13 +295,6 @@ namespace Tizen.NUI return ret; } - public float ConvertToFloat() - { - float ret = LayoutPINVOKE.LayoutLength_ConvertToFloat(swigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; - } - public int Value { set diff --git a/src/Tizen.NUI/src/internal/Layouting/LayoutPINVOKE.cs b/src/Tizen.NUI/src/internal/Layouting/LayoutPINVOKE.cs index 3e21246..ca2682c 100755 --- a/src/Tizen.NUI/src/internal/Layouting/LayoutPINVOKE.cs +++ b/src/Tizen.NUI/src/internal/Layouting/LayoutPINVOKE.cs @@ -416,24 +416,6 @@ namespace Tizen.NUI } } - [global::System.Runtime.InteropServices.DllImport(Graphics.GlesCSharpBinder, EntryPoint = "CSharp_Dali_LayoutLength_ConvertToFloat")] - public static extern float LayoutLength_ConvertToFloat_gl(global::System.Runtime.InteropServices.HandleRef jarg1); - - [global::System.Runtime.InteropServices.DllImport(Graphics.VulkanCSharpBinder, EntryPoint = "CSharp_Dali_LayoutLength_ConvertToFloat")] - public static extern float LayoutLength_ConvertToFloat_vulkan(global::System.Runtime.InteropServices.HandleRef jarg1); - - public static float LayoutLength_ConvertToFloat(global::System.Runtime.InteropServices.HandleRef jarg1) - { - if (Tizen.NUI.Graphics.Backend == Tizen.NUI.Graphics.BackendType.Vulkan) - { - return LayoutLength_ConvertToFloat_vulkan(jarg1); - } - else - { - return LayoutLength_ConvertToFloat_gl(jarg1); - } - } - [global::System.Runtime.InteropServices.DllImport(Graphics.GlesCSharpBinder, EntryPoint = "CSharp_Dali_LayoutLength_mValue_set")] public static extern void LayoutLength_mValue_set_gl(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); @@ -1586,6 +1568,24 @@ namespace Tizen.NUI } } + [global::System.Runtime.InteropServices.DllImport(Graphics.GlesCSharpBinder, EntryPoint = "CSharp_Dali_LayoutItemWrapper_GetImplementation")] + public static extern global::System.IntPtr LayoutItemWrapper_GetImplementation_gl(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport(Graphics.VulkanCSharpBinder, EntryPoint = "CSharp_Dali_LayoutItemWrapper_GetImplementation")] + public static extern global::System.IntPtr LayoutItemWrapper_GetImplementation_vulkan(global::System.IntPtr jarg1); + + public static global::System.IntPtr LayoutItemWrapper_GetImplementation(global::System.IntPtr jarg1) + { + if (Tizen.NUI.Graphics.Backend == Tizen.NUI.Graphics.BackendType.Vulkan) + { + return LayoutItemWrapper_GetImplementation_vulkan(jarg1); + } + else + { + return LayoutItemWrapper_GetImplementation_gl(jarg1); + } + } + [global::System.Runtime.InteropServices.DllImport(Graphics.GlesCSharpBinder, EntryPoint = "CSharp_Dali_LayoutItemWrapperImpl_GetOwner")] public static extern global::System.IntPtr LayoutItemWrapperImpl_GetOwner_gl(global::System.Runtime.InteropServices.HandleRef jarg1); diff --git a/src/Tizen.NUI/src/internal/VersionCheck.cs b/src/Tizen.NUI/src/internal/VersionCheck.cs index c9df821..b5ecebc 100755 --- a/src/Tizen.NUI/src/internal/VersionCheck.cs +++ b/src/Tizen.NUI/src/internal/VersionCheck.cs @@ -27,7 +27,8 @@ namespace Tizen.NUI //from dali_1.3.28 : NUI internal API version 502 //from dali_1.3.34 : NUI internal API version 503 //from dali_1.3.41 : NUI internal API version 504 - public const int nuiAPIVer = 504; + //from dali_1.3.43 : NUI internal API version 505 + public const int nuiAPIVer = 505; public const int reservedVer1 = 0; public const int reservedVer2 = 0; @@ -41,7 +42,8 @@ namespace Tizen.NUI { if (NDalicManualPINVOKE.InternalAPIVersionCheck(ref ver1, ref ver2, ref ver3) == true) { - if (ver1 != nuiAPIVer) + //temporary permit 504 version. the 504 will be removed. + if (ver1 != nuiAPIVer && ver1 != 504) { NUILog.Error($"NUI API version mismatch error! NUI API Version: ({nuiAPIVer}) but read version from native: ({ver1}.{ver2}.{ver3})"); throw new System.InvalidOperationException($"NUI API version mismatch error! NUI API version should be ({nuiAPIVer}) but read version from native: ({ver1}.{ver2}.{ver3})"); diff --git a/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs b/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs index f799f74..d90c82b 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs @@ -922,6 +922,7 @@ namespace Tizen.NUI.BaseComponents private string textEditorTextSid = null; private string textEditorPlaceHolderTextSid = null; private bool systemlangTextFlag = false; + private InputMethodContext inputMethodContext = null; internal TextEditor(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.TextEditor_SWIGUpcast(cPtr), cMemoryOwn) { @@ -1249,10 +1250,15 @@ namespace Tizen.NUI.BaseComponents /// Get the InputMethodContext instance. /// /// The InputMethodContext instance. - public InputMethodContext GetInputMethodContext() { - InputMethodContext ret = new InputMethodContext(NDalicPINVOKE.TextEditor_GetInputMethodContext(swigCPtr), true); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; + public InputMethodContext GetInputMethodContext() + { + if (inputMethodContext == null) + { + /*Avoid raising InputMethodContext reference count.*/ + inputMethodContext = new InputMethodContext(NDalicPINVOKE.TextEditor_GetInputMethodContext(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + return inputMethodContext; } internal TextEditorSignal TextChangedSignal() diff --git a/src/Tizen.NUI/src/public/BaseComponents/TextField.cs b/src/Tizen.NUI/src/public/BaseComponents/TextField.cs index 8b8eddf..cff7bb4 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/TextField.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/TextField.cs @@ -974,6 +974,7 @@ namespace Tizen.NUI.BaseComponents private string textFieldTextSid = null; private string textFieldPlaceHolderTextSid = null; private bool systemlangTextFlag = false; + private InputMethodContext inputMethodCotext = null; internal TextField(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.TextField_SWIGUpcast(cPtr), cMemoryOwn) { @@ -1288,10 +1289,15 @@ namespace Tizen.NUI.BaseComponents /// Get the InputMethodContext instance. /// /// The InputMethodContext instance. - public InputMethodContext GetInputMethodContext() { - InputMethodContext ret = new InputMethodContext(NDalicPINVOKE.TextField_GetInputMethodContext(swigCPtr), true); - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; + public InputMethodContext GetInputMethodContext() + { + if (inputMethodCotext == null) + { + /*Avoid raising InputMethodContext reference count.*/ + inputMethodCotext = new InputMethodContext(NDalicPINVOKE.TextField_GetInputMethodContext(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + return inputMethodCotext; } internal TextFieldSignal TextChangedSignal() diff --git a/src/Tizen.NUI/src/public/NUIConstants.cs b/src/Tizen.NUI/src/public/NUIConstants.cs index 1859e07..d7d042c 100755 --- a/src/Tizen.NUI/src/public/NUIConstants.cs +++ b/src/Tizen.NUI/src/public/NUIConstants.cs @@ -809,7 +809,7 @@ namespace Tizen.NUI } /// - /// The values of this enum determines how the visual should fit into the view. + /// The values of this enum determine how the visual should fit into the view. /// /// 5 public enum VisualFittingModeType -- 2.7.4