]> O.S.I.I.S - jp/crow.git/commitdiff
Squashed commit devel branch:
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Fri, 9 Feb 2018 17:46:40 +0000 (18:46 +0100)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Fri, 9 Feb 2018 17:46:40 +0000 (18:46 +0100)
commit 7f91f7c2e83f7cfb2922ea83586f156f03f88a59
Author: Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
Date:   Fri Feb 9 18:13:59 2018 +0100

    go back to OpenTK-2, waiting for an official release

commit 125f32758a584c4976d3536eab3702fd37a8a7a9
Author: Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
Date:   Fri Feb 9 17:26:00 2018 +0100

    LoadInterface replaced by AddWidget overload, [ide] property view item templates in separate template file

commit 7c48cd2f0332d2ec82006edb755fcd37ab1f2b4a
Author: Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
Date:   Fri Feb 9 12:10:13 2018 +0100

    Tooltips, CrowIDE improvements, Fetch subdata when test not eq TypeOf, debug listener in basicTest, RemoveWidget in iface
     modifié :         Crow.ControlsLib/Crow.ControlsLib.csproj
     modifié :         Crow.csproj
     modifié :         Crow.sln
     modifié :         CrowIDE/CrowIDE.csproj
     modifié :         CrowIDE/src/CrowIDE.cs
     modifié :         CrowIDE/src/ImlVisualEditor.cs
     nouveau fichier : CrowIDE/src/Project.cs
     nouveau fichier : CrowIDE/src/Solution.cs
     nouveau fichier : CrowIDE/src/VerticalLine.cs
     nouveau fichier : CrowIDE/ui/ProjectProperties.crow
     nouveau fichier : CrowIDE/ui/ProjectTree.template
     nouveau fichier : CrowIDE/ui/TreeExpandable.template
     modifié :         CrowIDE/ui/imlEditor.crow
     modifié :         Default.style
     nouveau fichier : Icons/assembly.svg
     nouveau fichier : Templates/Tooltip.template
     modifié :         Tests/BasicTests.cs
     modifié :         Tests/HelloWorld.cs
     modifié :         Tests/Interfaces/Divers/0.crow
     modifié :         Tests/Interfaces/Divers/testShape.crow
     modifié :         Tests/Interfaces/Divers/welcome.crow
     modifié :         Tests/Tests.csproj
     modifié :         src/CompilerServices/CompilerServices.cs
     modifié :         src/GraphicObjects/FileDialog.cs
     modifié :         src/GraphicObjects/GraphicObject.cs
     modifié :         src/GraphicObjects/MessageBox.cs
     modifié :         src/Instantiator.cs
     modifié :         src/Interface.cs
     modifié :         src/ItemTemplate.cs

26 files changed:
.nuget/NuGet.config [new file with mode: 0644]
Crow.ControlsLib/Crow.ControlsLib.csproj
Crow.Test/Test.cs
Crow.csproj
Crow.sln
Default.style
Icons/assembly.svg [new file with mode: 0644]
Templates/Tooltip.template [new file with mode: 0644]
Tests/BasicTests.cs
Tests/CrowWindow.cs
Tests/Hello3D.cs
Tests/HelloWorld.cs
Tests/Interfaces/Divers/0.crow
Tests/Interfaces/Divers/testShape.crow
Tests/OpenGL/Extensions.cs
Tests/Tests.csproj
Tests/Tutorials/T3_OpenGLCube.cs
Tests/packages.config
src/CompilerServices/CompilerServices.cs
src/GraphicObjects/FileDialog.cs
src/GraphicObjects/GraphicObject.cs
src/GraphicObjects/MessageBox.cs
src/GraphicObjects/Popper.cs
src/Instantiator.cs
src/Interface.cs
src/ItemTemplate.cs

diff --git a/.nuget/NuGet.config b/.nuget/NuGet.config
new file mode 100644 (file)
index 0000000..9724103
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+       <config>
+               <add key="repositoryPath" value="../packages" />
+       </config>
+</configuration>
index 6309f88efe4ee56797e9ec52a6b6a8d264f827a0..75fd3f14c0c7b8dab7a1e3aa01f7a1fce22635b1 100644 (file)
@@ -6,10 +6,11 @@
     <ProductVersion>8.0.30703</ProductVersion>
     <SchemaVersion>2.0</SchemaVersion>
     <ProjectGuid>{6E48BD3D-7B33-4368-AA8A-D878427DAC83}</ProjectGuid>
-    <OutputType>Exe</OutputType>
+    <OutputType>Library</OutputType>
     <RootNamespace>Crow.ControlsLib</RootNamespace>
     <AssemblyName>Crow.ControlsLib</AssemblyName>
     <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+    <ReleaseVersion>0.5</ReleaseVersion>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <DebugSymbols>true</DebugSymbols>
     <WarningLevel>4</WarningLevel>
     <ConsolePause>false</ConsolePause>
   </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+<!--    <Reference Include="System.Data" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Drawing" />-->
