From 0ea2beddc97635e44ef960a611f4c98e12703d9c Mon Sep 17 00:00:00 2001 From: "dongsug.song" Date: Thu, 13 Oct 2022 16:39:27 +0900 Subject: [PATCH] [NUI] Change property get/set not to use PropertyValue (patch set4) --- src/Tizen.NUI/Tizen.NUI.csproj | 2 +- .../src/internal/Interop/Interop.ActorInternal.cs | 19 + src/Tizen.NUI/src/public/BaseComponents/View.cs | 59 +++ .../src/public/BaseComponents/ViewInternal.cs | 450 +++++++++++++++++++++ src/Tizen.NUI/src/public/Window/Window.cs | 30 +- 5 files changed, 556 insertions(+), 4 deletions(-) diff --git a/src/Tizen.NUI/Tizen.NUI.csproj b/src/Tizen.NUI/Tizen.NUI.csproj index 748311a..35761fe 100755 --- a/src/Tizen.NUI/Tizen.NUI.csproj +++ b/src/Tizen.NUI/Tizen.NUI.csproj @@ -5,7 +5,7 @@ 8.0 - NUI_DEBUG_OFF;NUI_PROPERTY_CHANGE_1;NUI_PROPERTY_CHANGE_2; + NUI_DEBUG_OFF;NUI_PROPERTY_CHANGE_1;NUI_PROPERTY_CHANGE_2;NUI_PROPERTY_CHANGE_3; internal virtual Vector3 GetNaturalSize() { +#if NUI_PROPERTY_CHANGE_DEBUG +GetNaturalSizeCnt++; +#endif + Vector3 ret = new Vector3(Interop.Actor.GetNaturalSize(SwigCPtr), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); @@ -644,18 +916,55 @@ namespace Tizen.NUI.BaseComponents internal Position GetCurrentPosition() { +#if NUI_PROPERTY_CHANGE_DEBUG +GetCurrentPositionCnt++; +#endif +#if NUI_PROPERTY_CHANGE_3 + if(internalCurrentPosition == null) + { + internalCurrentPosition = new Position(0, 0, 0); + } + + Interop.ActorInternal.RetrieveCurrentPropertyVector3(SwigCPtr, Property.POSITION, internalCurrentPosition.SwigCPtr); + + if (NDalicPINVOKE.SWIGPendingException.Pending) + { + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + return internalCurrentPosition; +#else + Position ret = new Position(Interop.Actor.GetCurrentPosition(SwigCPtr), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; +#endif } internal Vector3 GetCurrentWorldPosition() { +#if NUI_PROPERTY_CHANGE_DEBUG +GetCurrentWorldPositionCnt++; +#endif +#if NUI_PROPERTY_CHANGE_3 + if(internalCurrentWorldPosition == null) + { + internalCurrentWorldPosition = new Vector3(0, 0, 0); + } + + Interop.ActorInternal.RetrieveCurrentPropertyVector3(SwigCPtr, View.Property.WorldPosition, internalCurrentWorldPosition.SwigCPtr); + + if (NDalicPINVOKE.SWIGPendingException.Pending) + { + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + return internalCurrentWorldPosition; +#else Vector3 ret = new Vector3(Interop.ActorInternal.GetCurrentWorldPosition(SwigCPtr), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; +#endif } internal void SetInheritPosition(bool inherit) @@ -748,18 +1057,56 @@ namespace Tizen.NUI.BaseComponents internal Vector3 GetCurrentScale() { +#if NUI_PROPERTY_CHANGE_DEBUG +GetCurrentScaleCnt++; +#endif +#if NUI_PROPERTY_CHANGE_3 + if(internalCurrentScale == null) + { + internalCurrentScale = new Vector3(0, 0, 0); + } + + Interop.ActorInternal.RetrieveCurrentPropertyVector3(SwigCPtr, View.Property.SCALE, internalCurrentScale.SwigCPtr); + + if (NDalicPINVOKE.SWIGPendingException.Pending) + { + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + return internalCurrentScale; +#else + Vector3 ret = new Vector3(Interop.ActorInternal.GetCurrentScale(SwigCPtr), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; +#endif } internal Vector3 GetCurrentWorldScale() { +#if NUI_PROPERTY_CHANGE_DEBUG +GetCurrentWorldScaleCnt++; +#endif +#if NUI_PROPERTY_CHANGE_3 + if(internalCurrentWorldScale == null) + { + internalCurrentWorldScale = new Vector3(0, 0, 0); + } + + Interop.ActorInternal.RetrieveCurrentPropertyVector3(SwigCPtr, View.Property.WorldScale, internalCurrentWorldScale.SwigCPtr); + + if (NDalicPINVOKE.SWIGPendingException.Pending) + { + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + return internalCurrentWorldScale; +#else + Vector3 ret = new Vector3(Interop.ActorInternal.GetCurrentWorldScale(SwigCPtr), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; +#endif } internal void SetInheritScale(bool inherit) @@ -824,10 +1171,29 @@ namespace Tizen.NUI.BaseComponents internal Vector4 GetCurrentColor() { +#if NUI_PROPERTY_CHANGE_DEBUG +GetCurrentColorCnt++; +#endif +#if NUI_PROPERTY_CHANGE_3 + if(internalCurrentColor == null) + { + internalCurrentColor = new Vector4(0, 0, 0, 0); + } + + Interop.ActorInternal.RetrieveCurrentPropertyVector4(SwigCPtr, Interop.ActorProperty.ColorGet(), internalCurrentColor.SwigCPtr); + + if (NDalicPINVOKE.SWIGPendingException.Pending) + { + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + return internalCurrentColor; +#else + Vector4 ret = new Vector4(Interop.ActorInternal.GetCurrentColor(SwigCPtr), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; +#endif } internal ColorMode GetColorMode() { @@ -839,10 +1205,29 @@ namespace Tizen.NUI.BaseComponents internal Vector4 GetCurrentWorldColor() { +#if NUI_PROPERTY_CHANGE_DEBUG +GetCurrentWorldColorCnt++; +#endif +#if NUI_PROPERTY_CHANGE_3 + if(internalCurrentWorldColor == null) + { + internalCurrentWorldColor = new Vector4(0, 0, 0, 0); + } + + Interop.ActorInternal.RetrieveCurrentPropertyVector4(SwigCPtr, Property.WorldColor, internalCurrentWorldColor.SwigCPtr); + + if (NDalicPINVOKE.SWIGPendingException.Pending) + { + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + return internalCurrentWorldColor; +#else + Vector4 ret = new Vector4(Interop.ActorInternal.GetCurrentWorldColor(SwigCPtr), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; +#endif } internal void SetDrawMode(DrawModeType drawMode) @@ -922,10 +1307,23 @@ namespace Tizen.NUI.BaseComponents internal Vector3 GetSizeModeFactor() { +#if NUI_PROPERTY_CHANGE_DEBUG +GetSizeModeFactorCnt++; +#endif +#if NUI_PROPERTY_CHANGE_1 + if (internalSizeModeFactor == null) + { + internalSizeModeFactor = new Vector3(OnSizeModeFactorChanged, 0, 0, 0); + } + Interop.Actor.InternalRetrievingPropertyVector3(SwigCPtr, View.Property.SizeModeFactor, internalSizeModeFactor.SwigCPtr); + return internalSizeModeFactor; +#else + Vector3 ret = new Vector3(Interop.Actor.GetSizeModeFactor(SwigCPtr), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; +#endif } internal void SetMinimumSize(Vector2 size) @@ -937,10 +1335,22 @@ namespace Tizen.NUI.BaseComponents internal Vector2 GetMinimumSize() { +#if NUI_PROPERTY_CHANGE_DEBUG +GetMinimumSizeCnt++; +#endif +#if NUI_PROPERTY_CHANGE_1 + if (internalMinimumSize == null) + { + internalMinimumSize = new Size2D(OnMinimumSizeChanged, 0, 0); + } + Interop.Actor.InternalRetrievingPropertyVector2(SwigCPtr, View.Property.MinimumSize, internalMinimumSize.SwigCPtr); + return internalMinimumSize; +#else Vector2 ret = new Vector2(Interop.ActorInternal.GetMinimumSize(SwigCPtr), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; +#endif } internal void SetMaximumSize(Vector2 size) @@ -952,10 +1362,23 @@ namespace Tizen.NUI.BaseComponents internal Vector2 GetMaximumSize() { +#if NUI_PROPERTY_CHANGE_DEBUG +GetMaximumSizeCnt++; +#endif +#if NUI_PROPERTY_CHANGE_1 + if (internalMaximumSize == null) + { + internalMaximumSize = new Size2D(OnMaximumSizeChanged, 0, 0); + } + Interop.Actor.InternalRetrievingPropertyVector2(SwigCPtr, View.Property.MaximumSize, internalMaximumSize.SwigCPtr); + return internalMaximumSize; +#else + Vector2 ret = new Vector2(Interop.ActorInternal.GetMaximumSize(SwigCPtr), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; +#endif } internal int GetHierarchyDepth() @@ -1226,6 +1649,33 @@ namespace Tizen.NUI.BaseComponents rotationGestureDetector?.Dispose(); rotationGestureDetector = null; +#if NUI_PROPERTY_CHANGE_3 + internalCurrentParentOrigin?.Dispose(); + internalCurrentParentOrigin = null; + internalCurrentAnchorPoint?.Dispose(); + internalCurrentAnchorPoint = null; + internalTargetSize?.Dispose(); + internalTargetSize = null; + internalCurrentSize?.Dispose(); + internalCurrentSize = null; + internalNaturalSize?.Dispose(); + internalNaturalSize = null; + internalCurrentPosition?.Dispose(); + internalCurrentPosition = null; + internalCurrentWorldPosition?.Dispose(); + internalCurrentWorldPosition = null; + internalCurrentScale?.Dispose(); + internalCurrentScale = null; + internalCurrentWorldScale?.Dispose(); + internalCurrentWorldScale = null; + internalCurrentColor?.Dispose(); + internalCurrentColor = null; + internalCurrentWorldColor?.Dispose(); + internalCurrentWorldColor = null; + internalSizeModeFactor?.Dispose(); + internalSizeModeFactor = null; +#endif + if (type == DisposeTypes.Explicit) { //Called by User diff --git a/src/Tizen.NUI/src/public/Window/Window.cs b/src/Tizen.NUI/src/public/Window/Window.cs index ff5b257..c349fcb 100755 --- a/src/Tizen.NUI/src/public/Window/Window.cs +++ b/src/Tizen.NUI/src/public/Window/Window.cs @@ -165,7 +165,31 @@ private void TestWindowKeyEventHandler(object o, Window.KeyEventArgs e) Tizen.Log.Fatal("NUITEST", $"TextGetter: {TextLabel.TextGetter}, TextSetter: {TextLabel.TextSetter}"); Tizen.Log.Fatal("NUITEST", $"FontFamilyGetter: {TextLabel.FontFamilyGetter}, FontFamilySetter: {TextLabel.FontFamilySetter}"); Tizen.Log.Fatal("NUITEST", $"PointSizeGetter: {TextLabel.PointSizeGetter}"); - +#if NUI_PROPERTY_CHANGE_3 + Tizen.Log.Fatal("NUITEST", $"View internal properties =>"); + Tizen.Log.Fatal("NUITEST", $"WorldPositionXGetter: {View.WorldPositionXGetter}, WorldPositionYGetter: {View.WorldPositionYGetter}, WorldPositionZGetter: {View.WorldPositionZGetter}"); + Tizen.Log.Fatal("NUITEST", $"ParentOriginXGetter: {View.ParentOriginXGetter} ParentOriginXSetter: {View.ParentOriginXSetter}"); + Tizen.Log.Fatal("NUITEST", $"ParentOriginYGetter: {View.ParentOriginYGetter} ParentOriginYSetter: {View.ParentOriginYSetter}"); + Tizen.Log.Fatal("NUITEST", $"ParentOriginZGetter: {View.ParentOriginZGetter} ParentOriginZSetter: {View.ParentOriginZSetter}"); + Tizen.Log.Fatal("NUITEST", $"PivotPointXGetter: {View.PivotPointXGetter} PivotPointXSetter: {View.PivotPointXSetter}"); + Tizen.Log.Fatal("NUITEST", $"PivotPointYGetter: {View.PivotPointYGetter} PivotPointXSetter: {View.PivotPointYSetter}"); + Tizen.Log.Fatal("NUITEST", $"PivotPointZGetter: {View.PivotPointZGetter} PivotPointXSetter: {View.PivotPointZSetter}"); + Tizen.Log.Fatal("NUITEST", $"LeftFocusableViewIdGetter: {View.LeftFocusableViewIdGetter} LeftFocusableViewIdSetter: {View.LeftFocusableViewIdSetter}"); + Tizen.Log.Fatal("NUITEST", $"RightFocusableViewIdGetter: {View.RightFocusableViewIdGetter} RightFocusableViewIdSetter: {View.RightFocusableViewIdSetter}"); + Tizen.Log.Fatal("NUITEST", $"UpFocusableViewIdGetter: {View.UpFocusableViewIdGetter} UpFocusableViewIdSetter: {View.UpFocusableViewIdSetter}"); + Tizen.Log.Fatal("NUITEST", $"DownFocusableViewIdGetter: {View.DownFocusableViewIdGetter} DownFocusableViewIdSetter: {View.DownFocusableViewIdSetter}"); + Tizen.Log.Fatal("NUITEST", $"ClockwiseFocusableViewIdGetter: {View.ClockwiseFocusableViewIdGetter} ClockwiseFocusableViewIdSetter: {View.ClockwiseFocusableViewIdSetter}"); + Tizen.Log.Fatal("NUITEST", $"CounterClockwiseFocusableViewIdGetter: {View.CounterClockwiseFocusableViewIdGetter} CounterClockwiseFocusableViewIdSetter: {View.CounterClockwiseFocusableViewIdSetter}"); + Tizen.Log.Fatal("NUITEST", $"View internal method =>"); + Tizen.Log.Fatal("NUITEST", $"GetCurrentParentOriginCnt: {View.GetCurrentParentOriginCnt} GetCurrentAnchorPointCnt: {View.GetCurrentAnchorPointCnt}"); + Tizen.Log.Fatal("NUITEST", $"GetTargetSizeCnt: {View.GetTargetSizeCnt} GetCurrentSizeCnt: {View.GetCurrentSizeCnt}"); + Tizen.Log.Fatal("NUITEST", $"GetCurrentSizeFloatCnt: {View.GetCurrentSizeFloatCnt} GetNaturalSizeCnt: {View.GetNaturalSizeCnt}"); + Tizen.Log.Fatal("NUITEST", $"GetCurrentPositionCnt: {View.GetCurrentPositionCnt} GetCurrentWorldPositionCnt: {View.GetCurrentWorldPositionCnt}"); + Tizen.Log.Fatal("NUITEST", $"GetCurrentScaleCnt: {View.GetCurrentScaleCnt} GetCurrentWorldScaleCnt: {View.GetCurrentWorldScaleCnt}"); + Tizen.Log.Fatal("NUITEST", $"GetCurrentColorCnt: {View.GetCurrentColorCnt} GetCurrentWorldColorCnt: {View.GetCurrentWorldColorCnt}"); + Tizen.Log.Fatal("NUITEST", $"GetSizeModeFactorCnt: {View.GetSizeModeFactorCnt} GetMinimumSizeCnt: {View.GetMinimumSizeCnt}"); + Tizen.Log.Fatal("NUITEST", $"GetMaximumSizeCnt: {View.GetMaximumSizeCnt}"); +#endif } } #endif @@ -186,7 +210,7 @@ private void TestWindowKeyEventHandler(object o, Window.KeyEventArgs e) //to fix memory leak issue, match the handle count with native side. Window ret = view.GetInstanceSafely(Interop.Window.Get(View.getCPtr(view))); - if (NDalicPINVOKE.SWIGPendingException.Pending)throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } @@ -1531,7 +1555,7 @@ private void TestWindowKeyEventHandler(object o, Window.KeyEventArgs e) { if (isBorderWindow) { - if(borderLayer == null) + if (borderLayer == null) { borderLayer = GetBorderWindowRootLayer(); LayersChildren?.Add(borderLayer); -- 2.7.4