]> O.S.I.I.S - jp/crow.git/commitdiff
some caching for reflexion, other debug
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Thu, 13 Dec 2018 17:31:05 +0000 (18:31 +0100)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Thu, 13 Dec 2018 17:31:05 +0000 (18:31 +0100)
24 files changed:
Crow.NetStd.sln
Crow.sln
Crow/Crow.csproj
Crow/src/CompilerServices/CompilerServices.cs
Crow/src/GraphicObjects/GraphicObject.cs
Crow/src/GraphicObjects/TemplatedGroup.cs
Crow/src/Instantiator.cs
Crow/src/Interface.cs
Crow/src/ItemTemplate.cs
Crow/src/XCursor.cs [deleted file]
Crow/src/backends/xcb/XCBBackend.cs
Crow/src/backends/xcb/XCursor.cs [new file with mode: 0644]
CrowIDE/CrowIDE.NetStd.csproj
CrowIDE/CrowIDE.csproj
CrowIDE/src/CrowIDE.cs
CrowIDE/src/Project.cs
CrowIDE/src/ProjectTree/CSProjectFile.cs [new file with mode: 0644]
CrowIDE/src/ProjectTree/ProjectFile.cs
CrowIDE/ui/DockWindows/GTreeExpITemp.crow
CrowIDE/ui/DockWindows/winGTExplorer.crow
Tests/Tests.NetStd.csproj
Tests/Tests.csproj
Tests/testClass.cs [new file with mode: 0644]
Tests/ui/TreeExpandable.template [new file with mode: 0644]

index c12c637caed44a742eb299c2d13edbab447d71fc..a62e1600d63f4b86a04cf3e410fee9f78a0cad8f 100644 (file)
@@ -27,28 +27,12 @@ Global
                {75BDE4C7-4BAF-4A03-B697-5D1370775E20}.Release|Any CPU.ActiveCfg = Release|Any CPU
                {75BDE4C7-4BAF-4A03-B697-5D1370775E20}.Release|Any CPU.Build.0 = Release|Any CPU
                {28BAF8B8-6A6E-40D5-8E9C-E7C1165C59DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-               {28BAF8B8-6A6E-40D5-8E9C-E7C1165C59DD}.Debug|Any CPU.Build.0 = Debug|Any CPU
-               {28BAF8B8-6A6E-40D5-8E9C-E7C1165C59DD}.Debug|x64.ActiveCfg = Debug|Any CPU
-               {28BAF8B8-6A6E-40D5-8E9C-E7C1165C59DD}.Debug|x64.Build.0 = Debug|Any CPU
-               {28BAF8B8-6A6E-40D5-8E9C-E7C1165C59DD}.Debug|x86.ActiveCfg = Debug|Any CPU
-               {28BAF8B8-6A6E-40D5-8E9C-E7C1165C59DD}.Debug|x86.Build.0 = Debug|Any CPU
                {28BAF8B8-6A6E-40D5-8E9C-E7C1165C59DD}.Release|Any CPU.ActiveCfg = Release|Any CPU
+               {28BAF8B8-6A6E-40D5-8E9C-E7C1165C59DD}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {28BAF8B8-6A6E-40D5-8E9C-E7C1165C59DD}.Release|Any CPU.Build.0 = Release|Any CPU
-               {28BAF8B8-6A6E-40D5-8E9C-E7C1165C59DD}.Release|x64.ActiveCfg = Release|Any CPU
-               {28BAF8B8-6A6E-40D5-8E9C-E7C1165C59DD}.Release|x64.Build.0 = Release|Any CPU
-               {28BAF8B8-6A6E-40D5-8E9C-E7C1165C59DD}.Release|x86.ActiveCfg = Release|Any CPU
-               {28BAF8B8-6A6E-40D5-8E9C-E7C1165C59DD}.Release|x86.Build.0 = Release|Any CPU
                {A01B3151-BC81-437C-B526-CC8DBB808638}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-               {A01B3151-BC81-437C-B526-CC8DBB808638}.Debug|Any CPU.Build.0 = Debug|Any CPU
-               {A01B3151-BC81-437C-B526-CC8DBB808638}.Debug|x64.ActiveCfg = Debug|Any CPU
-               {A01B3151-BC81-437C-B526-CC8DBB808638}.Debug|x64.Build.0 = Debug|Any CPU
-               {A01B3151-BC81-437C-B526-CC8DBB808638}.Debug|x86.ActiveCfg = Debug|Any CPU
-               {A01B3151-BC81-437C-B526-CC8DBB808638}.Debug|x86.Build.0 = Debug|Any CPU
                {A01B3151-BC81-437C-B526-CC8DBB808638}.Release|Any CPU.ActiveCfg = Release|Any CPU
+               {A01B3151-BC81-437C-B526-CC8DBB808638}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {A01B3151-BC81-437C-B526-CC8DBB808638}.Release|Any CPU.Build.0 = Release|Any CPU
-               {A01B3151-BC81-437C-B526-CC8DBB808638}.Release|x64.ActiveCfg = Release|Any CPU
-               {A01B3151-BC81-437C-B526-CC8DBB808638}.Release|x64.Build.0 = Release|Any CPU
-               {A01B3151-BC81-437C-B526-CC8DBB808638}.Release|x86.ActiveCfg = Release|Any CPU
-               {A01B3151-BC81-437C-B526-CC8DBB808638}.Release|x86.Build.0 = Release|Any CPU
        EndGlobalSection
 EndGlobal
index a992af3454c542766c959b3fac853d119990c68c..68347c39583abba827b3ac2cd42573fe23c9e385 100644 (file)
--- a/Crow.sln
+++ b/Crow.sln
@@ -30,22 +30,30 @@ Global
                Policies = $0
                $0.StandardHeader = $1
                $1.Text = @\n${FileName}\n \nAuthor:\n      ${AuthorName} <${AuthorEmail}>\n\nCopyright (c) 2013-2017 Jean-Philippe Bruyère\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the "Software"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.
-               $1.IncludeInNewFiles = True
                $0.DotNetNamingPolicy = $2
-               $2.DirectoryNamespaceAssociation = None
-               $2.ResourceNamePolicy = FileFormatDefault
                $0.TextStylePolicy = $3
-               $3.FileWidth = 120
-               $3.TabsToSpaces = False
                $3.EolMarker = Unix
-               $3.inheritsSet = VisualStudio
-               $3.inheritsScope = text/plain
                $3.scope = text/x-csharp
                $0.CSharpFormattingPolicy = $4
                $4.AfterDelegateDeclarationParameterComma = True
-               $4.inheritsSet = Mono
-               $4.inheritsScope = text/x-csharp
                $4.scope = text/x-csharp
+               $4.IndentSwitchSection = False
+               $4.NewLinesForBracesInProperties = False
+               $4.NewLinesForBracesInAccessors = False
+               $4.NewLinesForBracesInAnonymousMethods = False
+               $4.NewLinesForBracesInControlBlocks = False
+               $4.NewLinesForBracesInAnonymousTypes = False
+               $4.NewLinesForBracesInObjectCollectionArrayInitializers = False
+               $4.NewLinesForBracesInLambdaExpressionBody = False
+               $4.NewLineForElse = False
+               $4.NewLineForCatch = False
+               $4.NewLineForFinally = False
+               $4.NewLineForMembersInObjectInit = False
+               $4.NewLineForMembersInAnonymousTypes = False
+               $4.NewLineForClausesInQuery = False
+               $4.SpacingAfterMethodDeclarationName = True
+               $4.SpaceAfterMethodCallName = True
+               $4.SpaceBeforeOpenSquareBracket = True
                $0.VersionControlPolicy = $5
                $5.CommitMessageStyle = $6
                $6.Indent = @\t
index 656c9da9d176b82ad07540d091deecb0ecf9765f..ade2082cd10d898db395a86d5931c7196ca54df9 100644 (file)
@@ -62,7 +62,6 @@
   <Target Name="AfterBuild">
   </Target>
   -->
-  <ItemGroup />
   <ItemGroup>
     <Folder Include="src\GraphicObjects\" />
     <Folder Include="src\Cairo\" />
     <None Include="Crow.dll.config">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
+    <EmbeddedResource Include="Images\Icons\Cursors\arrow" />
+    <EmbeddedResource Include="Images\Icons\Cursors\bottom_left_corner" />
+    <EmbeddedResource Include="Images\Icons\Cursors\bottom_right_corner" />
+    <EmbeddedResource Include="Images\Icons\Cursors\cross" />
+    <EmbeddedResource Include="Images\Icons\Cursors\hand" />
+    <EmbeddedResource Include="Images\Icons\Cursors\help" />
+    <EmbeddedResource Include="Images\Icons\Cursors\move" />
+    <EmbeddedResource Include="Images\Icons\Cursors\sb_h_double_arrow" />
+    <EmbeddedResource Include="Images\Icons\Cursors\sb_v_double_arrow" />
+    <EmbeddedResource Include="Images\Icons\Cursors\top_left_corner" />
+    <EmbeddedResource Include="Images\Icons\Cursors\top_right_corner" />
   </ItemGroup>
 </Project>
index 5112fb12d99e650259269ae06181ae26822f0c8c..ceb09c1a89b89de5f8fc97cf2f433c80e9801e18 100644 (file)
@@ -33,12 +33,23 @@ using System.Collections.Generic;
 using System.Runtime.CompilerServices;
 using System.Xml;
 using Crow.IML;
-
+using System.Text;
 
 namespace Crow.IML
 {
        public static class CompilerServices
        {
+               /// <summary>
+               /// known types cache, prevent rewalking all the assemblies of the domain
+               /// the key is the type simple name
+               /// </summary>
+               internal static Dictionary<string, Type> knownTypes = new Dictionary<string, Type> ();
+               /// <summary>
+               /// known extension methods.
+               /// key is type dot memberName.
+               /// </summary>
+               internal static Dictionary<string, MethodInfo> knownExtMethods = new Dictionary<string, MethodInfo> ();
+
                internal static Type TObject = typeof(object);
                internal static MethodInfo stringEquals = typeof (string).GetMethod("Equals", new Type [3] { typeof (string), typeof (string), typeof (StringComparison) });
                internal static MethodInfo miObjToString = typeof(object).GetMethod("ToString");
@@ -405,20 +416,57 @@ namespace Crow.IML
                        return query;
                }
                /// <summary>
-               /// search for extentions method in entry assembly then in crow assembly
+               /// search for extentions method in entry assembly then in assembly where the type is defined
                /// </summary>
                /// <returns>Extention MethodInfo</returns>
                /// <param name="t">Extended type</param>
                /// <param name="methodName">Extention method name</param>
-               internal static MethodInfo SearchExtMethod(Type t, string methodName){
+               //internal static MethodInfo SearchExtMethod(Type t, string methodName){
+               //      MethodInfo mi = null;
+               //      mi = GetExtensionMethods (Assembly.GetEntryAssembly(), t)
+               //              .Where (em => em.Name == methodName).FirstOrDefault ();
+               //      if (mi != null)
+               //              return mi;
+
+               //      return GetExtensionMethods (t.Module.Assembly, t)
+               //              .Where (em => em.Name == methodName).FirstOrDefault ();
+               //}
+               internal static MethodInfo SearchExtMethod (Type t, string methodName)
+               {
+                       string key = t.Name + "." + methodName;
+                       if (knownExtMethods.ContainsKey (key))
+                               return knownExtMethods [key];
+
+                       //Console.WriteLine ($"*** search extension method: {t};{methodName} => key={key}");
+
                        MethodInfo mi = null;
-                       mi = GetExtensionMethods (Assembly.GetEntryAssembly(), t)
-                               .Where (em => em.Name == methodName).FirstOrDefault ();
-                       if (mi != null)
-                               return mi;
+                       mi = GetExtensionMethods2 (Assembly.GetEntryAssembly (), t, methodName);
+                       if (mi == null)
+                               mi = GetExtensionMethods2 (t.Module.Assembly, t, methodName);
 
-                       return GetExtensionMethods (Assembly.GetExecutingAssembly(), t)
-                               .Where (em => em.Name == methodName).FirstOrDefault ();
+                       //add key even if mi is null to prevent searching again and again for propertyless bindings
+                       knownExtMethods.Add (key, mi);
+                       return mi;
+               }
+
+               static MethodInfo GetExtensionMethods2 (Assembly assembly, Type extendedType, string methodName)
+               {
+                       foreach (Type t in assembly.GetTypes ().Where
+                                       (ty => ty.IsDefined (typeof (ExtensionAttribute), false))) {
+                               foreach (MethodInfo mi in t.GetMethods 
+                                       (BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic).Where
+                                               (m=> m.Name == methodName && m.IsDefined (typeof (ExtensionAttribute), false) &&
+                                                m.GetParameters ().Length == 1)) {
+                                       Type curType = extendedType;
+                                       while (curType != null) {
+                                               if (mi.GetParameters () [0].ParameterType == curType)
+                                                       return mi;
+                                               curType = curType.BaseType;
+                                       }                                               
+                               }
+                       
+                       }
+                       return null;
                }
                /// <summary>
                /// retrieve event handler in class or ancestors
@@ -893,20 +941,32 @@ namespace Crow.IML
                /// </summary>
                /// <returns>the corresponding type object if found</returns>
                /// <param name="strDataType">type name</param>
-               internal static Type tryGetType (string strDataType){
+               internal static Type getTypeFromName (string strDataType){
+                       if (knownTypes.ContainsKey (strDataType))
+                               return knownTypes [strDataType];
                        Type dataType = Type.GetType(strDataType);
-                       if (dataType != null)
+                       if (dataType != null) {
+                               knownTypes.Add (strDataType, dataType);
                                return dataType;
-                       Assembly a = Assembly.GetEntryAssembly ();
-                       foreach (Type expT in a.GetExportedTypes ()) {
-                               if (expT.Name == strDataType)
-                                       return dataType;
                        }
+                       foreach (Assembly a in AppDomain.CurrentDomain.GetAssemblies ()) {
+                               if (a.IsDynamic)
+                                       continue;
+                               foreach (Type expT in a.GetExportedTypes ()) {
+                                       if (expT.Name != strDataType)
+                                               continue;
+                                       knownTypes.Add (strDataType, expT);
+                                       return expT;
+                               }
+                       }
+                       knownTypes.Add (strDataType, null);
                        return null;
                }
 
+               //get value from member of object
                internal static object getDataTypeAndFetch (object data, string fetchMethod){
                        Type dataType = data.GetType();
+                       //Console.WriteLine ($"get data type and fetch {data}.{fetchMethod}");
                        MethodInfo miGetDatas = dataType.GetMethod (fetchMethod, new Type[] {});
                        if (miGetDatas == null)
                                miGetDatas = CompilerServices.SearchExtMethod (dataType, fetchMethod);
@@ -923,8 +983,36 @@ namespace Crow.IML
                                if (miGetDatas == null)
                                        throw new Exception ("Read only property for fetching data in ItemTemplate: " + fetchMethod);
                        }
-                       object tmp = miGetDatas.Invoke (data, null);
-                       return tmp;
+                       return miGetDatas.IsStatic ?
+                               miGetDatas.Invoke (null, new object [] { data }) : miGetDatas.Invoke (data, null);
+               }
+               //TODO:memberinfo found here must be cached
+               internal static object getValue (Type dataType, object data, string member)
+               {
+                       //Console.WriteLine ($"get value: {dataType} ; {data} ; {member}");
+
+                       MethodInfo miGetDatas = dataType.GetMethod (member, new Type [] { });
+                       if (miGetDatas != null)
+                               return miGetDatas.Invoke (data, null);
+                       MemberInfo mbi = dataType.GetMember (member).FirstOrDefault ();
+                       if (mbi == null) {
+                               MethodInfo miExt = CompilerServices.SearchExtMethod (dataType, member);
+                               if (miExt == null)//and among fields
+                                       throw new Exception ($"member {member} not found in {dataType}");
+                               return miExt.Invoke (null, new object [] { data });
+                       }
+                       if (mbi.MemberType == MemberTypes.Property) {
+                               miGetDatas = (mbi as PropertyInfo)?.GetGetMethod ();
+                               if (miGetDatas == null)
+                                       throw new Exception ($"no getter found for property {member} in {dataType}");
+                               return miGetDatas.Invoke (data, null);
+                       }
+
+                       FieldInfo fi = mbi as FieldInfo;
+                       if (fi == null)
+                               throw new Exception ($"member {member} not found in {dataType}");
+
+                       return fi.GetValue (data);
                }
        }
 }
index fb4f6393adb2190d862db75372b9e3203531ae5f..b43ae54a9a4e647095d01c290f9cd305936cc90e 100644 (file)
@@ -149,7 +149,10 @@ namespace Crow
                                }
                        }
                        return di;