+    <Reference Include="System.Xml" />
+  </ItemGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
   <ItemGroup>
     <EmbeddedResource Include="Default.style" />
     <Compile Include="DockingView.cs" />
     <Compile Include="DocksView.cs" />
   </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\Crow.csproj">
+      <Project>{C2980F9B-4798-4C05-99E2-E174810F7C7B}</Project>
+      <Name>Crow</Name>
+    </ProjectReference>
+  </ItemGroup>
 </Project>
\ No newline at end of file
index c0fa9f59ab00bf42910cecf2694eaa2150ffeedf..e21177f89f376336c68654b8a9c07cf334adab24 100644 (file)
@@ -46,7 +46,7 @@ namespace UnitTest
 
                        foreach (string s in tests) {
                                string fileName = Path.Combine ("Interfaces", s + ".crow");
-                               iface.LoadInterface (fileName);
+                               iface.AddWidget (fileName);
 
                                iface.Update ();
                                iface.Update ();
index 90cc449596f16544570d606c2f33b0f104091e89..a8b47dc80ba1a5e51c1809ee44f397a5e96f21e7 100644 (file)
     <EmbeddedResource Include="Templates\ArrowBut.template" />
     <EmbeddedResource Include="Templates\treeList.template" />
     <EmbeddedResource Include="Templates\CheckBox2.template" />
+    <EmbeddedResource Include="Icons\assembly.svg" />
+    <EmbeddedResource Include="Templates\Tooltip.template">
+      <LogicalName>Crow.Tooltip.template</LogicalName>
+    </EmbeddedResource>
   </ItemGroup>
   <ItemGroup>
     <None Include="Crow.dll.config">
index 9874dbe3e2f72819911e9ac958a470457cb6fb43..70736ea4699658f8c1e19c9668855c431bb50f50 100644 (file)
--- a/Crow.sln
+++ b/Crow.sln
@@ -7,7 +7,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "Tests\Tests.csproj
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Crow.Test", "Crow.Test\Crow.Test.csproj", "{42C73BD8-51F5-4BB7-8EE9-9F0BE2D80A2C}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Crow.ControlsLib", "Crow.ControlsLib\Crow.ControlsLib.csproj", "{6E48BD3D-7B33-4368-AA8A-D878427DAC83}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CrowIDE", "CrowIDE\CrowIDE.csproj", "{B6D911CD-1D09-42FC-B300-9187190F2AE1}"
 EndProject
 Global
        GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -19,14 +19,14 @@ Global
                {42C73BD8-51F5-4BB7-8EE9-9F0BE2D80A2C}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {42C73BD8-51F5-4BB7-8EE9-9F0BE2D80A2C}.Release|Any CPU.ActiveCfg = Release|Any CPU
                {42C73BD8-51F5-4BB7-8EE9-9F0BE2D80A2C}.Release|Any CPU.Build.0 = Release|Any CPU
-               {6E48BD3D-7B33-4368-AA8A-D878427DAC83}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-               {6E48BD3D-7B33-4368-AA8A-D878427DAC83}.Debug|Any CPU.Build.0 = Debug|Any CPU
-               {6E48BD3D-7B33-4368-AA8A-D878427DAC83}.Release|Any CPU.ActiveCfg = Release|Any CPU
-               {6E48BD3D-7B33-4368-AA8A-D878427DAC83}.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
+               {B6D911CD-1D09-42FC-B300-9187190F2AE1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+               {B6D911CD-1D09-42FC-B300-9187190F2AE1}.Debug|Any CPU.Build.0 = Debug|Any CPU
+               {B6D911CD-1D09-42FC-B300-9187190F2AE1}.Release|Any CPU.ActiveCfg = Release|Any CPU
+               {B6D911CD-1D09-42FC-B300-9187190F2AE1}.Release|Any CPU.Build.0 = Release|Any CPU
                {C2980F9B-4798-4C05-99E2-E174810F7C7B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
                {C2980F9B-4798-4C05-99E2-E174810F7C7B}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {C2980F9B-4798-4C05-99E2-E174810F7C7B}.Release|Any CPU.ActiveCfg = Release|Any CPU
index b0cbbb82a6987eb1474c2db14db043863de670da..c5c04ea74e6eabebd30f23c92b8b28a4bf09af12 100644 (file)
@@ -45,6 +45,7 @@ MessageBox {
        Title=MessageBox;
        Font = serif, 12;
        MinimumSize = 200,120;
+       AlwaysOnTop = true;
 }
 Slider {
        Background = vgradient|0:Black|0.1:Gray|0.9:Gray|1:LightGray;
@@ -97,6 +98,7 @@ DockingView {
 }
 FileDialog {
        Template = #Crow.FileDialog.template;
+       AlwaysOnTop = true;
        Focusable = true;
        MinimumSize=50,50;
        Width = 500;
diff --git a/Icons/assembly.svg b/Icons/assembly.svg
new file mode 100644 (file)
index 0000000..5ac3643
--- /dev/null
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   viewBox="0 0 64 64"
+   height="64"
+   width="64"
+   id="svg2"
+   version="1.1">
+  <metadata
+     id="metadata8">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <defs
+     id="defs6" />
+  <path
+     d="M 15,33.964845 A 6.2543149,5.8551034 0 0 1 8.7456846,39.819949 6.2543149,5.8551034 0 0 1 2.4913703,33.964845 6.2543149,5.8551034 0 0 1 8.7456846,28.109741 6.2543149,5.8551034 0 0 1 15,33.964845 Z M 30.205524,19.726298 h 24.484978 c 3.833495,0 6.919666,3.88699 6.919666,8.715226 v 11.046641 c 0,4.828235 -3.086171,8.715225 -6.919666,8.715225 H 30.205524 c -3.833494,0 -6.919665,-3.88699 -6.919665,-8.715225 V 28.441524 c 0,-4.828236 3.086171,-8.715226 6.919665,-8.715226 z M 15,33.964845 h 8.285859"
+     style="opacity:1;fill:#a0a8ab;fill-opacity:1;stroke:#181818;stroke-width:2;stroke-linecap:butt;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:normal"
+     id="path819" />
+</svg>
diff --git a/Templates/Tooltip.template b/Templates/Tooltip.template
new file mode 100644 (file)
index 0000000..3c5f8c1
--- /dev/null
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<Border Fit="true" Foreground="Jet" Background="ArylideYellow">
+       <Label Margin="3" Foreground="Jet" Multiline="true" Text="{Tooltip}"/>
+</Border>
index 9d8764f48ca5b6c31e82cd302ad1fa045e91499c..e04f160e552f4150ce61f779c19f8a2ba9dd657a 100644 (file)
@@ -98,7 +98,9 @@ namespace Tests
                        }
                        get { return List2; }
                }
-               IList<Color> testList = Color.ColorDic.Values.ToList();
+               IList<Color> testList = Color.ColorDic.Values.OrderBy(c=>c.Hue)
+                       .ThenBy(c=>c.Value).ThenBy(c=>c.Saturation)
+                       .ToList();
                public IList<Color> TestList {
                        set{
                                testList = value;
@@ -154,7 +156,6 @@ namespace Tests
                        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;
                }
                void KeyboardKeyDown1 (object sender, OpenTK.Input.KeyboardKeyEventArgs e)
@@ -201,8 +202,8 @@ namespace Tests
 
                                GraphicObject obj = Load (testFiles[idx]);
                                obj.DataSource = this;
-                       } catch (Exception ex) {
-                               Debug.WriteLine (ex.Message + ex.InnerException);
+                       } catch (Exception ex) {                                
+                               MessageBox.Show (MessageBox.Type.Error, ex.Message + "\n" + ex.InnerException);
                        }
                }
 //             void Tv_SelectedItemChanged (object sender, SelectionChangeEventArgs e)
@@ -246,13 +247,18 @@ namespace Tests
                [STAThread]
                static void Main ()
                {
-                       TextWriterTraceListener listener = new TextWriterTraceListener ("listen.txt");
+                       #if DEBUG
+                       TextWriterTraceListener listener = new TextWriterTraceListener ("debug.log");
                        Debug.Listeners.Add (listener);
+                       #endif
+
                        Console.WriteLine ("starting example");
                        BasicTests win = new BasicTests ();
                        win.VSync = OpenTK.VSyncMode.Adaptive;
                        win.Run (30);
+                       #if DEBUG
                        listener.Dispose ();
+                       #endif
                }
                protected override void OnUpdateFrame (OpenTK.FrameEventArgs e)
                {
index d4447a1fa9943a46cab820be819023f1a5e584a0..9a0c4df0479eaf2525ba74c8a228f29fe50e824a 100644 (file)
@@ -227,7 +227,7 @@ namespace Crow
                /// <param name="interfaceIdx">interface index to bind to, a default one is created if none exists</param>
                public GraphicObject Load (string path, int interfaceIdx = 0){
                        checkDefaultIFace();
-                       return ifaceControl [interfaceIdx].CrowInterface.LoadInterface (path);
+                       return ifaceControl [interfaceIdx].CrowInterface.AddWidget (path);
                }
                /// <summary>
                /// Load the content of the IML string passed as first argument and add it to the current interface
index 48b95c5ce04b1174414ecef8365e3d30b1b619c3..2730bb63bd27d01fd1cb7f86a504196912c53fb3 100644 (file)
@@ -66,7 +66,7 @@ namespace Tests
                void initGL(){
                        GL.Enable (EnableCap.CullFace);
                        GL.Enable (EnableCap.Blend);
-                       GL.BlendFunc(BlendingFactor.SrcAlpha, BlendingFactor.OneMinusSrcAlpha);
+                       GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
 
                        cube = vaoMesh.CreateCube ();
                        texture = new Texture ("image/textest.png");
index b29bfac5958b88bd8ab4e5f5e1320a9cd123025b..75cc9bd59f7ac2965206ae2c7309f67db57ba18b 100644 (file)
@@ -26,6 +26,7 @@
 
 using System;
 using Crow;
+using Tutorials;
 
 namespace Tests
 {
@@ -39,7 +40,7 @@ namespace Tests
                protected override void OnLoad (EventArgs e)
                {
                        base.OnLoad (e);
-                       AddWidget (new Label (CurrentInterface) { Text = "Hello World" });
+                       LoadIMLFragment (@"<SimpleGauge Level='40' Margin='5' Background='Jet' Foreground='Gray' Width='30' Height='50%'/>");
                }
 
                [STAThread]
index d5cf83c686576d19d2a5c369a03271c7f94df7eb..dbb1420d102fcbce1fd643e304494cb58238da6d 100755 (executable)
@@ -4,27 +4,27 @@
                <VerticalStack Width="30%" Margin="5">
                        <GroupBox Caption="Performance" Height="Fit">
                                <VerticalStack Width="90%" Height="Fit" Spacing="2" >
-                                       <HorizontalStack Height="Fit">
+                                       <HorizontalStack Height="Fit" Tooltip="Frame per second">
                                                <Label Text="Fps:" Style="FpsLabel"/>
                                                <Label Text="{fps}" Style="FpsDisp"/>
                                        </HorizontalStack>
-                                       <HorizontalStack Height="Fit">
+                                       <HorizontalStack Height="Fit" Tooltip="Minimum Frame per second">
                                                <Label Text="Min:" Style="FpsLabel"/>
                                                <Label Text="{fpsMin}" Style="FpsDisp"/>
                                        </HorizontalStack>
-                                       <HorizontalStack Height="Fit">
+                                       <HorizontalStack Height="Fit" Tooltip="Maximum Frame per second">
                                                <Label Text="Max:" Style="FpsLabel"/>
                                                <Label Text="{fpsMax}" Style="FpsDisp"/>
                                        </HorizontalStack>
-                                       <HorizontalStack Height="Fit">
+                                       <HorizontalStack Height="Fit" Tooltip="Update loop duration">
                                                <Label Text="Update:" Style="FpsLabel"/>
                                                <Label Text="{update}" Style="FpsDisp"/>
                                        </HorizontalStack>
-                                       <HorizontalStack Height="Fit">
+                                       <HorizontalStack Height="Fit" Tooltip="Layouting process duration">
                                                <Label Text="Layouting:" Style="FpsLabel"/>
                                                <Label Text="{layouting}" Style="FpsDisp"/>
                                        </HorizontalStack>
-                                       <HorizontalStack Height="Fit">
+                                       <HorizontalStack Height="Fit" Tooltip="Clipping duration">
                                                <Label Text="Clipping:" Style="FpsLabel"/>
                                                <Label Text="{clipping}" Style="FpsDisp"/>
                                        </HorizontalStack>
index 61501b5ae12ef00046eab806a8513ef1840791f2..2c1572a4ff61d59f98394c3b660eff623acc2eb0 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
-<Container Fit="true" >
+<Container Fit="true" Background="Red" Tooltip="test tooltip" >
        <Shape Foreground="Transparent" Background="Onyx" Path="M 5.5,0.5 L 10.5,10.5 L 0.5,10.5 Z"
                MouseEnter="{Background=hgradient|0:Jet|0.5:BlueCrayola|1:Black}"
                MouseLeave="{Background=Onyx}"/>
index 0dd1cca6b6f2940a352d6ae29cbc088a2d16b23e..7b26f76bc24e0907e7d0a79a531fd8ca6b855afb 100644 (file)
@@ -24,7 +24,7 @@ using Crow;
 
 namespace Crow
 {
-       public static class Extensions {
+       public static partial class Extensions {
                public static Vector4 ToVector4(this Color c){
                        float[] f = c.floatArray;
                        return new Vector4 (f [0], f [1], f [2], f [3]);
index 8096d9a8ae4b4eb3c170a64e422efa543d73b304..75969d9b1a8c89db4ef7d224439f2fe96ef6fabb 100644 (file)
@@ -8,7 +8,7 @@
     <OutputType>Exe</OutputType>
     <RootNamespace>Tests</RootNamespace>
     <AssemblyName>Tests</AssemblyName>
-    <StartupObject>Tests.Showcase</StartupObject>
+    <StartupObject>Tests.BasicTests</StartupObject>
     <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
     <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
     <ReleaseVersion>0.5</ReleaseVersion>
     <StartWorkingDirectory>%24{SolutionDir}\build\%24{ProjectConfigName}</StartWorkingDirectory>
     <ConsolePause>false</ConsolePause>
   </PropertyGroup>
+  <PropertyGroup Condition=" '$(RunConfiguration)' == 'Custom Command' ">
+    <StartAction>Program</StartAction>
+    <StartProgram>%24{TargetName}</StartProgram>
+    <StartWorkingDirectory>%24{SolutionDir}\build\%24{ProjectConfigName}</StartWorkingDirectory>
+    <ConsolePause>false</ConsolePause>
+  </PropertyGroup>
   <ItemGroup>
     <Reference Include="System" />
     <Reference Include="System.Data" />
     <Reference Include="System.Xml" />
     <Reference Include="System.Drawing" />
     <Reference Include="OpenTK">
-      <HintPath>..\packages\OpenTK.3.0.0-git00041\lib\net20\OpenTK.dll</HintPath>
+      <HintPath>..\packages\OpenTK.2.0.0\lib\net20\OpenTK.dll</HintPath>
     </Reference>
   </ItemGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
index c920c62d22bd2f1b0781b81be7e45942bf8345cc..2cada668c216fcc3d31011cfa277c0486f2f0601 100644 (file)
@@ -55,7 +55,7 @@ namespace Tutorials
 
                        GL.Enable (EnableCap.CullFace);
                        GL.Enable (EnableCap.Blend);
-                       GL.BlendFunc(BlendingFactor.SrcAlpha, BlendingFactor.OneMinusSrcAlpha);
+                       GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
 
                        cube = vaoMesh.CreateCube ();
                        texture = new Texture ("image/textest.png");
index f4e36ffeb37822faf2443dce657d07a379d39d1f..b3717663efb9a04b86230b2c44a6ae14f49dd3f2 100644 (file)
@@ -1,4 +1,4 @@
 <?xml version="1.0" encoding="utf-8"?>
 <packages>
-  <package id="OpenTK" version="3.0.0-git00041" targetFramework="net45" />
+  <package id="OpenTK" version="2.0.0" targetFramework="net45" />
 </packages>
\ No newline at end of file
index cb8b75b54124fd2261a79865f226289aad8065fe..16d28490df0a446b6e8d85cc41941b7ca0080329 100644 (file)
@@ -67,6 +67,7 @@ namespace Crow.IML
                internal static MethodInfo miGetValWithRefx = typeof(CompilerServices).GetMethod("getValueWithReflexion", BindingFlags.Static | BindingFlags.NonPublic);
                internal static MethodInfo miCreateDel = typeof(CompilerServices).GetMethod ("createDel", BindingFlags.Static | BindingFlags.NonPublic);
                internal static MethodInfo miGetImplOp = typeof(CompilerServices).GetMethod ("getImplicitOp", BindingFlags.Static | BindingFlags.NonPublic);
+               internal static MethodInfo miGetDataTypeAndFetch = typeof(CompilerServices).GetMethod("getDataTypeAndFetch", BindingFlags.Static | BindingFlags.NonPublic);
 
 
                internal static MethodInfo miGoUpLevels = typeof(CompilerServices).GetMethod("goUpNbLevels", BindingFlags.Static | BindingFlags.NonPublic);
@@ -92,7 +93,7 @@ namespace Crow.IML
                internal static MethodInfo miGetITempFromDic = typeof(Dictionary<string, ItemTemplate>).GetMethod ("get_Item", new Type[] { typeof(string) });
                internal static FieldInfo fldItemTemplates = typeof(TemplatedGroup).GetField("ItemTemplates");
                internal static MethodInfo miCreateExpDel = typeof(ItemTemplate).GetMethod ("CreateExpandDelegate");
-
+               internal static FieldInfo fiFetchMethodName = typeof(ItemTemplate).GetField("fetchMethodName", BindingFlags.Instance | BindingFlags.NonPublic);
                #region tree handling methods
                internal static FieldInfo fiChild = typeof(PrivateContainer).GetField ("child", BindingFlags.Instance | BindingFlags.NonPublic);
                internal static MethodInfo miSetChild = typeof (Container).GetMethod ("SetChild");
@@ -330,22 +331,27 @@ namespace Crow.IML
                        Type dstType = null;
                        if (mi == null)
                                return null;
-                       if (mi.MemberType == MemberTypes.Property) {
-                               PropertyInfo pi = mi as PropertyInfo;
-                               tmp = pi.GetValue (instance);
-                               dstType = pi.PropertyType;
-                       }
-                       if (mi.MemberType == MemberTypes.Field) {
-                               FieldInfo fi = mi as FieldInfo;
-                               tmp = fi.GetValue (instance);
-                               dstType = fi.FieldType;
-                       }
-                       if (tmp != null)
-                               return tmp;
-                       if (dstType == typeof(string) || dstType == CompilerServices.TObject)//TODO:object should be allowed to return null and not ""
+                       try {
+                               if (mi.MemberType == MemberTypes.Property) {
+                                       PropertyInfo pi = mi as PropertyInfo;
+                                       tmp = pi.GetValue (instance);
+                                       dstType = pi.PropertyType;
+                               }
+                               if (mi.MemberType == MemberTypes.Field) {
+                                       FieldInfo fi = mi as FieldInfo;
+                                       tmp = fi.GetValue (instance);
+                                       dstType = fi.FieldType;
+                               }
+                               if (tmp != null)
+                                       return tmp;
+                               if (dstType == typeof(string) || dstType == CompilerServices.TObject)//TODO:object should be allowed to return null and not ""
+                                       return "";
+                               if (dstType.IsValueType)
+                                       return Activator.CreateInstance (dstType);                              
+                       } catch (Exception ex) {
+                               Debug.WriteLine (ex.ToString ());
                                return "";
-                       if (dstType.IsValueType)
-                               return Activator.CreateInstance (dstType);
+                       }
 
                        return null;
                }
@@ -863,6 +869,28 @@ namespace Crow.IML
                        }
                        return null;
                }
+
+               internal static object getDataTypeAndFetch (object data, string fetchMethod){
+                       Type dataType = data.GetType();
+                       MethodInfo miGetDatas = dataType.GetMethod (fetchMethod, new Type[] {});
+                       if (miGetDatas == null)
+                               miGetDatas = CompilerServices.SearchExtMethod (dataType, fetchMethod);
+
+                       if (miGetDatas == null) {//in last resort, search among properties
+                               PropertyInfo piDatas = dataType.GetProperty (fetchMethod);
+                               if (piDatas == null) {
+                                       FieldInfo fiDatas = dataType.GetField (fetchMethod);
+                                       if (fiDatas == null)//and among fields
+                                               throw new Exception ("Fetch data member not found in ItemTemplate: " + fetchMethod);
+                                       return fiDatas.GetValue (data);
+                               }
+                               miGetDatas = piDatas.GetGetMethod ();
+                               if (miGetDatas == null)
+                                       throw new Exception ("Read only property for fetching data in ItemTemplate: " + fetchMethod);
+                       }
+                       object tmp = miGetDatas.Invoke (data, null);
+                       return tmp;
+               }
        }
 }
 
index a5ba7b20a51cdb79de30f8b59f8acb00f4b2a31e..285ca253377426b360edf44e8bd1f7bf9d51b0e5 100644 (file)
@@ -52,6 +52,9 @@ namespace Crow
                public event EventHandler OkClicked;
                #endregion
 
+               public string SelectedFileFullPath {
+                       get { return Path.Combine (SelectedDirectory, SelectedFile); }
+               }
                [XmlAttributeAttribute][DefaultValue("/home")]
                public virtual string CurrentDirectory {
                        get { return curDir; }
index 3da8330d85aaf391ce27834c2189b843ae385df3..e24e9b284ff307b822f1d5bb08abe1c3031fbea5 100644 (file)
@@ -808,6 +808,17 @@ namespace Crow
                                NotifyValueChanged ("Style", style);
                        }
                }
+               string tooltip;
+               [XmlAttributeAttribute]
+               public virtual string Tooltip {
+                       get { return tooltip; }
+                       set {
+                               if (tooltip == value)
+                                       return;
+                               tooltip = value;
+                               NotifyValueChanged("Tooltip", tooltip);
+                       }
+               }
                #endregion
 
                #region Default and Style Values loading
index 277a7e11113efb68d641c103991111680f24dbbe..7f945810095a69917b99fc26175ee583ccc7dd7b 100644 (file)
@@ -120,7 +120,6 @@ namespace Crow
                                        NotifyValueChanged ("MsgIcon", "#Crow.Images.Icons.exit.svg");
                                        Caption = "Error";
                                        OkMessage = "Ok";
-                                       CancelMessage = "Cancel";
                                        break;
                                }
                        }
@@ -136,7 +135,7 @@ namespace Crow
                        close ();
                }
                public static MessageBox Show (Type msgBoxType, string message, string okMsg = "", string cancelMsg = ""){
-                       lock (Interface.CurrentInterface.UpdateMutex) {
+                       //lock (Interface.CurrentInterface.UpdateMutex) {
                                MessageBox mb = new MessageBox (Interface.CurrentInterface);
                                mb.CurrentInterface.AddWidget (mb);
                                mb.MsgType = msgBoxType;
@@ -146,7 +145,7 @@ namespace Crow
                                if (!string.IsNullOrEmpty(cancelMsg))
                                        mb.CancelMessage = cancelMsg;
                                return mb;
-                       }
+                       //}
                }
        }
 }
