Skip to content

Commit 9a56efd

Browse files
committed
Updated to 3.0.5 version.
1 parent 8c32453 commit 9a56efd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+844
-3123
lines changed

Src/Noesis/Core/Src/Core/Dispatcher.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,12 @@ internal void ProcessQueue()
188188

189189
lock (_operations)
190190
{
191+
if (_operations.Count == 0)
192+
{
193+
// queue already processed by a synchronous Invoke
194+
break;
195+
}
196+
191197
operation = _operations.Dequeue();
192198
}
193199

Src/Noesis/Core/Src/Core/Events.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ namespace Noesis
2020
public delegate void KeyEventHandler(object sender, KeyEventArgs args);
2121
public delegate void TextCompositionEventHandler(object sender, TextCompositionEventArgs args);
2222
public delegate void TouchEventHandler(object sender, TouchEventArgs args);
23+
public delegate void TappedEventHandler(object sender, TappedEventArgs args);
24+
public delegate void DoubleTappedEventHandler(object sender, DoubleTappedEventArgs args);
25+
public delegate void HoldingEventHandler(object sender, HoldingEventArgs args);
26+
public delegate void RightTappedEventHandler(object sender, RightTappedEventArgs args);
2327
public delegate void ManipulationStartingEventHandler(object sender, ManipulationStartingEventArgs args);
2428
public delegate void ManipulationStartedEventHandler(object sender, ManipulationStartedEventArgs args);
2529
public delegate void ManipulationDeltaEventHandler(object sender, ManipulationDeltaEventArgs args);
@@ -713,6 +717,10 @@ static EventManager()
713717
RegisterRoutedEvent(UIElement.TouchDownEvent, typeof(TouchEventHandler), TouchEventArgs.InvokeHandler);
714718
RegisterRoutedEvent(UIElement.PreviewTouchUpEvent, typeof(TouchEventHandler), TouchEventArgs.InvokeHandler);
715719
RegisterRoutedEvent(UIElement.TouchUpEvent, typeof(TouchEventHandler), TouchEventArgs.InvokeHandler);
720+
RegisterRoutedEvent(UIElement.TappedEvent, typeof(TappedEventHandler), TappedEventArgs.InvokeHandler);
721+
RegisterRoutedEvent(UIElement.DoubleTappedEvent, typeof(DoubleTappedEventHandler), DoubleTappedEventArgs.InvokeHandler);
722+
RegisterRoutedEvent(UIElement.HoldingEvent, typeof(HoldingEventHandler), HoldingEventArgs.InvokeHandler);
723+
RegisterRoutedEvent(UIElement.RightTappedEvent, typeof(RightTappedEventHandler), RightTappedEventArgs.InvokeHandler);
716724
RegisterRoutedEvent(UIElement.ManipulationStartingEvent, typeof(ManipulationStartingEventHandler), ManipulationStartingEventArgs.InvokeHandler);
717725
RegisterRoutedEvent(UIElement.ManipulationStartedEvent, typeof(ManipulationStartedEventHandler), ManipulationStartedEventArgs.InvokeHandler);
718726
RegisterRoutedEvent(UIElement.ManipulationDeltaEvent, typeof(ManipulationDeltaEventHandler), ManipulationDeltaEventArgs.InvokeHandler);

Src/Noesis/Core/Src/Core/Extend.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -722,6 +722,7 @@ public static void RegisterNativeTypes()
722722
AddNativeType(types[i++], new NativeTypeInfo(NativeTypeKind.Boxed, typeof(Boxed<System.TimeSpan>)));
723723
AddNativeType(types[i++], new NativeTypeInfo(NativeTypeKind.Boxed, typeof(Boxed<VirtualizationCacheLength>)));
724724

725+
AddNativeType(types[i++], new NativeTypeInfo(NativeTypeKind.Boxed, typeof(Boxed<Enum>)));
725726
AddNativeType(types[i++], new NativeTypeInfo(NativeTypeKind.Boxed, typeof(Boxed<AlignmentX>)));
726727
AddNativeType(types[i++], new NativeTypeInfo(NativeTypeKind.Boxed, typeof(Boxed<AlignmentY>)));
727728
AddNativeType(types[i++], new NativeTypeInfo(NativeTypeKind.Boxed, typeof(Boxed<AutoToolTipPlacement>)));

