From: jpbruyere Date: Thu, 15 Jun 2017 15:14:31 +0000 (+0200) Subject: work in progress X-Git-Url: https://git.osiis.dedyn.io/?a=commitdiff_plain;h=refs%2Fheads%2FTestC;p=jp%2Fcrow.git work in progress --- diff --git a/Crow.sln b/Crow.sln index 72677865..19e78ad8 100644 --- a/Crow.sln +++ b/Crow.sln @@ -35,6 +35,7 @@ Global {6CD55032-B8D6-4238-AA91-F9145E1217D4}.Release|Any CPU.ActiveCfg = Release|Any CPU {6CD55032-B8D6-4238-AA91-F9145E1217D4}.Release|Any CPU.Build.0 = Release|Any CPU {74289092-9F70-4941-AFCB-DFD7BE2140B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {74289092-9F70-4941-AFCB-DFD7BE2140B6}.Debug|Any CPU.Build.0 = Debug|Any CPU {74289092-9F70-4941-AFCB-DFD7BE2140B6}.Release|Any CPU.ActiveCfg = Release|Any CPU {74289092-9F70-4941-AFCB-DFD7BE2140B6}.Release|Any CPU.Build.0 = Release|Any CPU {A37A7E14-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU diff --git a/MDEmbedTest/Makefile b/MDEmbedTest/Makefile index 53da377d..279fc03e 100644 --- a/MDEmbedTest/Makefile +++ b/MDEmbedTest/Makefile @@ -29,4 +29,4 @@ clean: .PHONY: run run: - -./${TARGET} ../build/Debug/testDrm.exe + -./${TARGET} ../build/Debug/Tests.exe diff --git a/MDEmbedTest/libcrow.so b/MDEmbedTest/libcrow.so index e151c8a1..01d6f3f8 100755 Binary files a/MDEmbedTest/libcrow.so and b/MDEmbedTest/libcrow.so differ diff --git a/Tests/BasicTests.cs b/Tests/BasicTests.cs index d48364e8..0f9447a9 100644 --- a/Tests/BasicTests.cs +++ b/Tests/BasicTests.cs @@ -148,19 +148,20 @@ namespace Tests //testFiles = new string [] { @"Interfaces/Unsorted/testFileDialog.crow" }; //testFiles = new string [] { @"Interfaces/Divers/colorPicker.crow" }; - testFiles = new string [] { @"Interfaces/Divers/welcome.crow" }; + //testFiles = new string [] { @"Interfaces/Divers/welcome.crow" }; + testFiles = new string [] { "#Tests.Interfaces.GraphicObject.0.crow" }; //testFiles = new string [] { @"#Tests.Interfaces.perfMsr.crow" }; - testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/GraphicObject", "*.crow")).ToArray (); - testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Container", "*.crow")).ToArray (); - testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Group", "*.crow")).ToArray (); - testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Stack", "*.crow")).ToArray (); - testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/TemplatedControl", "*.crow")).ToArray (); - testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/TemplatedContainer", "*.crow")).ToArray (); - testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/TemplatedGroup", "*.crow")).ToArray (); - testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Splitter", "*.crow")).ToArray (); - testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Wrapper", "*.crow")).ToArray (); - testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Divers", "*.crow")).ToArray (); - testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Unsorted", "*.crow")).ToArray (); +// testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/GraphicObject", "*.crow")).ToArray (); +// testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Container", "*.crow")).ToArray (); +// testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Group", "*.crow")).ToArray (); +// testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Stack", "*.crow")).ToArray (); +// testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/TemplatedControl", "*.crow")).ToArray (); +// testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/TemplatedContainer", "*.crow")).ToArray (); +// testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/TemplatedGroup", "*.crow")).ToArray (); +// testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Splitter", "*.crow")).ToArray (); +// testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Wrapper", "*.crow")).ToArray (); +// testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Divers", "*.crow")).ToArray (); +// testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Unsorted", "*.crow")).ToArray (); object tc = Color.AirForceBlueRaf; Load (testFiles [idx]).DataSource = this; diff --git a/Tests/CrowWindow.cs b/Tests/CrowWindow.cs index a578fa64..e1dd5375 100644 --- a/Tests/CrowWindow.cs +++ b/Tests/CrowWindow.cs @@ -182,11 +182,11 @@ namespace Crow if (ifaceControl.Count == 0)//create default orthogonal interface addInterfaceControler (new InterfaceControler ( new Rectangle (0, 0, this.ClientRectangle.Width, this.ClientRectangle.Height))); - ifaceControl [interfaceIdx].CrowInterface.AddWidget (g); + ifaceControl [interfaceIdx].CrowInterface.AddChild (g); return g; } public void DeleteWidget (GraphicObject g, int interfaceIdx = 0){ - ifaceControl [interfaceIdx].CrowInterface.DeleteWidget (g); + ifaceControl [interfaceIdx].CrowInterface.RemoveChild (g); } public GraphicObject Load (string path, int interfaceIdx = 0){ if (ifaceControl.Count == 0)//create default orthogonal interface @@ -203,7 +203,7 @@ namespace Crow return null; } public void ClearInterface (int interfaceIdx = 0){ - ifaceControl [interfaceIdx].CrowInterface.ClearInterface (); + ifaceControl [interfaceIdx].CrowInterface.ClearChildren (); } /// Override this method for your OpenGL rendering calls public virtual void OnRender(FrameEventArgs e) diff --git a/Tests/InterfaceControler.cs b/Tests/InterfaceControler.cs index 869c3896..264ebd21 100644 --- a/Tests/InterfaceControler.cs +++ b/Tests/InterfaceControler.cs @@ -162,7 +162,7 @@ namespace Crow while (true) { CrowInterface.Update (); - Thread.Sleep (3); + Thread.Sleep (1000); } } diff --git a/Tests/Tests.csproj b/Tests/Tests.csproj index 9eb845a1..b6c705c5 100644 --- a/Tests/Tests.csproj +++ b/Tests/Tests.csproj @@ -85,9 +85,6 @@ PreserveNewest - - PreserveNewest - PreserveNewest @@ -356,6 +353,9 @@ + + PreserveNewest + diff --git a/src/Crow.Native/LibCrow.cs b/src/Crow.Native/LibCrow.cs index 28994f02..865c8400 100644 --- a/src/Crow.Native/LibCrow.cs +++ b/src/Crow.Native/LibCrow.cs @@ -60,6 +60,8 @@ namespace Crow.Native unsafe internal static extern byte crow_object_do_layout (crow_object_t* go, LayoutingType layout); [MethodImplAttribute(MethodImplOptions.InternalCall)] unsafe internal static extern byte crow_object_register_layouting (crow_object_t* go, LayoutingType layout); + [MethodImplAttribute(MethodImplOptions.InternalCall)] + unsafe internal static extern void crow_object_register_repaint (crow_object_t* go); [DllImport(lib, CallingConvention = CallingConvention.Cdecl)] diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs index 4b81ed28..7422abed 100644 --- a/src/GraphicObjects/GraphicObject.cs +++ b/src/GraphicObjects/GraphicObject.cs @@ -888,7 +888,7 @@ namespace Crow if (Width.IsFit || Height.IsFit) RegisterForLayouting (LayoutingType.Sizing); else if (RegisteredLayoutings == LayoutingType.None) - CurrentInterface.EnqueueForRepaint (this); + LibCrow.crow_object_register_repaint (nativeHnd); } /// query an update of the content, a redraw [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -896,7 +896,7 @@ namespace Crow { IsDirty = true; if (RegisteredLayoutings == LayoutingType.None) - CurrentInterface.EnqueueForRepaint (this); + LibCrow.crow_object_register_repaint (nativeHnd); } #endregion @@ -912,7 +912,8 @@ namespace Crow } unsafe public virtual void RegisterForLayouting(LayoutingType layoutType){ - LibCrow.crow_object_register_layouting (this.nativeHnd, layoutType); + lock (CurrentInterface.LayoutMutex) + LibCrow.crow_object_register_layouting (this.nativeHnd, layoutType); } /// trigger dependant sizing component update diff --git a/src/Interface.cs b/src/Interface.cs index 7d5eed13..5c581554 100644 --- a/src/Interface.cs +++ b/src/Interface.cs @@ -382,6 +382,16 @@ namespace Crow } #endregion + public override void AddChild (GraphicObject g) + { + lock(RenderMutex) + base.AddChild (g); + } + public override void RemoveChild (GraphicObject child) + { + lock(RenderMutex) + base.RemoveChild (child); + } #region UPDATE Loops /// Enqueue Graphic object for Repaint, DrawingQueue is locked because