index 5316a5a7f5f5fae42ae319ca34e7cd3174ad571e..41210dc56cadf394904591c15dad92bfa59514ff 100644 (file)
@@ -224,7 +224,7 @@ namespace Crow
                        if (Content != null) {
                                Content.Visible = true;
                                if (Content.Parent == null)
-                                       CurrentInterface.AddWidget (Content, true);
+                                       CurrentInterface.AddWidget (Content);
                                if (Content.LogicalParent != this)
                                        Content.LogicalParent = this;
                                CurrentInterface.PutOnTop (Content, true);
index b79fbc82427f8d14dabaf3f72f4f5b698057a661..297337edd31dd35026923fb20440cc0852708995 100644 (file)
@@ -560,7 +560,7 @@ namespace Crow.IML
                                System.Reflection.Emit.Label finish = il.DefineLabel ();
                                il.Emit (OpCodes.Br, finish);
                                il.MarkLabel (cancel);
-                               il.EmitWriteLine (string.Format ("Handler method '{0}' for '{1}' not found in new dataSource ", bindingDef.TargetMember, sourceEvent.Name));
+                               il.EmitWriteLine (string.Format ("Handler method '{0}' for '{1}' not found in new dataSource", bindingDef.TargetMember, sourceEvent.Name));
                                il.MarkLabel (finish);
                                il.Emit (OpCodes.Ret);
 
index ab78e42d138ec19d8f0558e0464a7c50c3bedbe6..992ff6f69950f4bbcbfc1c7c3832aaf560eb5aa9 100644 (file)
@@ -88,6 +88,8 @@ namespace Crow
                public Interface(){
                        CurrentInterface = this;
                        CultureInfo.DefaultThreadCurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
+
+                       initTooltip ();
                }
                #endregion
 
@@ -100,6 +102,8 @@ namespace Crow
                public static bool FocusOnHover = false;
                /// <summary> Threshold to catch borders for sizing </summary>
                public static int BorderThreshold = 5;
+               /// <summary> delay before tooltip appear </summary>
+               public static int ToolTipDelay = 500;
                /// <summary>Double click threshold in milisecond</summary>
                public static int DoubleClick = 200;//max duration between two mouse_down evt for a dbl clk in milisec.
                /// <summary> Time to wait in millisecond before starting repeat loop</summary>
@@ -313,9 +317,12 @@ namespace Crow
                                return tmp;
                        }
                }
