Revert "[NUI] Change for Size2D property to own internalSize2D which is cashed to...
authordongsug.song <dongsug.song@samsung.com>
Mon, 22 Nov 2021 06:57:59 +0000 (15:57 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Mon, 22 Nov 2021 07:07:17 +0000 (16:07 +0900)
This reverts commit 1d7d93845e15839fdf18ef36fb7a795392f64e5c.

src/Tizen.NUI/Tizen.NUI.csproj
src/Tizen.NUI/Tizen.NUI.sln
src/Tizen.NUI/src/public/BaseComponents/View.cs
src/Tizen.NUI/src/public/BaseComponents/ViewBindableProperty.cs
src/Tizen.NUI/src/public/BaseComponents/ViewEvent.cs
src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs
src/Tizen.NUI/src/public/Common/PropertyValue.cs
src/Tizen.NUI/src/public/Common/Size2D.cs

index 7ff82e1..55bd751 100755 (executable)
     </None>
   </ItemGroup>
 
-
-  <!--Target Name="PostBuild" AfterTargets="PostBuildEvent">
-    <Exec Command="sdb root on&#xA;&#xD;&#xA;sdb shell &quot;mount -o remount,rw /&quot;&#xA;&#xD;&#xA;sdb shell &quot;rm /usr/share/dotnet.tizen/framework/*.ni.dll&quot;&#xA;&#xD;&#xA;sdb push $(TargetDir)Tizen.NUI.dll /usr/share/dotnet.tizen/framework/&#xA;&#xD;&#xA;sdb shell &quot;chsmack -a '_' /usr/share/dotnet.tizen/framework/Tizen.NUI.dll&quot;&#xA;&#xD;&#xA;sdb shell sync&#xA;" />
-  </Target-->
-
-
-
 </Project>
index e094980..382d9c5 100755 (executable)
@@ -17,8 +17,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.Componen
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.System.Information", "..\Tizen.System.Information\Tizen.System.Information.csproj", "{AD4B56C0-01B2-4ED0-9DBD-6CF233D16FF4}"
 EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.ThemeManager", "..\Tizen.Applications.ThemeManager\Tizen.Applications.ThemeManager.csproj", "{F57F6911-C581-49CA-80A5-9B5DDDAE3D40}"
-EndProject
 Global
        GlobalSection(SolutionConfigurationPlatforms) = preSolution
                Debug|Any CPU = Debug|Any CPU
@@ -53,10 +51,6 @@ Global
                {AD4B56C0-01B2-4ED0-9DBD-6CF233D16FF4}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {AD4B56C0-01B2-4ED0-9DBD-6CF233D16FF4}.Release|Any CPU.ActiveCfg = Release|Any CPU
                {AD4B56C0-01B2-4ED0-9DBD-6CF233D16FF4}.Release|Any CPU.Build.0 = Release|Any CPU
-               {F57F6911-C581-49CA-80A5-9B5DDDAE3D40}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-               {F57F6911-C581-49CA-80A5-9B5DDDAE3D40}.Debug|Any CPU.Build.0 = Debug|Any CPU
-               {F57F6911-C581-49CA-80A5-9B5DDDAE3D40}.Release|Any CPU.ActiveCfg = Release|Any CPU
-               {F57F6911-C581-49CA-80A5-9B5DDDAE3D40}.Release|Any CPU.Build.0 = Release|Any CPU
        EndGlobalSection
        GlobalSection(SolutionProperties) = preSolution
                HideSolutionNode = FALSE
index 67091da..f00d363 100755 (executable)
@@ -51,9 +51,6 @@ namespace Tizen.NUI.BaseComponents
         // List of constraints
         private Constraint widthConstraint = null;
         private Constraint heightConstraint = null;
-
-        private Size2D internalSize2D = null;
-
         static View()
         {
             RegisterPropertyGroup(PositionProperty, positionPropertyGroup);
@@ -992,15 +989,17 @@ namespace Tizen.NUI.BaseComponents
         {
             get
             {
-                var temp = (Size2D)GetValue(Size2DProperty);
+                Size2D temp = (Size2D)GetValue(Size2DProperty);
+                int width = temp.Width;
+                int height = temp.Height;
 
                 if (this.Layout == null)
                 {
-                    if (temp.Width < 0) { temp.Width = 0; }
-                    if (temp.Height < 0) { temp.Height = 0; }
+                    if (width < 0) { width = 0; }
+                    if (height < 0) { height = 0; }
                 }
 
-                return temp;
+                return new Size2D(OnSize2DChanged, width, height);
             }
             set
             {
index 38be66e..755a331 100755 (executable)
@@ -607,43 +607,26 @@ namespace Tizen.NUI.BaseComponents
         /// Size2DProperty
         /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
-        public static readonly BindableProperty Size2DProperty = BindableProperty.Create(nameof(Size2D), typeof(Size2D), typeof(View), null,
-            propertyChanged: ((bindable, oldValue, newValue) =>
-            {
-                View view = (View)bindable;
-                if (newValue != null)
-                {
-                    view.SetSize(((Size2D)newValue).Width, ((Size2D)newValue).Height, 0);
-
-                    view.widthPolicy = ((Size2D)newValue).Width;
-                    view.heightPolicy = ((Size2D)newValue).Height;
-
-                    view.layout?.RequestLayout();
-                }
-            }),
-            defaultValueCreator: ((bindable) =>
+        public static readonly BindableProperty Size2DProperty = BindableProperty.Create(nameof(Size2D), typeof(Size2D), typeof(View), null, propertyChanged: (BindableProperty.BindingPropertyChangedDelegate)((bindable, oldValue, newValue) =>
+        {
+            var view = (View)bindable;
+            if (newValue != null)
             {
-                View view = (View)bindable;
-                var tmp = new Size(0, 0, 0);
-                Object.GetProperty(view.SwigCPtr, Property.SIZE).Get(tmp);
-
-                int tmpWidth = (int)tmp?.Width;
-                int tmpHeight = (int)tmp?.Height;
-                tmp?.Dispose();
-                tmp = null;
+                Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.SIZE, new Tizen.NUI.PropertyValue(new Size((Size2D)newValue)));
+                view.widthPolicy = ((Size2D)newValue).Width;
+                view.heightPolicy = ((Size2D)newValue).Height;
 
-                if (view.internalSize2D == null)
-                {
-                    view.internalSize2D = new Size2D(view.OnSize2DChanged, tmpWidth, tmpHeight);
-                }
-                else
-                {
-                    if (view.internalSize2D.Width != tmpWidth) { view.internalSize2D.Width = tmpWidth; }
-                    if (view.internalSize2D.Height != tmpHeight) { view.internalSize2D.Height = tmpHeight; }
-                }
-                return view.internalSize2D;
-            })
-        );
+                view.layout?.RequestLayout();
+            }
+        }),
+        defaultValueCreator: (BindableProperty.CreateDefaultValueDelegate)((bindable) =>
+        {
+            var view = (View)bindable;
+            Size temp = new Size(0.0f, 0.0f, 0.0f);
+            Tizen.NUI.Object.GetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.SIZE).Get(temp);
+            Size2D size = new Size2D((int)temp.Width, (int)temp.Height);
+            return size;
+        }));
 
         /// <summary>
         /// OpacityProperty
@@ -1177,9 +1160,9 @@ namespace Tizen.NUI.BaseComponents
             var view = (View)bindable;
             if (newValue != null)
             {
-                if ((ResizePolicyType)newValue == ResizePolicyType.KeepSizeFollowingParent)
+                if((ResizePolicyType)newValue == ResizePolicyType.KeepSizeFollowingParent)
                 {
-                    if (view.widthConstraint == null)
+                    if(view.widthConstraint == null)
                     {
                         view.widthConstraint = new EqualConstraintWithParentFloat((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.SizeWidth, View.Property.SizeWidth);
                         view.widthConstraint.Apply();
@@ -1237,9 +1220,9 @@ namespace Tizen.NUI.BaseComponents
             var view = (View)bindable;
             if (newValue != null)
             {
-                if ((ResizePolicyType)newValue == ResizePolicyType.KeepSizeFollowingParent)
+                if((ResizePolicyType)newValue == ResizePolicyType.KeepSizeFollowingParent)
                 {
-                    if (view.heightConstraint == null)
+                    if(view.heightConstraint == null)
                     {
                         view.heightConstraint = new EqualConstraintWithParentFloat((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.SizeHeight, View.Property.SizeHeight);
                         view.heightConstraint.Apply();
index 37371cb..7d95722 100755 (executable)
@@ -722,18 +722,19 @@ namespace Tizen.NUI.BaseComponents
 
         private void OnSize2DChanged(int? width, int? height)
         {
-            PropertyValue temp = null;
+            PropertyValue temp;
             if (width != null)
             {
-                temp = new PropertyValue((float)width);
-                Object.SetProperty(SwigCPtr, Property.SizeWidth, temp);
+                temp = new Tizen.NUI.PropertyValue((float)width);
+                Tizen.NUI.Object.SetProperty(this.SwigCPtr, View.Property.SizeWidth, temp);
+                temp.Dispose();
             }
             if (height != null)
             {
-                temp = new PropertyValue((float)height);
-                Object.SetProperty(SwigCPtr, Property.SizeHeight, temp);
+                temp = new Tizen.NUI.PropertyValue((float)height);
+                Tizen.NUI.Object.SetProperty(this.SwigCPtr, View.Property.SizeHeight, temp);
+                temp.Dispose();
             }
-            temp?.Dispose();
         }
 
         private void OnMinimumSizeChanged(int? width, int? height)
index ff4cf4d..6a90172 100755 (executable)
@@ -1136,8 +1136,6 @@ namespace Tizen.NUI.BaseComponents
             }
 
             //_mergedStyle = null;
-            
-            internalSize2D?.Dispose();
 
             if (type == DisposeTypes.Explicit)
             {
index 1de77d9..78499e3 100755 (executable)
@@ -15,7 +15,6 @@
  *
  */
 
-using System;
 using System.ComponentModel;
 
 namespace Tizen.NUI
@@ -244,43 +243,6 @@ namespace Tizen.NUI
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
 
-
-        /// <summary>
-        /// Hidden API (Inhouse API).
-        /// Dispose. 
-        /// </summary>
-        /// <remarks>
-        /// Following the guide of https://docs.microsoft.com/en-us/dotnet/standard/garbage-collection/implementing-dispose.
-        /// This will replace "protected virtual void Dispose(DisposeTypes type)" which is exactly same in functionality.
-        /// </remarks>
-        /// <param name="disposing">true in order to free managed objects</param>
-        // Protected implementation of Dispose pattern.
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        protected override void Dispose(bool disposing)
-        {
-            if (disposed)
-            {
-                return;
-            }
-
-            //perform dipose here without being added to DisposeQueue.
-            if (SwigCMemOwn && SwigCPtr.Handle != IntPtr.Zero)
-            {
-                if (disposing)
-                {
-                    base.Dispose(DisposeTypes.Explicit);
-                }
-                else
-                {
-                    base.Dispose(DisposeTypes.Implicit);
-                }
-            }
-
-            base.Dispose(disposing);
-        }
-
-
-
         /// <summary>
         /// An extension to the property value class that allows us to create a
         /// Property value from a C# object, for example, integer, float, or string.<br />
index d50854f..782e112 100755 (executable)
@@ -69,42 +69,6 @@ namespace Tizen.NUI
         internal delegate void Size2DChangedCallback(int? width, int? height);
 
         /// <summary>
-        /// Hidden API (Inhouse API).
-        /// Dispose. 
-        /// </summary>
-        /// <remarks>
-        /// Following the guide of https://docs.microsoft.com/en-us/dotnet/standard/garbage-collection/implementing-dispose.
-        /// This will replace "protected virtual void Dispose(DisposeTypes type)" which is exactly same in functionality.
-        /// </remarks>
-        /// <param name="disposing">true in order to free managed objects</param>
-        // Protected implementation of Dispose pattern.
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        protected override void Dispose(bool disposing)
-        {
-            if (disposed)
-            {
-                return;
-            }
-
-            callback = null;
-
-            //perform dipose here without being added to DisposeQueue.
-            if (SwigCMemOwn && SwigCPtr.Handle != IntPtr.Zero)
-            {
-                if (disposing)
-                {
-                    base.Dispose(DisposeTypes.Explicit);
-                }
-                else
-                {
-                    base.Dispose(DisposeTypes.Implicit);
-                }
-            }
-
-            base.Dispose(disposing);
-        }
-
-        /// <summary>
         /// The property for the width component of a size.
         /// </summary>
         /// <remarks>