-               }                       
+               }
+        public string DesignName {
+            get { return GetType ().Name + design_id; }
+        }
                #endif
 
                #region IDisposable implementation
index dd9afb6c65f365d5f42a61bd8eb4222ca9fd2689..29056a5086a0902f4fcd55841c51ed7251f4c6d6 100644 (file)
@@ -411,13 +411,7 @@ namespace Crow
                        loadingTime.ElapsedMilliseconds, this.ToString());
                        #endif
                }
-               string getItempKey(Type dataType, object o, string propertyName){
-                       try {
-                               return dataType.GetProperty (propertyName).GetGetMethod ().Invoke (o, null)?.ToString();
-                       } catch  {
-                               return dataType.FullName;
-                       }
-               }
+
                protected void loadItem(object o, Group page, string _dataTest){
                        if (o == null)//TODO:surely a threading sync problem
                                return;
@@ -426,14 +420,23 @@ namespace Crow
                        Type dataType = o.GetType ();
                        string itempKey = dataType.FullName;
 
-                       if (_dataTest != "TypeOf")
-                               itempKey = getItempKey (dataType, o, _dataTest);
+                       //if item template selection is not done depending on the type of item
+                       //dataTest must contains a member name of the item 
+                       if (_dataTest != "TypeOf") {
+                               try {
+                                       itempKey = CompilerServices.getValue (dataType, o, _dataTest)?.ToString ();
+                               } catch {
+                                       itempKey = dataType.FullName;
+                               }
+                       }
 
                        if (ItemTemplates.ContainsKey (itempKey))
                                iTemp = ItemTemplates [itempKey];
                        else {
                                foreach (string it in ItemTemplates.Keys) {
-                                       Type t = CompilerServices.tryGetType (it);
+                                       if (it == "default")
+                                               continue;
+                                       Type t = CompilerServices.getTypeFromName (it);
                                        if (t == null)
                                                continue;
                                        if (t.IsAssignableFrom (dataType)) {//TODO:types could be cached
index 4f9ee733c5ca7c2d429ff5c59aeb607e2b28a72a..f42d1f130083d943db4e0e309c1bf59a3aaa08fc 100644 (file)
@@ -68,6 +68,8 @@ namespace Crow.IML
                }
                #endregion
 
+               internal static Dictionary<string, Type> knownGOTypes = new Dictionary<string, Type> ();
+
                public Type RootType;
                InstanciatorInvoker loader;
                protected Interface iface;
@@ -1183,15 +1185,21 @@ namespace Crow.IML
                /// <returns>the corresponding type object</returns>
                /// <param name="typeName">graphic object type name without its namespace</param>
                Type tryGetGOType (string typeName){
+                       if (knownGOTypes.ContainsKey (typeName))
+                               return knownGOTypes [typeName];
                        Type t = Type.GetType ("Crow." + typeName);
-                       if (t != null)
-                               return t;                       
+                       if (t != null) {
+                               knownGOTypes.Add (typeName, t);
+                               return t;
+                       }                       
                        foreach (Assembly a in AppDomain.CurrentDomain.GetAssemblies()) {
                                if (a.IsDynamic)
                                        continue;
                                foreach (Type expT in a.GetExportedTypes ()) {
-                                       if (expT.Name == typeName)
-                                               return expT;
+                                       if (expT.Name != typeName)
+                                               continue;
+                                       knownGOTypes.Add (typeName, expT);
+                                       return expT;
                                }
                        }
                        return null;
index 1dfcfee2168818abd556157c00cfd1b006e12d61..f53a2769ddb279b7c3b1a925b2cc511d7f65dab0 100644 (file)
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.IO;
 using System.Linq;
 using System.Reflection;
 using System.Threading;
@@ -37,7 +33,10 @@ using Cairo;
 using System.Globalization;
 using Crow.IML;
 using System.Runtime.InteropServices;
-
+using System;
+using System.IO;
+using System.Diagnostics;
+using System.Collections.Generic;
 
 
 namespace Crow
@@ -412,18 +411,7 @@ namespace Crow
 
                        }
                }
-               void loadCursors(){
-                       //Load cursors
-                       XCursor.Cross = XCursorFile.Load(this, "#Crow.Images.Icons.Cursors.cross").Cursors[0];
-                       XCursor.Default = XCursorFile.Load(this, "#Crow.Images.Icons.Cursors.arrow").Cursors[0];
-                       XCursor.NW = XCursorFile.Load(this, "#Crow.Images.Icons.Cursors.top_left_corner").Cursors[0];
-                       XCursor.NE = XCursorFile.Load(this, "#Crow.Images.Icons.Cursors.top_right_corner").Cursors[0];
-                       XCursor.SW = XCursorFile.Load(this, "#Crow.Images.Icons.Cursors.bottom_left_corner").Cursors[0];
-                       XCursor.SE = XCursorFile.Load(this, "#Crow.Images.Icons.Cursors.bottom_right_corner").Cursors[0];
-                       XCursor.H = XCursorFile.Load(this, "#Crow.Images.Icons.Cursors.sb_h_double_arrow").Cursors[0];
-                       XCursor.V = XCursorFile.Load(this, "#Crow.Images.Icons.Cursors.sb_v_double_arrow").Cursors[0];
-                       XCursor.Text = XCursorFile.Load(this, "#Crow.Images.Icons.Cursors.ibeam").Cursors[0];
-               }
+
                #endregion
 
                #region Templates
@@ -499,10 +487,10 @@ namespace Crow
                                string resId = path.Substring (1);
                                //try/catch added to prevent nunit error
                                try {
-                                       stream = System.Reflection.Assembly.GetEntryAssembly ().GetManifestResourceStream (resId);
+                                       stream = Assembly.GetEntryAssembly ().GetManifestResourceStream (resId);
                                } catch{}
                                if (stream == null)//try to find ressource in Crow assembly
-                                       stream = System.Reflection.Assembly.GetExecutingAssembly ().GetManifestResourceStream (resId);
+                                       stream = Assembly.GetExecutingAssembly ().GetManifestResourceStream (resId);
                 if (stream == null)                
                     throw new Exception("Resource not found: " + path);
 
index 05d7c268e96855a2e91e7f3c4e2385f529647b89..e42c7540af666b1743006151776d5715f3e70bf0 100644 (file)
@@ -143,19 +143,10 @@ namespace Crow
                /// </summary>
                /// <param name="host">Host.</param>
                public void CreateExpandDelegate (TemplatedGroup host){
-                       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 dataType = CompilerServices.getTypeFromName(strDataType);
                        Type tmpGrpType = typeof(TemplatedGroup);
                        Type evtType = typeof(EventHandler);
 
-                       //PropertyInfo piData = tmpGrpType.GetProperty ("Data");
-
                        MethodInfo evtInvoke = evtType.GetMethod ("Invoke");
                        ParameterInfo [] evtParams = evtInvoke.GetParameters ();
                        Type handlerArgsType = evtParams [1].ParameterType;
@@ -195,28 +186,11 @@ namespace Crow
                        il.Emit (OpCodes.Ldarg_1);
                        il.Emit (OpCodes.Call, CompilerServices.miIsAlreadyExpanded);
                        il.Emit (OpCodes.Brtrue, gotoEnd);
-//                     il.Emit (OpCodes.Ldloc_0);
-//                     il.Emit (OpCodes.Callvirt, piData.GetGetMethod ());
-//                     il.Emit (OpCodes.Brfalse, ifDataIsNull);
-//                     il.Emit (OpCodes.Br, gotoEnd);
-
-//                     il.MarkLabel(ifDataIsNull);
-
-                       //copy the ref of ItemTemplates list TODO: maybe find another way to share it among the nodes?
-//                     FieldInfo fiTemplates = tmpGrpType.GetField("ItemTemplates");
-//                     il.Emit (OpCodes.Ldloc_0);
-//                     il.Emit (OpCodes.Ldarg_0);
-//                     il.Emit (OpCodes.Ldfld, fiTemplates);
-//                     il.Emit (OpCodes.Stfld, fiTemplates);
-
-                       //call 'fetchMethodName' from the dataSource to build the sub nodes list
-                       //il.Emit (OpCodes.Ldarg_0);//load root templatedGroop
 
+                       //get the dataSource of the sender
                        il.Emit (OpCodes.Ldarg_0);//push root TemplatedGroup into the stack
                        il.Emit (OpCodes.Ldarg_1);//load sender node of expand
-                       il.Emit (OpCodes.Callvirt, CompilerServices.miGetDataSource);//get the dataSource of the sender
-
-
+                       il.Emit (OpCodes.Callvirt, CompilerServices.miGetDataSource);
 
                        if (fetchMethodName != "self") {//special keyword self allows the use of recurent list<<<
                                if (dataType == null) {
@@ -292,9 +266,11 @@ namespace Crow
                                if (miGetDatas == null)
                                        throw new Exception ("Write only property for fetching data in ItemTemplate: " + fetchMethodName);
                        }
-
-                       il.Emit (OpCodes.Callvirt, miGetDatas);
-               }
+            if (miGetDatas.IsStatic)
+                           il.Emit (OpCodes.Call, miGetDatas);
+            else
+                il.Emit (OpCodes.Callvirt, miGetDatas);
+        }
 
        
        
diff --git a/Crow/src/XCursor.cs b/Crow/src/XCursor.cs
deleted file mode 100644 (file)
index 1cca510..0000000
+++ /dev/null
@@ -1,151 +0,0 @@
-//
-// XCursor.cs
-//
-// Author:
-//       Jean-Philippe Bruyère <jp.bruyere@hotmail.com>
-//
-// Copyright (c) 2013-2017 Jean-Philippe Bruyère
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-using System;
-using System.IO;
-using System.Diagnostics;
-using System.Collections.Generic;
-
-namespace Crow
-{
-       public class XCursorFile
-       {
-               const uint XC_TYPE_IMG = 0xfffd0002;
-
-               class toc
-               {
-                       public uint type;
-                       public uint subtype;
-                       public uint pos;
-
-                       public toc(BinaryReader sr)
-                       {
-                               type = sr.ReadUInt32();
-                               subtype = sr.ReadUInt32();
-                               pos = sr.ReadUInt32();
-                       }
-               }
-
-               public List<XCursor> Cursors = new List<XCursor>();
-
-
-               static XCursorFile loadFromStream(Stream s)
-               {
-                       List<toc> tocList = new List<toc> ();
-                       XCursorFile tmp = new XCursorFile ();
-
-                       using (BinaryReader sr = new BinaryReader (s)) {
-                               byte[] data;
-                               //magic: CARD32 ’Xcur’ (0x58, 0x63, 0x75, 0x72)
-                               if (new string (sr.ReadChars (4)) != "Xcur") {
-                                       Debug.WriteLine ("XCursor Load error: Wrong magic");
-                                       return null;
-                               }
-                               //header: CARD32 bytes in this header
-                               uint headerLength = sr.ReadUInt32 ();
-                               //version: CARD32 file version number
-                               uint version = sr.ReadUInt32 ();
-                               //ntoc: CARD32 number of toc entries
-                               uint nbToc = sr.ReadUInt32 ();
-                               //toc: LISTofTOC table of contents
-                               for (uint i = 0; i < nbToc; i++) {
-                                       tocList.Add (new toc (sr));
-                               }
-
-                               foreach (toc t in tocList) {
-                                       if (t.type != XC_TYPE_IMG)
-                                               continue;
-
-                                       sr.BaseStream.Seek (t.pos, SeekOrigin.Begin);
-                                       tmp.Cursors.Add(imageLoad (sr));                                                
-                               }
-                       }
-                       return tmp;
-               }
-
-               public static XCursorFile Load(Interface iface, string path)
-               {
-                       return loadFromStream (iface.GetStreamFromPath (path));
-               }
-
-               static XCursor imageLoad(BinaryReader sr)
-               {
-                       XCursor tmp = new XCursor();
-                       //                      header: 36 Image headers are 36 bytes
-                       uint header = sr.ReadUInt32();
-                       //                      type: 0xfffd0002 Image type is 0xfffd0002
-                       uint type = sr.ReadUInt32();
-                       //                      subtype: CARD32 Image subtype is the nominal size
-                       uint subtype = sr.ReadUInt32();
-                       //                      version: 1
-                       uint version = sr.ReadUInt32();
-                       //                      width: CARD32 Must be less than or equal to 0x7fff
-                       tmp.Width = sr.ReadUInt32();
-                       //                      height: CARD32 Must be less than or equal to 0x7fff
-                       tmp.Height = sr.ReadUInt32();
-                       //                      xhot: CARD32 Must be less than or equal to width
-                       tmp.Xhot = sr.ReadUInt32();
-                       //                      yhot: CARD32 Must be less than or equal to height
-                       tmp.Yhot = sr.ReadUInt32();
-                       //                      delay: CARD32 Delay between animation frames in milliseconds
-                       tmp.Delay = sr.ReadUInt32();
-                       //                      pixels: LISTofCARD32 Packed ARGB format pixels
-                       tmp.data = sr.ReadBytes((int)(tmp.Width * tmp.Height * 4));
-                       return tmp;
-               }
-       }
-       public class XCursor
-       {
-               public static XCursor Default;
-               public static XCursor Cross;
-               public static XCursor Arrow;
-               public static XCursor Text;
-               public static XCursor SW;
-               public static XCursor SE;
-               public static XCursor NW;
-               public static XCursor NE;
-               public static XCursor N;
-               public static XCursor S;
-               public static XCursor V;
-               public static XCursor H;
-
-               public uint Width;
-               public uint Height;
-               public uint Xhot;
-               public uint Yhot;
-               public uint Delay;
-               public byte[] data;
-
-               public XCursor ()
-               {
-               }
-//             public static implicit operator MouseCursor(XCursor xc)
-//             {
-//                     return new MouseCursor((int)xc.Xhot, (int)xc.Yhot, (int)xc.Width, (int)xc.Height,xc.data);
-//             }
-       }
-}
-
index a3ccab91466f18ab10a3f4a7eb40b76d4c219e2f..b4199968d5f4868ec68bdb354f59e448bbf86c60 100644 (file)
@@ -414,8 +414,9 @@ namespace Crow.XCB
                        xcb_flush (conn);
 
 
-                       IntPtr visual = findVisual (scr_it, scr.root_visual);   
+                       IntPtr visual = findVisual (scr_it, scr.root_visual);
 
+                       //loadCursors ();       
 
                        iFace.surf = new Cairo.XcbSurface (conn, win, visual, iFace.ClientRectangle.Width, iFace.ClientRectangle.Height);
                }
@@ -483,6 +484,20 @@ namespace Crow.XCB
                }
                #endregion
 