-               /// <summary>Create an instance of a GraphicObject and add it to the GraphicTree
-               /// of this Interface</summary>
-               public GraphicObject LoadInterface (string path)
+               /// <summary>
+               /// Create an instance of a GraphicObject and add it to the GraphicTree of this Interface
+               /// </summary>
+               /// <returns>new instance of graphic object created</returns>
+               /// <param name="path">path of the iml file to load</param>
+               public GraphicObject AddWidget (string path)
                {
                        lock (UpdateMutex) {
                                GraphicObject tmp = Load (path);
@@ -323,8 +330,11 @@ namespace Crow
                                return tmp;
                        }
                }
-               /// <summary>Create an instance of a GraphicObject linked to this interface but
-               /// not added to the GraphicTree</summary>
+               /// <summary>
+               /// Create an instance of a GraphicObject linked to this interface but not added to the GraphicTree
+               /// </summary>
+               /// <returns>new instance of graphic object created</returns>
+               /// <param name="path">path of the iml file to load</param>
                public GraphicObject Load (string path)
                {
                        try {
@@ -333,7 +343,11 @@ namespace Crow
                                throw new Exception ("Error loading <" + path + ">:", ex);
                        }
                }
-               /// <summary>Fetch instantiator it from cache or create it</summary>
+               /// <summary>
+               /// Fetch instantiator from cache or create it.
+               /// </summary>
+               /// <returns>new Instantiator</returns>
+               /// <param name="path">path of the iml file to load</param>
                public static Instantiator GetInstantiator(string path){
                        if (!Instantiators.ContainsKey(path))
                                Instantiators [path] = new Instantiator(path);
@@ -626,7 +640,7 @@ namespace Crow
 
                #region GraphicTree handling
                /// <summary>Add widget to the Graphic tree of this interface and register it for layouting</summary>
-               public void AddWidget(GraphicObject g, bool isOverlay = false)
+               public void AddWidget(GraphicObject g)
                {
                        g.Parent = this;
                        int ptr = 0;
@@ -648,7 +662,7 @@ namespace Crow
                        g.RegisteredLayoutings = LayoutingType.None;
                        g.RegisterForLayouting (LayoutingType.Sizing | LayoutingType.ArrangeChildren);
                }
-               /// <summary>Set visible state of widget to false and remove if from the graphic tree</summary>
+               /// <summary>Set visible state of widget to false and delete if from the graphic tree</summary>
                public void DeleteWidget(GraphicObject g)
                {
                        lock (UpdateMutex) {
@@ -658,6 +672,15 @@ namespace Crow
                                g.Dispose ();
                        }
                }
+               /// <summary>Set visible state of widget to false and remove if from the graphic tree</summary>
+               public void RemoveWidget(GraphicObject g)
+               {
+                       lock (UpdateMutex) {
+                               RegisterClip (g.ScreenCoordinates (g.LastPaintedSlot));
+                               GraphicTree.Remove (g);
+                               g.Parent = null;
+                       }
+               }
                /// <summary> Remove all Graphic objects from top container </summary>
                public void ClearInterface()
                {
@@ -770,6 +793,7 @@ namespace Crow
                        }
 
                        if (HoverWidget != null) {
+                               resetTooltip ();
                                //check topmost graphicobject first
                                GraphicObject tmp = HoverWidget;
                                GraphicObject topc = null;
@@ -947,6 +971,50 @@ namespace Crow
                }
                #endregion
 
+               #region Tooltip handling
+               Stopwatch tooltipTimer = new Stopwatch();
+               GraphicObject ToolTipContainer = null;
+               volatile bool tooltipVisible = false;
+
+               void initTooltip () {
+                       ToolTipContainer = Load  ("#Crow.Tooltip.template");
+                       Thread t = new Thread (toolTipThreadFunc);
+                       t.IsBackground = true;
+                       t.Start ();
+               }
+               void toolTipThreadFunc ()
+               {
+                       while(true) {
+                               if (tooltipTimer.ElapsedMilliseconds > ToolTipDelay) {
+                                       if (!tooltipVisible) {
+                                               GraphicObject g = _hoverWidget;
+                                               while (g != null) {
+                                                       if (!string.IsNullOrEmpty (g.Tooltip)) {
+                                                               AddWidget (ToolTipContainer);
+                                                               ToolTipContainer.DataSource = g;
+                                                               ToolTipContainer.Top = Mouse.Y + 10;
+                                                               ToolTipContainer.Left = Mouse.X + 10;
+                                                               tooltipVisible = true;
+                                                               break;
+                                                       }
+                                                       g = g.LogicalParent as GraphicObject;
+                                               }
+                                       }
+                               }
+                               Thread.Sleep (200);     
+                       }
+
+               }
+               void resetTooltip () {
+                       if (tooltipVisible) {
+                               //ToolTipContainer.DataSource = null;
+                               RemoveWidget (ToolTipContainer);
+                               tooltipVisible = false;
+                       }
+                       tooltipTimer.Restart ();
+               }
+               #endregion
+
                #region Device Repeat Events
                volatile bool mouseRepeatOn, keyboardRepeatOn;
                volatile int mouseRepeatCount, keyboardRepeatCount;
index 915aafd84a5869f113a9d27673e2d69a5daeec2c..52bd520771c4b0604475f9bff76809b96b061c09 100644 (file)
@@ -97,11 +97,14 @@ namespace Crow
                /// </summary>
                /// <param name="host">Host.</param>
                public void CreateExpandDelegate (TemplatedGroup host){
-                       Type dataType = CompilerServices.tryGetType(strDataType);
-                       if (dataType == null) {
-                               Debug.WriteLine ("ItemTemplate error: DataType not found: {0}.", strDataType);
-                               return;
-                       }
+                       Type dataType = null;
+                       //if (host.DataTest == "TypeOf"){
+                               dataType = CompilerServices.tryGetType(strDataType);
+//                             if (dataType == null) {
+//                                     Debug.WriteLine ("ItemTemplate error: DataType not found: {0}.", strDataType);
+//                                     return;
+//                             }
+//                     }
                        Type tmpGrpType = typeof(TemplatedGroup);
                        Type evtType = typeof(EventHandler);
 
@@ -153,9 +156,16 @@ namespace Crow
                        il.Emit (OpCodes.Ldarg_1);//get the dataSource of the sender
                        il.Emit (OpCodes.Callvirt, CompilerServices.miGetDataSource);
 
-                       if (fetchMethodName != "self")//special keyword self allows the use of recurent list<<<
-                               emitGetSubData(il, dataType);                   
+                       if (fetchMethodName != "self") {//special keyword self allows the use of recurent list<<<
+                               if (dataType == null) {
+                                       //dataTest was not = TypeOF, so we have to get the type of data
+                                       //dynamically and fetch
 
+                                       il.Emit (OpCodes.Ldstr, fetchMethodName);
+                                       il.Emit (OpCodes.Callvirt, CompilerServices.miGetDataTypeAndFetch);
+                               }else
+                                       emitGetSubData(il, dataType);                   
+                       }
                        //set 'return' from the fetch method as 'data' of the list
                        il.Emit (OpCodes.Callvirt, piData.GetSetMethod ());
 
@@ -175,8 +185,16 @@ namespace Crow
                        il.Emit (OpCodes.Ldarg_0);
                        il.Emit (OpCodes.Callvirt, CompilerServices.miGetDataSource);
 
-                       if (fetchMethodName != "self")
-                               emitGetSubData(il, dataType);
+                       if (fetchMethodName != "self") {//special keyword self allows the use of recurent list<<<
+                               if (dataType == null) {
+                                       //dataTest was not = TypeOF, so we have to get the type of data
+                                       //dynamically and fetch
+
+                                       il.Emit (OpCodes.Ldstr, fetchMethodName);
+                                       il.Emit (OpCodes.Callvirt, CompilerServices.miGetDataTypeAndFetch);
+                               }else
+                                       emitGetSubData(il, dataType);                   
+                       }
                        
                        il.Emit (OpCodes.Callvirt, CompilerServices.miGetColCount);
                        il.Emit (OpCodes.Ldc_I4_0);
@@ -185,6 +203,8 @@ namespace Crow
                        HasSubItems = (BooleanTestOnInstance)dm.CreateDelegate (typeof(BooleanTestOnInstance));
                        #endregion
                }
+
+               //data is on the stack
                void emitGetSubData(ILGenerator il, Type dataType){
                        MethodInfo miGetDatas = dataType.GetMethod (fetchMethodName, new Type[] {});
                        if (miGetDatas == null)