Src/Noesis/Core/Src/Core/ExtendBoxing.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,9 @@ public static IntPtr Box(object val)
114114
}
115115
else if (val.GetType().GetTypeInfo().IsEnum)
116116
{
117-
_boxFunctions.TryGetValue(typeof(int), out boxFunction);
118-
return RegisterPendingRelease(boxFunction((int)Convert.ToInt64(val)));
117+
IntPtr nativeType = EnsureNativeType(val.GetType());
118+
int enumValue = (int)Convert.ToInt64(val);
119+
return RegisterPendingRelease(NoesisGUI_.Box_CustomEnum(nativeType, enumValue));
119120
}
120121
else if (val is Type)
121122
{
@@ -231,6 +232,13 @@ public static object Unbox(IntPtr cPtr, bool ownMemory, NativeTypeInfo info)
231232
{
232233
value = unboxFunction(cPtr);
233234
}
235+
else if (info.Type == typeof(Boxed<Enum>))
236+
{
237+
int enumValue = 0;
238+
IntPtr enumType = NoesisGUI_.Unbox_CustomEnum(cPtr, ref enumValue);
239+
NativeTypeInfo enumTypeInfo = GetNativeTypeInfo(enumType);
240+
value = Enum.ToObject(enumTypeInfo.Type, enumValue);
241+
}
234242
else
235243
{
236244
Log.Error("Can't unbox native pointer");

Src/Noesis/Core/Src/Core/Memory.cs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
using System;
2+
using System.Runtime.InteropServices;
3+
4+
namespace Noesis
5+
{
6+
public class Memory
7+
{
8+
/// <summary>
9+
/// Gets current allocated native memory
10+
/// </summary>
11+
public static uint Current { get { return Noesis_GetAllocatedMemory(); } }
12+
13+
/// <summary>
14+
/// Gets accumulated allocated memory
15+
/// </summary>
16+
public static uint Accumulated { get { return Noesis_GetAllocatedMemoryAccum(); } }
17+
18+
/// <summary>
19+
/// Gets the total number of memory allocations
20+
/// </summary>
21+
public static uint Allocs { get { return Noesis_GetAllocationsCount(); } }
22+
23+
24+
[DllImport(Library.Name)]
25+
private static extern uint Noesis_GetAllocatedMemory();
26+
27+
[DllImport(Library.Name)]
28+
private static extern uint Noesis_GetAllocatedMemoryAccum();
29+
30+
[DllImport(Library.Name)]
31+
private static extern uint Noesis_GetAllocationsCount();
32+
}
33+
}
34+

Src/Noesis/Core/Src/Core/NoesisGUI.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ public static void DisableInspector()
4444
Noesis_DisableInspector();
4545
}
4646

47-
4847
/// <summary>
4948
/// Returns whether the remote Inspector is currently connected.
5049
/// </summary>
@@ -53,6 +52,15 @@ public static bool IsInspectorConnected
5352
get { return Noesis_IsInspectorConnected(); }
5453
}
5554

55+
/// <summary>
56+
/// Keeps alive the Inspector connection. Only needed if Inspector is connected before any
57+
/// view is created. Views call this function internally when updated
58+
/// </summary>
59+
public static void UpdateInspector()
60+
{
61+
Noesis_UpdateInspector();
62+
}
63+
5664
private static bool _initialized = false;
5765

5866
/// <summary>
@@ -463,6 +471,9 @@ private static void OnFontFace(int callbackId, int index, IntPtr familyName,
463471
[return: MarshalAs(UnmanagedType.U1)]
464472
static extern bool Noesis_IsInspectorConnected();
465473

474+
[DllImport(Library.Name)]
475+
static extern void Noesis_UpdateInspector();
476+
466477
[DllImport(Library.Name)]
467478
static extern void Noesis_Init([MarshalAs(UnmanagedType.LPStr)] string licenseName,
468479
[MarshalAs(UnmanagedType.LPStr)] string licenseKey);

Src/Noesis/Core/Src/Core/View.cs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,39 @@ public void SetTessellationMaxPixelError(TessellationMaxPixelError maxError)
6565
Noesis_View_SetTessellationMaxPixelError(CPtr, maxError.Error);
6666
}
6767

68+
/// <summary>
69+
/// Gets current tessellation curve tolerance
70+
/// </summary>
71+
public TessellationMaxPixelError GetTessellationMaxPixelError()
72+
{
73+
return Noesis_View_GetTessellationMaxPixelError(CPtr);
74+
}
75+
6876
/// <summary>
6977
/// Enables render flags. No flags are active by default
7078
/// </summary>
7179
public void SetFlags(RenderFlags flags)
7280
{
7381
Noesis_View_SetFlags(CPtr, (int)flags);
7482
}
83+
84+
/// <summary>
85+
/// Enables render flags. No flags are active by default
86+
/// </summary>
87+
public RenderFlags GetFlags()
88+
{
89+
return (RenderFlags)Noesis_View_GetFlags(CPtr);
90+
}
91+
92+
/// <summary>
93+
/// Sets the projection matrix that transforms the coordinates of each primitive to a
94+
/// non-normalized homogeneous space where (0, 0) is at the lower-left corner and
95+
/// (width, height) is at the upper-right corner after projection
96+
/// </summary>
97+
public void SetProjectionMatrix(Matrix4 projection)
98+
{
99+
Noesis_View_SetProjectionMatrix(CPtr, ref projection);
100+
}
75101
#endregion
76102

77103
#region Input management
@@ -484,9 +510,18 @@ protected override IntPtr CreateCPtr(Type type, out bool registerExtend)
484510
[DllImport(Library.Name)]
485511
static extern void Noesis_View_SetTessellationMaxPixelError(HandleRef view, float maxError);
486512

513+
[DllImport(Library.Name)]
514+
static extern float Noesis_View_GetTessellationMaxPixelError(HandleRef view);
515+
487516
[DllImport(Library.Name)]
488517
static extern void Noesis_View_SetFlags(HandleRef view, int flags);
489518

519+
[DllImport(Library.Name)]
520+
static extern int Noesis_View_GetFlags(HandleRef view);
521+
522+
[DllImport(Library.Name)]
523+
static extern int Noesis_View_SetProjectionMatrix(HandleRef view, ref Matrix4 projection);
524+
490525
[DllImport(Library.Name)]
491526
static extern void Noesis_View_Activate(HandleRef view);
492527

0 commit comments

Comments
 (0)