+               void loadCursors ()
+               {
+                       //Load cursors
+                       XCursor.Cross = XCursorFile.Load (iFace, "#Crow.Images.Icons.Cursors.cross").Cursors [0];
+                       XCursor.Default = XCursorFile.Load (iFace, "#Crow.Images.Icons.Cursors.arrow").Cursors [0];
+                       XCursor.NW = XCursorFile.Load (iFace, "#Crow.Images.Icons.Cursors.top_left_corner").Cursors [0];
+                       XCursor.NE = XCursorFile.Load (iFace, "#Crow.Images.Icons.Cursors.top_right_corner").Cursors [0];
+                       XCursor.SW = XCursorFile.Load (iFace, "#Crow.Images.Icons.Cursors.bottom_left_corner").Cursors [0];
+                       XCursor.SE = XCursorFile.Load (iFace, "#Crow.Images.Icons.Cursors.bottom_right_corner").Cursors [0];
+                       XCursor.H = XCursorFile.Load (iFace, "#Crow.Images.Icons.Cursors.sb_h_double_arrow").Cursors [0];
+                       XCursor.V = XCursorFile.Load (iFace, "#Crow.Images.Icons.Cursors.sb_v_double_arrow").Cursors [0];
+                       XCursor.Text = XCursorFile.Load (iFace, "#Crow.Images.Icons.Cursors.ibeam").Cursors [0];
+               }
+
                static IntPtr findVisual (xcb_iterator_t scr_it, xcb_visualid_t visualId){
                        for (; scr_it.rem > 0; xcb_screen_next (ref scr_it)) {
                                xcb_iterator_t depth_it = xcb_screen_allowed_depths_iterator (scr_it.data);
diff --git a/Crow/src/backends/xcb/XCursor.cs b/Crow/src/backends/xcb/XCursor.cs
new file mode 100644 (file)
index 0000000..1cca510
--- /dev/null
@@ -0,0 +1,151 @@
+//
+// XCursor.cs
+//
+// Author:
+//       Jean-Philippe Bruyère <jp.bruyere@hotmail.com>
+//
+// Copyright (c) 2013-2017 Jean-Philippe Bruyère
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.IO;
+using System.Diagnostics;
+using System.Collections.Generic;
+
+namespace Crow
+{
+       public class XCursorFile
+       {
+               const uint XC_TYPE_IMG = 0xfffd0002;
+
+               class toc
+               {
+                       public uint type;
+                       public uint subtype;
+                       public uint pos;
+
+                       public toc(BinaryReader sr)
+                       {
+                               type = sr.ReadUInt32();
+                               subtype = sr.ReadUInt32();
+                               pos = sr.ReadUInt32();
+                       }
+               }
+
+               public List<XCursor> Cursors = new List<XCursor>();
+
+
+               static XCursorFile loadFromStream(Stream s)
+               {
+                       List<toc> tocList = new List<toc> ();
+                       XCursorFile tmp = new XCursorFile ();
+
+                       using (BinaryReader sr = new BinaryReader (s)) {
+                               byte[] data;
+                               //magic: CARD32 ’Xcur’ (0x58, 0x63, 0x75, 0x72)
+                               if (new string (sr.ReadChars (4)) != "Xcur") {
+                                       Debug.WriteLine ("XCursor Load error: Wrong magic");
+                                       return null;
+                               }
+                               //header: CARD32 bytes in this header
+                               uint headerLength = sr.ReadUInt32 ();
+                               //version: CARD32 file version number
+                               uint version = sr.ReadUInt32 ();
+                               //ntoc: CARD32 number of toc entries
+                               uint nbToc = sr.ReadUInt32 ();
+                               //toc: LISTofTOC table of contents
+                               for (uint i = 0; i < nbToc; i++) {
+                                       tocList.Add (new toc (sr));
+                               }
+
+                               foreach (toc t in tocList) {
+                                       if (t.type != XC_TYPE_IMG)
+                                               continue;
+
+                                       sr.BaseStream.Seek (t.pos, SeekOrigin.Begin);
+                                       tmp.Cursors.Add(imageLoad (sr));                                                
+                               }
+                       }
+                       return tmp;
+               }
+
+               public static XCursorFile Load(Interface iface, string path)
+               {
+                       return loadFromStream (iface.GetStreamFromPath (path));
+               }
+
+               static XCursor imageLoad(BinaryReader sr)
+               {
+                       XCursor tmp = new XCursor();
+                       //                      header: 36 Image headers are 36 bytes
+                       uint header = sr.ReadUInt32();
+                       //                      type: 0xfffd0002 Image type is 0xfffd0002
+                       uint type = sr.ReadUInt32();
+                       //                      subtype: CARD32 Image subtype is the nominal size
+                       uint subtype = sr.ReadUInt32();
+                       //                      version: 1
+                       uint version = sr.ReadUInt32();
+                       //                      width: CARD32 Must be less than or equal to 0x7fff
+                       tmp.Width = sr.ReadUInt32();
+                       //                      height: CARD32 Must be less than or equal to 0x7fff
+                       tmp.Height = sr.ReadUInt32();
+                       //                      xhot: CARD32 Must be less than or equal to width
+                       tmp.Xhot = sr.ReadUInt32();
+                       //                      yhot: CARD32 Must be less than or equal to height
+                       tmp.Yhot = sr.ReadUInt32();
+                       //                      delay: CARD32 Delay between animation frames in milliseconds
+                       tmp.Delay = sr.ReadUInt32();
+                       //                      pixels: LISTofCARD32 Packed ARGB format pixels
+                       tmp.data = sr.ReadBytes((int)(tmp.Width * tmp.Height * 4));
+                       return tmp;
+               }
+       }
+       public class XCursor
+       {
+               public static XCursor Default;
+               public static XCursor Cross;
+               public static XCursor Arrow;
+               public static XCursor Text;
+               public static XCursor SW;
+               public static XCursor SE;
+               public static XCursor NW;
+               public static XCursor NE;
+               public static XCursor N;
+               public static XCursor S;
+               public static XCursor V;
+               public static XCursor H;
+
+               public uint Width;
+               public uint Height;
+               public uint Xhot;
+               public uint Yhot;
+               public uint Delay;
+               public byte[] data;
+
+               public XCursor ()
+               {
+               }
+//             public static implicit operator MouseCursor(XCursor xc)
+//             {
+//                     return new MouseCursor((int)xc.Xhot, (int)xc.Yhot, (int)xc.Width, (int)xc.Height,xc.data);
+//             }
+       }
+}
+
index 22e65166f8d6de1876b7b38ca3ba0f2796ec5da1..0872a62d5411b80b3f3f52f1616a115351403578 100644 (file)
     <EmbeddedResource Remove="icons\blank-file2.svg" />
   </ItemGroup>
   <ItemGroup>
+
     <PackageReference Include="System.CodeDom" Version="4.5.0" />
+<!--<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="2.10.0" />-->
         
-    <Compile Include="src\**\*.cs" />  
+    <Compile Include="src\**\*.cs" Exclude="src\ProjectTree\CSProjectFile.cs" />  
         
     <ProjectReference Include="..\Crow\Crow.NetStd.csproj" />
         
@@ -45,7 +47,6 @@
     </EmbeddedResource>
         
     <EmbeddedResource Include="IDE.style" />
-    <PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="2.10.0" />
   </ItemGroup>
     
   <ItemGroup>
index ee755f6cde7ee63e7d12e378d43476715a4273bb..59b33cee9f608a38506acde8e486c05158682bc4 100644 (file)
     <AssemblyName>CrowIDE</AssemblyName>
     <OutputPath>$(SolutionDir)build/$(Configuration)</OutputPath>
     <IntermediateOutputPath>$(SolutionDir)build/obj/$(Configuration)</IntermediateOutputPath>
-    <CustomCommands>
-      <CustomCommands>
-        <Command type="Execute" command="${TargetName}" workingdir="${SolutionDir}/build/${ProjectConfigName}" />
-      </CustomCommands>
-    </CustomCommands>
     <ReleaseVersion>0.8.0</ReleaseVersion>
     <StartupObject>Crow.Coding.CrowIDE</StartupObject>
-    <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <DebugSymbols>true</DebugSymbols>
     <IntermediateOutputPath>$(SolutionDir)build\obj\$(Configuration)</IntermediateOutputPath>
     <OutputPath>$(SolutionDir)build\$(Configuration)</OutputPath>
   </PropertyGroup>
-  <PropertyGroup Condition=" '$(RunConfiguration)' == 'Default' ">
-    <StartAction>Program</StartAction>
-    <StartProgram>%24{TargetName}</StartProgram>
-    <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>
-  <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" />
     </ProjectReference>
   </ItemGroup>
   <ItemGroup>
-    <Compile Include="src\CrowIDE.cs" />
-    <Compile Include="src\Extensions.cs" />
-    <Compile Include="src\Solution.cs" />
-    <Compile Include="src\Project.cs" />
-    <Compile Include="src\VerticalLine.cs" />
-    <Compile Include="src\DesignInterface.cs" />
-    <Compile Include="src\SolutionControler.cs" />
-    <Compile Include="src\INetProject.cs" />
-    <Compile Include="src\MemberView\MembersView.cs" />
-    <Compile Include="src\MemberView\PropertyContainer.cs" />
-    <Compile Include="src\MemberView\CategoryContainer.cs" />
-    <Compile Include="src\GraphicObjectDesignContainer.cs" />
-    <Compile Include="src\Editors\Editor.cs" />
-    <Compile Include="src\Editors\EditPane.cs" />
-    <Compile Include="src\Editors\ImlVisualEditor.cs" />
-    <Compile Include="src\Editors\SvgEditor.cs" />
-    <Compile Include="src\Editors\Parsers\BufferParser.cs" />
-    <Compile Include="src\Editors\Parsers\CSharpParser.cs" />
-    <Compile Include="src\Editors\Parsers\StyleParser.cs" />
-    <Compile Include="src\Editors\Parsers\XMLParser.cs" />
-    <Compile Include="src\Editors\CodeBuffer\CodeBuffer.cs" />
-    <Compile Include="src\Editors\CodeBuffer\CodeBufferEventArgs.cs" />
-    <Compile Include="src\Editors\CodeBuffer\CodeLine.cs" />
-    <Compile Include="src\Editors\CodeBuffer\Node.cs" />
-    <Compile Include="src\Editors\CodeBuffer\TextFormatting.cs" />
-    <Compile Include="src\Editors\CodeBuffer\Token.cs" />
-    <Compile Include="src\ProjectTree\ProjectNodes.cs" />
-    <Compile Include="src\ProjectTree\ProjectItem.cs" />
-    <Compile Include="src\ProjectTree\ProjectReference.cs" />
-    <Compile Include="src\ProjectTree\ProjectFile.cs" />
-    <Compile Include="src\ProjectTree\ImlProjectItem.cs" />
-    <Compile Include="src\Editors\CodeBuffer\TextBuffer.cs" />
-    <Compile Include="src\Editors\CodeBuffer\TextEditor.cs" />
-    <Compile Include="src\Editors\ImlSchematicEditor.cs" />
-    <Compile Include="src\Editors\CodeBuffer\TextBufferEventArgs.cs" />
-    <Compile Include="src\Editors\Parsers2\Tokenizer.cs" />
-    <Compile Include="src\Editors\SourceEditor.cs" />
-    <Compile Include="src\ProjectTree\StyleProjectItem.cs" />
+    <Compile Include="src\**\*.cs" Exclude="src\ProjectTree\CSProjectFile.cs" />
   </ItemGroup>
   <ItemGroup>
     <Folder Include="ui\" />
index 9d643a9af748f68743f4ca4094018788bfabd42c..b5752ac0d7bbe6ad1afe074ffe6c69455ced3c94 100644 (file)
@@ -77,8 +77,8 @@ namespace Crow.Coding
                        CMDViewStyling = new Command(new Action(() => loadWindow ("#Crow.Coding.ui.DockWindows.winStyleView.crow",this)))
                        { Caption = "Styling Explorer", CanExecute = true};
                                
-                       CMDViewGTExp = new Command(new Action(() => loadWindow ("#Crow.Coding.ui.DockWindows.winGTExplorer.crow")))
-                       { Caption = "Graphic Tree Explorer", CanExecute = false};
+                       CMDViewGTExp = new Command(new Action(() => loadWindow ("#Crow.Coding.ui.DockWindows.winGTExplorer.crow",this)))
+                       { Caption = "Graphic Tree Explorer", CanExecute = true};
                        CMDCompile = new Command(new Action(() => compileSolution()))
                        { Caption = "Compile", CanExecute = false};
                        CMDViewProjProps = new Command(new Action(loadProjProps))
@@ -157,12 +157,7 @@ namespace Crow.Coding
 
                void initIde() {
 
-            foreach (string s in System.Reflection.Assembly.GetEntryAssembly().GetManifestResourceNames())
-            {
-                Console.WriteLine(s);
-            }
-
-            initCommands ();
+                       initCommands ();
 
                        GraphicObject go = AddWidget (@"#Crow.Coding.ui.CrowIDE.crow");
                        go.DataSource = this;
index 0a6534986c3ed8485536d966f2e113fb0690cec1..407f60b33c20148aeeaf018aea34d13889db4f0e 100644 (file)
@@ -33,484 +33,487 @@ using System.CodeDom.Compiler;
 using Crow;
 using System.Text.RegularExpressions;
 
-namespace Crow.Coding
-{      
-       public class Project: IValueChange
-       {
-               #region IValueChange implementation
-               public event EventHandler<ValueChangeEventArgs> ValueChanged;
-               public virtual void NotifyValueChanged(string MemberName, object _value)
-               {
-                       ValueChanged.Raise(this, new ValueChangeEventArgs(MemberName, _value));
-               }
-               #endregion
-
-               bool isLoaded = false;
-               bool isExpanded;
-               XmlDocument xmlDoc;
-               XmlNode nodeProject;
-               XmlNode nodeProps;
-               XmlNodeList nodesItems;
-               SolutionProject solutionProject;
-               Crow.Command cmdSave, cmdOpen, cmdCompile, cmdSetAsStartProj, cmdNewFile;
-
-               #region CTOR
-               public Project (Solution sol, SolutionProject sp) {
-                       solutionProject = sp;
-
-                       solution = sol;
-
-                       cmdSave = new Crow.Command (new Action (() => Save ()))
-                       { Caption = "Save", Icon = new SvgPicture ("#icons.save.svg"), CanExecute = true };
-                       cmdOpen = new Crow.Command (new Action (() => Load ())) 
-                       { Caption = "Open", Icon = new SvgPicture ("#icons.open.svg"), CanExecute = false };
-                       cmdCompile = new Crow.Command (new Action (() => Compile ())) {
-                               Caption = "Compile",
-                               Icon = "#icons.compile.svg"
-                       };
-                       cmdSetAsStartProj = new Crow.Command (new Action (() => setAsStartupProject ())) {
-                               Caption = "Set as Startup Project"
-                       };
-                       cmdNewFile = new Crow.Command (new Action (() => AddNewFile ())) {
-                               Caption = "Add New File", Icon = new SvgPicture ("#icons.blank-file.svg"), CanExecute = true
-                       };
-
-                       Commands = new List<Crow.Command> (new Crow.Command[] {cmdOpen,cmdSave,cmdSetAsStartProj,cmdCompile,cmdNewFile});
-
-                       Load ();
-               }
-               #endregion
-
-               public Solution solution;
-               public List<Crow.Command> Commands;
-               public CompilerResults CompilationResults;
-               public List<Project> dependantProjects = new List<Project>();
-               public Project ParentProject = null;
-               List<ProjectNode> rootItems;
-               List<ProjectNode> flattenNodes;
-
-               public string Name {
-                       get { return solutionProject.ProjectName; }
-               }
-               public bool IsLoaded {
-                       get { return isLoaded; }
-                       set {
-                               if (isLoaded == value)
-                                       return;
-                               isLoaded = value;
-                               NotifyValueChanged ("IsLoaded", isLoaded);
-                       }
-               }
-               public bool IsExpanded
-               {
-                       get { return isExpanded; }
-                       set
-                       {
-                               if (value == isExpanded)
-                                       return;
-                               isExpanded = value;
-                               NotifyValueChanged ("IsExpanded", isExpanded);
-                       }
-               }
-               public bool IsStartupProject {
-                       get { return solution.StartupProject == this; }
-               }
-               public string Path {
-                       get { return System.IO.Path.Combine (solution.SolutionFolder, solutionProject.RelativePath.Replace('\\','/')); }
-               }
-               public string RootDir {
-                       get { return System.IO.Path.GetDirectoryName (Path); }
-               }
-
-
-
-               public List<ProjectNode> RootItems {
-                       get { return rootItems; }
-               }
-
-               void buildTreeNodes(){
-                       ProjectNode root = new ProjectNode (this, ItemType.VirtualGroup, RootNamespace);
-                       List<ProjectItem> items = new List<ProjectItem> ();
-                       foreach (XmlNode i in nodesItems) {
-                               foreach (XmlNode f in i.ChildNodes) {
-                                       items.Add (new ProjectItem (this, f));
-                               }
-                       }
-
-                       flattenNodes = new List<ProjectNode> ();
-
-                       ProjectNode refs = new ProjectNode (this, ItemType.ReferenceGroup, "References");
-                       root.AddChild (refs);
-
-                       foreach (ProjectItem pn in items) {
-                               switch (pn.Type) {
-                               case ItemType.Reference:
-                                       refs.AddChild (pn);
-                                       flattenNodes.Add (pn);
-                                       break;                                  
-                               case ItemType.ProjectReference:
-                                       ProjectReference pr = new ProjectReference (pn); 
-                                       refs.AddChild (pr);
-                                       flattenNodes.Add (pr);
-                                       break;                                  
-                               case ItemType.Compile:
-                               case ItemType.None:
-                               case ItemType.EmbeddedResource:                                         
-                                       ProjectNode curNode = root;
-                                       string[] folds = pn.Path.Split ('/');
-                                       for (int i = 0; i < folds.Length - 1; i++) {
-                                               ProjectNode nextNode = curNode.ChildNodes.FirstOrDefault (n => n.DisplayName == folds [i] && n.Type == ItemType.VirtualGroup);
-                                               if (nextNode == null) {
-                                                       nextNode = new ProjectNode (this, ItemType.VirtualGroup, folds [i]);
-                                                       curNode.AddChild (nextNode);
-                                               }
-                                               curNode = nextNode;
-                                       }
-                                       ProjectNode f = null;
-                                       switch (pn.Extension) {
-                                       case ".crow":
-                                       case ".template":
-                                       case ".goml":
-                                       case ".itemp":
-                                       case ".imtl":
-                                               f = new ImlProjectItem (pn);
-                                               break;
-                                       case ".style":
-                                               f = new StyleProjectItem (pn);
-                                               break;
-                                       default:
-                                               f = new ProjectFile (pn);
-                                               break;
-                                       }
-                                       curNode.AddChild (f);
-                                       flattenNodes.Add (f);
-                                       break;
-                               }
-                       }
-                       root.SortChilds ();
-
-                       rootItems = root.ChildNodes;
-               }
-                       
-               #region Project properties
-               public string ToolsVersion {
-                       get { return nodeProject?.Attributes ["ToolsVersion"]?.Value; }
-               }
-               public string DefaultTargets {
-                       get { return nodeProject?.Attributes ["DefaultTargets"]?.Value; }
-               }
-               public string ProjectGuid {
-                       get { return solutionProject.ProjectGuid; }
-               }
-               public string AssemblyName {
-                       get { return nodeProps["AssemblyName"]?.InnerText; }
-               }
-               public string OutputType {
-                       get { return nodeProps["OutputType"]?.InnerText; }
-               }
-               public string RootNamespace {
-                       get { return nodeProps["RootNamespace"]?.InnerText; }
-               }
-               public bool AllowUnsafeBlocks {
-                       get {return nodeProps["AllowUnsafeBlocks"] == null ? false :
-                               bool.Parse (nodeProps["AllowUnsafeBlocks"]?.InnerText); }
-               }
-               public bool NoStdLib {
-                       get { return nodeProps["NoStdLib"] == null ? false :
-                               bool.Parse (nodeProps["NoStdLib"]?.InnerText); }
-               }
-               public bool TreatWarningsAsErrors {
-                       get { return nodeProps["TreatWarningsAsErrors"] == null ? false:
-                               bool.Parse (nodeProps["TreatWarningsAsErrors"]?.InnerText); }
-               }
-               public bool SignAssembly {
-                       get { return bool.Parse (nodeProps["SignAssembly"]?.InnerText); }
-               }
-               public string TargetFrameworkVersion {
-                       get { return nodeProps["TargetFrameworkVersion"]?.InnerText; }
-               }
-               public string Description {
-                       get { return nodeProps["Description"]?.InnerText; }
-               }
-               public string OutputPath {
-                       get { return nodeProps["OutputPath"]?.InnerText; }
-               }
-               public string IntermediateOutputPath {
-                       get { return nodeProps["IntermediateOutputPath"]?.InnerText; }
-               }
-               public string StartupObject {
-                       get { return nodeProps["StartupObject"]?.InnerText; }
-               }
-               public bool DebugSymbols {
-                       get { return nodeProps["DebugSymbols"] == null ? false : bool.Parse( nodeProps["DebugSymbols"]?.InnerText); }
-               }
-               public int WarningLevel {
-                       get { return nodeProps["WarningLevel"] == null ? 0 : int.Parse(nodeProps["WarningLevel"]?.InnerText); }
-               }
-
-               #endregion
-
-
-               public void AddNewFile () {
-                       Window.Show(CrowIDE.MainIFace, "#Crow.Coding.ui.NewFile.crow",true).DataSource = this;
-               }
-
-               public void Load () {
-                       
-                       xmlDoc = new XmlDocument();
-                       using (Stream ins = new FileStream (this.Path, FileMode.Open)) {
-                               xmlDoc.Load (new XmlTextReader(ins) { Namespaces = false });
-                       }
-
-                       nodeProject = xmlDoc.SelectSingleNode("Project");
-                       XmlNodeList nodesProps = xmlDoc.SelectNodes ("/Project/PropertyGroup");
-
-                       foreach (XmlNode n in nodesProps) {
-                               if (n.Attributes ["Condition"] == null)
-                                       nodeProps = n;
-                       }
-                       nodesItems = xmlDoc.SelectNodes ("/Project/ItemGroup");
-
-                       if (ProjectGuid != solutionProject.ProjectGuid)
-                               throw new Exception ("Project GUID not matching with solution");
-
-                       buildTreeNodes ();
-
-                       IsLoaded = true;
-               }
-
-               public void Save () {
-                       
-               }
-
-               void setAsStartupProject () {
-                       solution.StartupProject = this;
-               }
-               static Regex regexDirTokens = new Regex(@"\$\(([^\)]*)\)|([^\$]*)");
-
-               string getDirectoryWithTokens (string dir){                     
-                       Match m = regexDirTokens.Match (dir);
-                       string tmp = "";
-                       while (m.Success)
-                       {
-                               if (m.Value == @"$(SolutionDir)")
-                                       tmp = System.IO.Path.Combine (tmp, solution.SolutionFolder);
-                               else if (m.Value == @"$(Configuration)")
-                                       tmp = System.IO.Path.Combine (tmp, "Debug");
-                               else
-                                       tmp = System.IO.Path.Combine (tmp, m.Value);
-
-                               if (tmp.EndsWith (@"\")||tmp.EndsWith (@"/"))
-                                       tmp = tmp.Remove (tmp.Length - 1);
-
-                               m = m.NextMatch();
-                       }
-                       return tmp;
-               }
-               public string Compile () {                      
-                       if (ParentProject != null)
-                               ParentProject.Compile ();
-
-                       CSharpCodeProvider cp = new CSharpCodeProvider();
-                       CompilerParameters parameters = new CompilerParameters();
-
-                       foreach (ProjectReference pr in flattenNodes.OfType<ProjectReference>()) {                              
-                               Project p = solution.Projects.FirstOrDefault (pp => pp.ProjectGuid == pr.ProjectGUID);
-                               if (p == null)
-                                       throw new Exception ("referenced project not found");
-                               parameters.ReferencedAssemblies.Add (p.Compile ());
-                       }
-
-                       string outputDir =  getDirectoryWithTokens(this.OutputPath);
-                       string objDir = getDirectoryWithTokens (this.IntermediateOutputPath);
-
-                       Directory.CreateDirectory (outputDir);
-                       Directory.CreateDirectory (objDir);
-
-                       parameters.OutputAssembly = System.IO.Path.Combine (outputDir, this.AssemblyName);
-
-                       // True - exe file generation, false - dll file generation
-                       if (this.OutputType == "Library") {
-                               parameters.GenerateExecutable = false;
-                               parameters.CompilerOptions += " /target:library";
-                               parameters.OutputAssembly += ".dll";
-                       } else {
-                               parameters.GenerateExecutable = true;
-                               parameters.CompilerOptions += " /target:exe";
-                               parameters.OutputAssembly += ".exe";
-                               parameters.MainClass = this.StartupObject;
-                       }
-
-                       parameters.GenerateInMemory = false;
-                       parameters.IncludeDebugInformation = this.DebugSymbols;
-                       parameters.TreatWarningsAsErrors = this.TreatWarningsAsErrors;
-                       parameters.WarningLevel = this.WarningLevel;
-                       parameters.CompilerOptions += " /noconfig";
-                       if (this.AllowUnsafeBlocks)
-                               parameters.CompilerOptions += " /unsafe";
-                       parameters.CompilerOptions += " /delaysign+";
-                       parameters.CompilerOptions += " /debug:full /debug+";
-                       parameters.CompilerOptions += " /optimize-";
-                       parameters.CompilerOptions += " /define:\"DEBUG;TRACE\"";
-                       parameters.CompilerOptions += " /nostdlib";
-
-
-
-                       foreach (ProjectItem pi in flattenNodes.Where (p=>p.Type == ItemType.Reference)) {
-                               
-                               if (string.IsNullOrEmpty (pi.HintPath)) {
-                                       parameters.CompilerOptions += " /reference:/usr/lib/mono/4.5/" + pi.Path + ".dll";
-                                       continue;
-                               }
-                               parameters.ReferencedAssemblies.Add (pi.Path);
-                               string fullHintPath = System.IO.Path.GetFullPath(System.IO.Path.Combine (RootDir, pi.HintPath.Replace('\\','/')));
-                               if (File.Exists (fullHintPath)) {
-                                       string outPath = System.IO.Path.Combine (outputDir, System.IO.Path.GetFileName (fullHintPath));
-                                       if (!File.Exists(outPath))
-                                               File.Copy (fullHintPath, outPath);
-                               }
-                       }
-                       parameters.CompilerOptions += " /reference:/usr/lib/mono/4.5/System.Core.dll";
-                       parameters.CompilerOptions += " /reference:/usr/lib/mono/4.5/mscorlib.dll";
-                       //parameters.ReferencedAssemblies.Add ("System.Core");
-                       //parameters.ReferencedAssemblies.Add ("mscorlib.dll");
-
-
-                       IEnumerable<ProjectFile> pfs = flattenNodes.OfType<ProjectFile> ();
-
-                       foreach (ProjectFile pi in pfs.Where (p => p.Type == ItemType.EmbeddedResource)) {
-                               
-                               string absPath = pi.AbsolutePath;
-                               string logicName = pi.LogicalName;
-                               if (string.IsNullOrEmpty (logicName))
-                                       parameters.CompilerOptions += string.Format (" /resource:{0},{1}", absPath , this.Name + "." + pi.Path.Replace('/','.'));
-                               else
-                                       parameters.CompilerOptions += string.Format (" /resource:{0},{1}", absPath, logicName);
-                       }
-                       foreach (ProjectFile pi in pfs.Where (p => p.Type == ItemType.None)) {
-                               if (pi.CopyToOutputDirectory == CopyToOutputState.Never)
-                                       continue;
-                               string source = pi.AbsolutePath;
-                               string target = System.IO.Path.Combine (outputDir, pi.Path);                                    
-                               Directory.CreateDirectory (System.IO.Path.GetDirectoryName (target));
-
-                               if (File.Exists (target)) {
-                                       if (pi.CopyToOutputDirectory == CopyToOutputState.PreserveNewest) {
-                                               if (DateTime.Compare (
-                                                           System.IO.File.GetLastWriteTime (source),
-                                                           System.IO.File.GetLastWriteTime (target)) < 0)
-                                                       continue;
-                                       }
-                                       File.Delete (target);
-                               }
-                               System.Diagnostics.Debug.WriteLine ("copy " + source + " to " + target);
-                               File.Copy (source, target);
-                       }
-                       string[] files = pfs.Where (p => p.Type == ItemType.Compile).Select (p => p.AbsolutePath).ToArray();
-
-                       System.Diagnostics.Debug.WriteLine("---- start compilation of :" + parameters.OutputAssembly);
-                       System.Diagnostics.Debug.WriteLine (parameters.CompilerOptions);
-
-                       CompilationResults = cp.CompileAssemblyFromFile(parameters, files);
-
-                       solution.UpdateErrorList ();
-
-                       return parameters.OutputAssembly;
-               }
-
-               public bool TryGetProjectFileFromAbsolutePath (string absolutePath, out ProjectFile pi){
-                       pi = flattenNodes.OfType<ProjectFile> ().FirstOrDefault 
-                               (pp => pp.AbsolutePath == absolutePath);
-                       return pi != null;
-               }
-               public bool TryGetProjectFileFromPath (string path, out ProjectFile pi){
-                       if (path.StartsWith ("#"))
-                               pi = flattenNodes.OfType<ProjectFile> ().FirstOrDefault 
-                                       (pp => pp.Type == ItemType.EmbeddedResource && pp.ResourceID == path.Substring (1));
-                       else
-                               pi = flattenNodes.OfType<ProjectFile> ().FirstOrDefault (pp => pp.Path == path);
-
-                       if (pi != null)
-                               return true;
-
-                       foreach (ProjectReference pr in flattenNodes.OfType<ProjectReference>()) {                              
-                               Project p = solution.Projects.FirstOrDefault (pp => pp.ProjectGuid == pr.ProjectGUID);
-                               if (p == null)
-                                       throw new Exception ("referenced project not found");
-                               if (p.TryGetProjectFileFromPath (path, out pi))
-                                       return true;
-                       }
-                       //TODO: search referenced assemblies
-                       return false;
-               }
-
-               public void GetDefaultTemplates () {
-                       IEnumerable<ProjectFile> tmpFiles =
-                               flattenNodes.OfType<ProjectFile> ().Where (pp => pp.Extension == ".template" );
-                       
-                       foreach (ProjectFile pi in tmpFiles.Where(
-                               pp=>pp.Type == ItemType.None && pp.CopyToOutputDirectory != CopyToOutputState.Never)) {
-
-                               string clsName = System.IO.Path.GetFileNameWithoutExtension(pi.Path);
-                               if (solution.DefaultTemplates.ContainsKey (clsName))
-                                       continue;
-                               solution.DefaultTemplates [clsName] = pi.AbsolutePath;
-                       }
-                       foreach (ProjectFile pi in tmpFiles.Where(pp=>pp.Type == ItemType.EmbeddedResource)) {                          
-                               string resId = pi.ResourceID;
-                               string clsName = resId.Substring (0, resId.Length - 9);
-                               if (solution.DefaultTemplates.ContainsKey (clsName))
-                                       continue;
-                               solution.DefaultTemplates [clsName] = pi.Path;
-                       }
-
-                       foreach (Project p in ReferencedProjects)                               
-                               p.GetDefaultTemplates ();                       
-               }
-//             void searchTemplatesIn(Assembly assembly){
-//                     if (assembly == null)
-//                             return;
-//                     foreach (string resId in assembly
-//                             .GetManifestResourceNames ()
-//                             .Where (r => r.EndsWith (".template", StringComparison.OrdinalIgnoreCase))) {
-//                             string clsName = resId.Substring (0, resId.Length - 9);
-//                             if (DefaultTemplates.ContainsKey (clsName))
-//                                     continue;
-//                             DefaultTemplates[clsName] = "#" + resId;
-//                     }
-//             }
-
-               public List<Project> ReferencedProjects {
-                       get {
-                               List<Project> tmp = new List<Project> ();
-                               foreach (ProjectReference pr in flattenNodes.OfType<ProjectReference>()) {                              
-                                       Project p = solution.Projects.FirstOrDefault (pp => pp.ProjectGuid == pr.ProjectGUID);
-                                       if (p != null)
-                                               tmp.Add (p);                                    
-                               }
-                               return tmp;
-                       }
-               }
-
-               public void GetStyling () {
-                       try {
-                               foreach (ProjectFile pi in flattenNodes.OfType<ProjectFile> ().Where (pp=>pp.Type == ItemType.EmbeddedResource && pp.Extension == ".style")) {
-                                       using (Stream s = new MemoryStream (System.Text.Encoding.UTF8.GetBytes(pi.Source))) {
-                                               new StyleReader (solution.Styling, s, pi.ResourceID);
-                                       }
-                               }
-                       } catch (Exception ex) {
-                               Console.WriteLine (ex.ToString ());
-                       }
-                       foreach (ProjectReference pr in flattenNodes.OfType<ProjectReference>()) {                              
-                               Project p = solution.Projects.FirstOrDefault (pp => pp.ProjectGuid == pr.ProjectGUID);
-                               if (p == null)
-                                       throw new Exception ("referenced project not found");
-                               p.GetStyling();
-                       }
-
-                       //TODO:get styling from referenced assemblies
-               }
-       }
+namespace Crow.Coding {
+    public class Project : IValueChange {
+        #region IValueChange implementation
+        public event EventHandler<ValueChangeEventArgs> ValueChanged;
+        public virtual void NotifyValueChanged (string MemberName, object _value) {
+            ValueChanged.Raise (this, new ValueChangeEventArgs (MemberName, _value));
+        }
+        #endregion
+
+        bool isLoaded = false;
+        bool isExpanded;
+        XmlDocument xmlDoc;
+        XmlNode nodeProject;
+        XmlNode nodeProps;
+        XmlNodeList nodesItems;
+        SolutionProject solutionProject;
+        Crow.Command cmdSave, cmdOpen, cmdCompile, cmdSetAsStartProj, cmdNewFile;
+
+        #region CTOR
+        public Project (Solution sol, SolutionProject sp) {
+            solutionProject = sp;
+
+            solution = sol;
+
+            cmdSave = new Crow.Command (new Action (() => Save ())) { Caption = "Save", Icon = new SvgPicture ("#icons.save.svg"), CanExecute = true };
+            cmdOpen = new Crow.Command (new Action (() => Load ())) { Caption = "Open", Icon = new SvgPicture ("#icons.open.svg"), CanExecute = false };
+            cmdCompile = new Crow.Command (new Action (() => Compile ())) {
+                Caption = "Compile",
+                Icon = "#icons.compile.svg"
+            };
+            cmdSetAsStartProj = new Crow.Command (new Action (() => setAsStartupProject ())) {
+                Caption = "Set as Startup Project"
+            };
+            cmdNewFile = new Crow.Command (new Action (() => AddNewFile ())) {
+                Caption = "Add New File",
+                Icon = new SvgPicture ("#icons.blank-file.svg"),
+                CanExecute = true
+            };
+
+            Commands = new List<Crow.Command> (new Crow.Command[] { cmdOpen, cmdSave, cmdSetAsStartProj, cmdCompile, cmdNewFile });
+
+            Load ();
+        }
+        #endregion
+
+        public Solution solution;
+        public List<Crow.Command> Commands;
+        public CompilerResults CompilationResults;
+        public List<Project> dependantProjects = new List<Project> ();
+        public Project ParentProject = null;
+        List<ProjectNode> rootItems;
+        List<ProjectNode> flattenNodes;
+
+        public string Name {
+            get { return solutionProject.ProjectName; }
+        }
+        public bool IsLoaded {
+            get { return isLoaded; }
+            set {
+                if (isLoaded == value)
+                    return;
+                isLoaded = value;
+                NotifyValueChanged ("IsLoaded", isLoaded);
+            }
+        }
+        public bool IsExpanded {
+            get { return isExpanded; }
+            set {
+                if (value == isExpanded)
+                    return;
+                isExpanded = value;
+                NotifyValueChanged ("IsExpanded", isExpanded);
+            }
+        }
+        public bool IsStartupProject {
+            get { return solution.StartupProject == this; }
+        }
+        public string Path {
+            get { return System.IO.Path.Combine (solution.SolutionFolder, solutionProject.RelativePath.Replace ('\\', '/')); }
+        }
+        public string RootDir {
+            get { return System.IO.Path.GetDirectoryName (Path); }
+        }
+
+
+
+        public List<ProjectNode> RootItems {
+            get { return rootItems; }
+        }
+
+        void buildTreeNodes () {
+            ProjectNode root = new ProjectNode (this, ItemType.VirtualGroup, RootNamespace);
+            List<ProjectItem> items = new List<ProjectItem> ();
+            foreach (XmlNode i in nodesItems) {
+                foreach (XmlNode f in i.ChildNodes) {
+                    items.Add (new ProjectItem (this, f));
+                }
+            }
+
+            flattenNodes = new List<ProjectNode> ();
+
+            ProjectNode refs = new ProjectNode (this, ItemType.ReferenceGroup, "References");
+            root.AddChild (refs);
+
+            foreach (ProjectItem pn in items) {
+                switch (pn.Type) {
+                    case ItemType.Reference:
+                        refs.AddChild (pn);
+                        flattenNodes.Add (pn);
+                        break;
+                    case ItemType.ProjectReference:
+                        ProjectReference pr = new ProjectReference (pn);
+                        refs.AddChild (pr);
+                        flattenNodes.Add (pr);
+                        break;
+                    case ItemType.Compile:
+                    case ItemType.None:
+                    case ItemType.EmbeddedResource:
+                        ProjectNode curNode = root;
+                        string[] folds = pn.Path.Split ('/');
+                        for (int i = 0; i < folds.Length - 1; i++) {
+                            ProjectNode nextNode = curNode.ChildNodes.FirstOrDefault (n => n.DisplayName == folds[i] && n.Type == ItemType.VirtualGroup);
+                            if (nextNode == null) {
+                                nextNode = new ProjectNode (this, ItemType.VirtualGroup, folds[i]);
+                                curNode.AddChild (nextNode);
+                            }
+                            curNode = nextNode;
+                        }
+                        ProjectNode f = null;
+                        switch (pn.Extension) {
+                            /*case ".cs":
+                                f = new CSProjectFile (pn);
+                                break;*/
+                            case ".crow":
+                            case ".template":
+                            case ".goml":
+                            case ".itemp":
+                            case ".imtl":
+                                f = new ImlProjectItem (pn);
+                                break;
+                            case ".style":
+                                f = new StyleProjectItem (pn);
+                                break;
+                            default:
+                                f = new ProjectFile (pn);
+                                break;
+                        }
+                        curNode.AddChild (f);
+                        flattenNodes.Add (f);
+                        break;
+                }
+            }
+            root.SortChilds ();
+
+            rootItems = root.ChildNodes;
+        }
+
+        #region Project properties
+        public string ToolsVersion {
+            get { return nodeProject?.Attributes["ToolsVersion"]?.Value; }
+        }
+        public string DefaultTargets {
+            get { return nodeProject?.Attributes["DefaultTargets"]?.Value; }
+        }
+        public string ProjectGuid {
+            get { return solutionProject.ProjectGuid; }
+        }
+        public string AssemblyName {
+            get { return nodeProps["AssemblyName"]?.InnerText; }
+        }
+        public string OutputType {
+            get { return nodeProps["OutputType"]?.InnerText; }
+        }
+        public string RootNamespace {
+            get { return nodeProps["RootNamespace"]?.InnerText; }
+        }
+        public bool AllowUnsafeBlocks {
+            get {
+                return nodeProps["AllowUnsafeBlocks"] == null ? false :
+               bool.Parse (nodeProps["AllowUnsafeBlocks"]?.InnerText);
+            }
+        }
+        public bool NoStdLib {
+            get {
+                return nodeProps["NoStdLib"] == null ? false :
+              bool.Parse (nodeProps["NoStdLib"]?.InnerText);
+            }
+        }
+        public bool TreatWarningsAsErrors {
+            get {
+                return nodeProps["TreatWarningsAsErrors"] == null ? false :
+              bool.Parse (nodeProps["TreatWarningsAsErrors"]?.InnerText);
+            }
+        }
+        public bool SignAssembly {
+            get { return bool.Parse (nodeProps["SignAssembly"]?.InnerText); }
+        }
+        public string TargetFrameworkVersion {
+            get { return nodeProps["TargetFrameworkVersion"]?.InnerText; }
+        }
+        public string Description {
+            get { return nodeProps["Description"]?.InnerText; }
+        }
+        public string OutputPath {
+            get { return nodeProps["OutputPath"]?.InnerText; }
+        }
+        public string IntermediateOutputPath {
+            get { return nodeProps["IntermediateOutputPath"]?.InnerText; }
+        }
+        public string StartupObject {
+            get { return nodeProps["StartupObject"]?.InnerText; }
+        }
+        public bool DebugSymbols {
+            get { return nodeProps["DebugSymbols"] == null ? false : bool.Parse (nodeProps["DebugSymbols"]?.InnerText); }
+        }
+        public int WarningLevel {
+            get { return nodeProps["WarningLevel"] == null ? 0 : int.Parse (nodeProps["WarningLevel"]?.InnerText); }
+        }
+
+        #endregion
+
+
+        public void AddNewFile () {
+            Window.Show (CrowIDE.MainIFace, "#Crow.Coding.ui.NewFile.crow", true).DataSource = this;
+        }
+
+        public void Load () {
+
+            xmlDoc = new XmlDocument ();
+            using (Stream ins = new FileStream (this.Path, FileMode.Open)) {
+                xmlDoc.Load (new XmlTextReader (ins) { Namespaces = false });
+            }
+
+            nodeProject = xmlDoc.SelectSingleNode ("Project");
+            XmlNodeList nodesProps = xmlDoc.SelectNodes ("/Project/PropertyGroup");
+
+            foreach (XmlNode n in nodesProps) {
+                if (n.Attributes["Condition"] == null)
+                    nodeProps = n;
+            }
+            nodesItems = xmlDoc.SelectNodes ("/Project/ItemGroup");
+
+            if (ProjectGuid != solutionProject.ProjectGuid)
+                throw new Exception ("Project GUID not matching with solution");
+
+            buildTreeNodes ();
+
+            IsLoaded = true;
+        }
+
+        public void Save () {
+
+        }
+
+        void setAsStartupProject () {
+            solution.StartupProject = this;
+        }
+        static Regex regexDirTokens = new Regex (@"\$\(([^\)]*)\)|([^\$]*)");
+
+        string getDirectoryWithTokens (string dir) {
+            Match m = regexDirTokens.Match (dir);
+            string tmp = "";
+            while (m.Success) {
+                if (m.Value == @"$(SolutionDir)")
+                    tmp = System.IO.Path.Combine (tmp, solution.SolutionFolder);
+                else if (m.Value == @"$(Configuration)")
+                    tmp = System.IO.Path.Combine (tmp, "Debug");
+                else
+                    tmp = System.IO.Path.Combine (tmp, m.Value);
+
+                if (tmp.EndsWith (@"\") || tmp.EndsWith (@"/"))
+                    tmp = tmp.Remove (tmp.Length - 1);
+
+                m = m.NextMatch ();
+            }
+            return tmp;
+        }
+        public string Compile () {
+            if (ParentProject != null)
+                ParentProject.Compile ();
+
+            CSharpCodeProvider cp = new CSharpCodeProvider ();
+            CompilerParameters parameters = new CompilerParameters ();
+
+            foreach (ProjectReference pr in flattenNodes.OfType<ProjectReference> ()) {
+                Project p = solution.Projects.FirstOrDefault (pp => pp.ProjectGuid == pr.ProjectGUID);
+                if (p == null)
+                    throw new Exception ("referenced project not found");
+                parameters.ReferencedAssemblies.Add (p.Compile ());
+            }
+
+            string outputDir = getDirectoryWithTokens (this.OutputPath);
+            string objDir = getDirectoryWithTokens (this.IntermediateOutputPath);
+
+            Directory.CreateDirectory (outputDir);
+            Directory.CreateDirectory (objDir);
+
+            parameters.OutputAssembly = System.IO.Path.Combine (outputDir, this.AssemblyName);
+
+            // True - exe file generation, false - dll file generation
+            if (this.OutputType == "Library") {
+                parameters.GenerateExecutable = false;
+                parameters.CompilerOptions += " /target:library";
+                parameters.OutputAssembly += ".dll";
+            } else {
+                parameters.GenerateExecutable = true;
+                parameters.CompilerOptions += " /target:exe";
+                parameters.OutputAssembly += ".exe";
+                parameters.MainClass = this.StartupObject;
+            }
+
+            parameters.GenerateInMemory = false;
+            parameters.IncludeDebugInformation = this.DebugSymbols;
+            parameters.TreatWarningsAsErrors = this.TreatWarningsAsErrors;
+            parameters.WarningLevel = this.WarningLevel;
+            parameters.CompilerOptions += " /noconfig";
+            if (this.AllowUnsafeBlocks)
+                parameters.CompilerOptions += " /unsafe";
+            parameters.CompilerOptions += " /delaysign+";
+            parameters.CompilerOptions += " /debug:full /debug+";
+            parameters.CompilerOptions += " /optimize-";
+            parameters.CompilerOptions += " /define:\"DEBUG;TRACE\"";
+            parameters.CompilerOptions += " /nostdlib";
+
+
+
+            foreach (ProjectItem pi in flattenNodes.Where (p => p.Type == ItemType.Reference)) {
+
+                if (string.IsNullOrEmpty (pi.HintPath)) {
+                    parameters.CompilerOptions += " /reference:/usr/lib/mono/4.5/" + pi.Path + ".dll";
+                    continue;
+                }
+                parameters.ReferencedAssemblies.Add (pi.Path);
+                string fullHintPath = System.IO.Path.GetFullPath (System.IO.Path.Combine (RootDir, pi.HintPath.Replace ('\\', '/')));
+                if (File.Exists (fullHintPath)) {
+                    string outPath = System.IO.Path.Combine (outputDir, System.IO.Path.GetFileName (fullHintPath));
+                    if (!File.Exists (outPath))
+                        File.Copy (fullHintPath, outPath);
+                }
+            }
+            parameters.CompilerOptions += " /reference:/usr/lib/mono/4.5/System.Core.dll";
+            parameters.CompilerOptions += " /reference:/usr/lib/mono/4.5/mscorlib.dll";
+            //parameters.ReferencedAssemblies.Add ("System.Core");
+            //parameters.ReferencedAssemblies.Add ("mscorlib.dll");
+
+
+            IEnumerable<ProjectFile> pfs = flattenNodes.OfType<ProjectFile> ();
+
+            foreach (ProjectFile pi in pfs.Where (p => p.Type == ItemType.EmbeddedResource)) {
+
+                string absPath = pi.AbsolutePath;
+                string logicName = pi.LogicalName;
+                if (string.IsNullOrEmpty (logicName))
+                    parameters.CompilerOptions += string.Format (" /resource:{0},{1}", absPath, this.Name + "." + pi.Path.Replace ('/', '.'));
+                else
+                    parameters.CompilerOptions += string.Format (" /resource:{0},{1}", absPath, logicName);
+            }
+            foreach (ProjectFile pi in pfs.Where (p => p.Type == ItemType.None)) {
+                if (pi.CopyToOutputDirectory == CopyToOutputState.Never)
+                    continue;
+                string source = pi.AbsolutePath;
+                string target = System.IO.Path.Combine (outputDir, pi.Path);
+                Directory.CreateDirectory (System.IO.Path.GetDirectoryName (target));
+
+                if (File.Exists (target)) {
+                    if (pi.CopyToOutputDirectory == CopyToOutputState.PreserveNewest) {
+                        if (DateTime.Compare (
+                                System.IO.File.GetLastWriteTime (source),
+                                System.IO.File.GetLastWriteTime (target)) < 0)
+                            continue;
+                    }
+                    File.Delete (target);
+                }
+                System.Diagnostics.Debug.WriteLine ("copy " + source + " to " + target);
+                File.Copy (source, target);
+            }
+            string[] files = pfs.Where (p => p.Type == ItemType.Compile).Select (p => p.AbsolutePath).ToArray ();
+
+            System.Diagnostics.Debug.WriteLine ("---- start compilation of :" + parameters.OutputAssembly);
+            System.Diagnostics.Debug.WriteLine (parameters.CompilerOptions);
+
+            CompilationResults = cp.CompileAssemblyFromFile (parameters, files);
+
+            solution.UpdateErrorList ();
+
+            return parameters.OutputAssembly;
+        }
+
+        public bool TryGetProjectFileFromAbsolutePath (string absolutePath, out ProjectFile pi) {
+            pi = flattenNodes.OfType<ProjectFile> ().FirstOrDefault
+                (pp => pp.AbsolutePath == absolutePath);
+            return pi != null;
+        }
+        public bool TryGetProjectFileFromPath (string path, out ProjectFile pi) {
+            if (path.StartsWith ("#"))
+                pi = flattenNodes.OfType<ProjectFile> ().FirstOrDefault
+                    (pp => pp.Type == ItemType.EmbeddedResource && pp.ResourceID == path.Substring (1));
+            else
+                pi = flattenNodes.OfType<ProjectFile> ().FirstOrDefault (pp => pp.Path == path);
+
+            if (pi != null)
+                return true;
+
+            foreach (ProjectReference pr in flattenNodes.OfType<ProjectReference> ()) {
+                Project p = solution.Projects.FirstOrDefault (pp => pp.ProjectGuid == pr.ProjectGUID);
+                if (p == null)
+                    throw new Exception ("referenced project not found");
+                if (p.TryGetProjectFileFromPath (path, out pi))
+                    return true;
+            }
+            //TODO: search referenced assemblies
+            return false;
+        }
+
+        public void GetDefaultTemplates () {
+            IEnumerable<ProjectFile> tmpFiles =
+                flattenNodes.OfType<ProjectFile> ().Where (pp => pp.Extension == ".template");
+
+            foreach (ProjectFile pi in tmpFiles.Where (
+                pp => pp.Type == ItemType.None && pp.CopyToOutputDirectory != CopyToOutputState.Never)) {
+
+                string clsName = System.IO.Path.GetFileNameWithoutExtension (pi.Path);
+                if (solution.DefaultTemplates.ContainsKey (clsName))
+                    continue;
+                solution.DefaultTemplates[clsName] = pi.AbsolutePath;
+            }
+            foreach (ProjectFile pi in tmpFiles.Where (pp => pp.Type == ItemType.EmbeddedResource)) {
+                string resId = pi.ResourceID;
+                string clsName = resId.Substring (0, resId.Length - 9);
+                if (solution.DefaultTemplates.ContainsKey (clsName))
+                    continue;
+                solution.DefaultTemplates[clsName] = pi.Path;
+            }
+
+            foreach (Project p in ReferencedProjects)
+                p.GetDefaultTemplates ();
+        }
+        //             void searchTemplatesIn(Assembly assembly){
+        //                     if (assembly == null)
+        //                             return;
+        //                     foreach (string resId in assembly
+        //                             .GetManifestResourceNames ()
+        //                             .Where (r => r.EndsWith (".template", StringComparison.OrdinalIgnoreCase))) {
+        //                             string clsName = resId.Substring (0, resId.Length - 9);
+        //                             if (DefaultTemplates.ContainsKey (clsName))
+        //                                     continue;
+        //                             DefaultTemplates[clsName] = "#" + resId;
+        //                     }
+        //             }
+
+        public List<Project> ReferencedProjects {
+            get {
+                List<Project> tmp = new List<Project> ();
+                foreach (ProjectReference pr in flattenNodes.OfType<ProjectReference> ()) {
+                    Project p = solution.Projects.FirstOrDefault (pp => pp.ProjectGuid == pr.ProjectGUID);
+                    if (p != null)
+                        tmp.Add (p);
+                }
+                return tmp;
+            }
+        }
+
+        public void GetStyling () {
+            try {
+                foreach (ProjectFile pi in flattenNodes.OfType<ProjectFile> ().Where (pp => pp.Type == ItemType.EmbeddedResource && pp.Extension == ".style")) {
+                    using (Stream s = new MemoryStream (System.Text.Encoding.UTF8.GetBytes (pi.Source))) {
+                        new StyleReader (solution.Styling, s, pi.ResourceID);
+                    }
+                }
+            } catch (Exception ex) {
+                Console.WriteLine (ex.ToString ());
+            }
+            foreach (ProjectReference pr in flattenNodes.OfType<ProjectReference> ()) {
+                Project p = solution.Projects.FirstOrDefault (pp => pp.ProjectGuid == pr.ProjectGUID);
+                if (p == null)
+                    throw new Exception ("referenced project not found");
+                p.GetStyling ();
+            }
+
+            //TODO:get styling from referenced assemblies
+        }
+    }
 }
 
diff --git a/CrowIDE/src/ProjectTree/CSProjectFile.cs b/CrowIDE/src/ProjectTree/CSProjectFile.cs
new file mode 100644 (file)
index 0000000..586e226
--- /dev/null
@@ -0,0 +1,72 @@
+//
+// ProjectNodes.cs
+//
+// Author:
+//       Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+//
+// Copyright (c) 2013-2017 Jean-Philippe Bruyère
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System;
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.CSharp;
+using Microsoft.CodeAnalysis.CSharp.Syntax;
+
+namespace Crow.Coding
+{
+       public class CSProjectFile : ProjectFile
+       {
+        CSharpSyntaxTree tree;
+
+
+        #region CTOR
+        public CSProjectFile (ProjectItem pi) : base (pi){                     
+               }
+        #endregion
+
+        public override void UpdateSource(object sender, string newSrc)
+        {
+            base.UpdateSource(sender, newSrc);
+
+            tree = (CSharpSyntaxTree)CSharpSyntaxTree.ParseText (Source, CSharpParseOptions.Default);
+        }
+
+        public override void Open () {
+            base.Open ();
+
+            tree = (CSharpSyntaxTree)CSharpSyntaxTree.ParseText (Source, CSharpParseOptions.Default);
+
+                       CompilationUnitSyntax root = (CompilationUnitSyntax)tree.GetRoot ();
+                       MemberDeclarationSyntax firstMember = root.Members [0];
+
+                       Console.WriteLine ( firstMember.GetType().FullName);
+
+                       SyntaxToken tok = root.GetFirstToken();
+                       
+                       while (tok.Value != null) {
+                               Console.Write (tok.Text);
+                               tok = tok.GetNextToken (true,true);
+                       }
+                       Console.Out.Flush ();
+        }
+
+
+    }
+}
+
index 611f1d8b058cc6bd8e02724222a4e318d10f5467..8d803faa15b3cfa7cdc85670380443bed38d1965 100644 (file)
 // THE SOFTWARE.
 using System;
 using System.Collections.Generic;
-using System.Linq;
-using System.Xml;
 using System.IO;
-using Crow;
+using System.Linq;
 using System.Threading;
+using System.Xml;
 
-namespace Crow.Coding
-{      
-       public class ProjectFile : ProjectItem {                
+namespace Crow.Coding {
+    public class ProjectFile : ProjectItem {           
                bool isOpened = false;
                DateTime accessTime;
                string source;
@@ -222,7 +220,7 @@ namespace Crow.Coding
                        }
                }
 
-               public void Open () {                   
+               public virtual void Open () {                   
                        accessTime = System.IO.File.GetLastWriteTime (AbsolutePath);
                        using (StreamReader sr = new StreamReader (AbsolutePath)) {
                                source = sr.ReadToEnd ();
index 614e8e7a742e8ffccc1f51213b3c1f5ddfb96dfd..ed9e7d98846b797bc49b67d6a309de12bce863e7 100644 (file)
@@ -1,8 +1,8 @@
 <?xml version="1.0"?>
-<Expandable Caption="{Name}" IsExpanded="{²IsExpanded}">
+<Expandable IsExpanded="{²IsExpanded}" MouseDoubleClick="/onClickForExpand">
        <Template>
                <VerticalStack>
-                       <Border CornerRadius="2" Margin="0" Height="Fit" MouseDoubleClick="./onClickForExpand"                                          
+                       <Border CornerRadius="2" Margin="0" Height="Fit"                                                
                                        Foreground="Transparent"
                                        MouseEnter="{Foreground=DimGrey}"
                                        MouseLeave="{Foreground=Transparent}">
@@ -16,7 +16,7 @@
                                        <Border Width="16" Height="16" Foreground="Black" Background="DimGrey">
                                                <Image Margin="2" Path="{GetIcon}" />
                                        </Border>
-                                       <Label Text="{./Caption}"/>
+                                       <Label Text="{DesignName}"/>
                                </HorizontalStack>
                        </Border>
                        <Container Name="Content" Visible="false"/>
index fb9d2f0df76a2e6bd05813c1e7a980c062e1bbd5..e79885687b3e4a0133beeda9a31a8c1560e33e24 100644 (file)
@@ -11,7 +11,7 @@
                                                <Border Width="16" Height="16" Foreground="Black" Background="DimGrey">
                                                        <Image Margin="2" Path="{GetIcon}" />
                                                </Border>
-                                               <Label Text="{Name}" Width="Stretched"/>
+                                               <Label Text="{DesignName}" Width="Stretched"/>
                                        </HorizontalStack>
                                </Border>
                        </ItemTemplate>
index 20239315e78d2e7c79d8e0fa5216e21ae4644724..bb8a20363edad9c411eb1ec96180a9c009c4d238 100644 (file)
@@ -17,7 +17,7 @@
     <DebugType>portable</DebugType>
   </PropertyGroup>
   <ItemGroup>
-    <Compile Include="*.cs" />  
+    <Compile Include="*.cs" Exclude="testClass.cs" />  
         
     <ProjectReference Include="..\Crow\Crow.NetStd.csproj" />
         
@@ -36,4 +36,7 @@
     </None>
   </ItemGroup>
     
+<!--  <ItemGroup>
+    <PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="2.10.0" />
+  </ItemGroup>-->
 </Project>
index 69437acc43a0f13564ea3f6215b91ed43f30d31f..5f1c35d05b3b19e222cb1d14d1420c5cd2830ebd 100644 (file)
@@ -8,16 +8,11 @@
     <OutputType>Exe</OutputType>
     <RootNamespace>Tests</RootNamespace>
     <AssemblyName>Tests</AssemblyName>
-    <StartupObject>tests.Showcase</StartupObject>
+    <StartupObject>tests.MainClass</StartupObject>
     <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
     <ReleaseVersion>0.8.0</ReleaseVersion>
     <OutputPath>$(SolutionDir)build/$(Configuration)</OutputPath>
     <IntermediateOutputPath>$(SolutionDir)build/obj/$(Configuration)</IntermediateOutputPath>
-    <CustomCommands>
-      <CustomCommands>
-        <Command type="Execute" command="${TargetName}" workingdir="${SolutionDir}/build/${ProjectConfigName}" />
-      </CustomCommands>
-    </CustomCommands>
     <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <IntermediateOutputPath>$(SolutionDir)build\obj\$(Configuration)</IntermediateOutputPath>
     <OutputPath>$(SolutionDir)build\Release</OutputPath>
   </PropertyGroup>
-  <PropertyGroup Condition=" '$(RunConfiguration)' == 'Default' ">
-    <StartAction>Program</StartAction>
-    <StartProgram>%24{TargetName}</StartProgram>
-    <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>
-  <PropertyGroup Condition=" '$(RunConfiguration)' == 'Custom Command' ">
-    <StartAction>Program</StartAction>
-    <StartProgram>%24{TargetName}</StartProgram>
-    <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>
-  <PropertyGroup Condition=" '$(RunConfiguration)' == 'Custom Command' ">
-    <StartAction>Program</StartAction>
-    <StartProgram>%24{TargetName}</StartProgram>
-    <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>
-  <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="Mono.Posix" />
+    <Reference Include="System.AppContext">
+      <HintPath>..\packages\System.AppContext.4.3.0\lib\net46\System.AppContext.dll</HintPath>
+    </Reference>
+    <Reference Include="mscorlib" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Collections.Immutable">
+      <HintPath>..\packages\System.Collections.Immutable.1.5.0\lib\netstandard2.0\System.Collections.Immutable.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Console">
+      <HintPath>..\packages\System.Console.4.3.0\lib\net46\System.Console.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Diagnostics.FileVersionInfo">
+      <HintPath>..\packages\System.Diagnostics.FileVersionInfo.4.3.0\lib\net46\System.Diagnostics.FileVersionInfo.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Diagnostics.StackTrace">
+      <HintPath>..\packages\System.Diagnostics.StackTrace.4.3.0\lib\net46\System.Diagnostics.StackTrace.dll</HintPath>
+    </Reference>
+    <Reference Include="System.IO.Compression">
+      <HintPath>..\packages\System.IO.Compression.4.3.0\lib\net46\System.IO.Compression.dll</HintPath>
+    </Reference>
+    <Reference Include="System.IO.FileSystem.Primitives">
+      <HintPath>..\packages\System.IO.FileSystem.Primitives.4.3.0\lib\net46\System.IO.FileSystem.Primitives.dll</HintPath>
+    </Reference>
+    <Reference Include="System.IO.FileSystem">
+      <HintPath>..\packages\System.IO.FileSystem.4.3.0\lib\net46\System.IO.FileSystem.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Reflection.Metadata">
+      <HintPath>..\packages\System.Reflection.Metadata.1.6.0\lib\netstandard2.0\System.Reflection.Metadata.dll</HintPath>
+    </Reference>
+    <Reference Include="System.ComponentModel.Composition" />
+    <Reference Include="System.Numerics" />
+    <Reference Include="System.Security.Cryptography.Encoding">
+      <HintPath>..\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Security.Cryptography.Primitives">
+      <HintPath>..\packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Security.Cryptography.Algorithms">
+      <HintPath>..\packages\System.Security.Cryptography.Algorithms.4.3.0\lib\net461\System.Security.Cryptography.Algorithms.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Security.Cryptography.X509Certificates">
+      <HintPath>..\packages\System.Security.Cryptography.X509Certificates.4.3.0\lib\net461\System.Security.Cryptography.X509Certificates.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Text.Encoding.CodePages">
+      <HintPath>..\packages\System.Text.Encoding.CodePages.4.3.0\lib\net46\System.Text.Encoding.CodePages.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Threading.Tasks.Extensions">
+      <HintPath>..\packages\System.Threading.Tasks.Extensions.4.3.0\lib\portable-net45+win8+wp8+wpa81\System.Threading.Tasks.Extensions.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Threading.Thread">
+      <HintPath>..\packages\System.Threading.Thread.4.3.0\lib\net46\System.Threading.Thread.dll</HintPath>
+    </Reference>
+    <Reference Include="System.ValueTuple">
+      <HintPath>..\packages\System.ValueTuple.4.3.0\lib\netstandard1.0\System.ValueTuple.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Xml.ReaderWriter">
+      <HintPath>..\packages\System.Xml.ReaderWriter.4.3.0\lib\net46\System.Xml.ReaderWriter.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Xml.XmlDocument">
+      <HintPath>..\packages\System.Xml.XmlDocument.4.3.0\lib\net46\System.Xml.XmlDocument.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Xml.XPath">
+      <HintPath>..\packages\System.Xml.XPath.4.3.0\lib\net46\System.Xml.XPath.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Xml.XPath.XDocument">
+      <HintPath>..\packages\System.Xml.XPath.XDocument.4.3.0\lib\net46\System.Xml.XPath.XDocument.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.CodeAnalysis">
+      <HintPath>..\packages\Microsoft.CodeAnalysis.Common.2.10.0\lib\netstandard1.3\Microsoft.CodeAnalysis.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.CodeAnalysis.CSharp">
+      <HintPath>..\packages\Microsoft.CodeAnalysis.CSharp.2.10.0\lib\netstandard1.3\Microsoft.CodeAnalysis.CSharp.dll</HintPath>
+    </Reference>
   </ItemGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
   <ItemGroup>
     <None Include="Interfaces\CheckBox2.imlt">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
+    <None Include="testClass.cs">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
+    <None Include="packages.config" />
   </ItemGroup>
   <ItemGroup>
     <Folder Include="Interfaces\" />
     <EmbeddedResource Include="Interfaces\colorItem2.crow">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </EmbeddedResource>
+    <EmbeddedResource Include="ui\TreeExpandable.template" />
   </ItemGroup>
   <ItemGroup>
     <ProjectReference Include="..\Crow\Crow.csproj">
diff --git a/Tests/testClass.cs b/Tests/testClass.cs
new file mode 100644 (file)
index 0000000..70d19b7
--- /dev/null
@@ -0,0 +1,25 @@
+
+using System;
+
+/* this is a block comment
+ * on several lines
+ */
+
+namespace testRoslyn {
+    public class testClass {
+               public testClass self;
+               int a = 0;
+               int b;
+               public string str = "this is a test string"
+
+               [XmlIgnore]
+               public string Str {
+                       get { return str; }
+                       set { str = value; }
+               }
+               [SecuritySafeCritical]
+        public testClass (int _a, int _b) {
+                       a = _a;
+        }
+    }
+}
diff --git a/Tests/ui/TreeExpandable.template b/Tests/ui/TreeExpandable.template
new file mode 100644 (file)
index 0000000..87fe8d4
--- /dev/null
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<VerticalStack>
+       <Border Style="TreeItemBorder" >                
+               <HorizontalStack Spacing="5" Focusable="true" MouseDoubleClick="./onClickForExpand">
+                       <Image Margin="1" Width="9" Height="9" Focusable="true" MouseDown="./onClickForExpand"
+                               Path="{./Image}"
+                               Visible="{./IsExpandable}"
+                               SvgSub="{./IsExpanded}"
+                               MouseEnter="{Background=LightGrey}"
+                               MouseLeave="{Background=Transparent}"/>
+            <Label Text="{Kind}" Width="Fit" Margin="2" Background="Onyx"/>
+            <Label Multiline="true" Text="{ToFullString}" Foreground="White" Background="Blue" Margin="2"/>            
+                       <ListBox Data="{GetToks}" Height="Fit" Width="Fit" DataTest="GetKind">
+                <Template>
+                    <HorizontalStack Name="ItemsContainer"/>
+                </Template>                
+                <ItemTemplate DataType="OpenBraceToken">
+                    <Label Text="{ToFullString}" Foreground="White" Background="Red"/>
+                </ItemTemplate>
+                <ItemTemplate DataType="OpenParenToken">
+                    <Label Text="{ToFullString}" Foreground="Red" />
+                </ItemTemplate>
+                <ItemTemplate>
+                    <Label Text="{ToFullString}" Foreground="Black"/>
+                </ItemTemplate>
+            </ListBox>            
+               </HorizontalStack>
+       </Border>
+       <Container Name="Content" Visible="false"/>
+</VerticalStack>