]> O.S.I.I.S - jp/crow.git/commitdiff
remove duplicate of LoadDefault for templated controls, add DEBUG_LOAD
authorjpbruyere <jp.bruyere@hotmail.com>
Thu, 25 Feb 2016 09:37:27 +0000 (10:37 +0100)
committerjpbruyere <jp.bruyere@hotmail.com>
Thu, 25 Feb 2016 10:31:21 +0000 (11:31 +0100)
Crow.csproj
src/GraphicObjects/GraphicObject.cs
src/GraphicObjects/ListBox.cs
src/GraphicObjects/TemplatedControl.cs
src/Interface.cs

index f7113c649eb46d227d2e13dc482243f716b59dad..439302fa2dbdc6ac1c60d29a6bed437dca084475 100644 (file)
@@ -45,7 +45,7 @@
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <OutputPath>bin\Debug</OutputPath>
-    <DefineConstants>DEBUG_LAYOUTING0;TRACE;DEBUG;__linux__;MEASURE_TIME;DEBUG_LOAD_TIME0;DEBUG_BINDING0;DEBUG_CLIP_RECTANGLE0</DefineConstants>
+    <DefineConstants>DEBUG_LAYOUTING0;TRACE;DEBUG;__linux__;MEASURE_TIME;DEBUG_LOAD0;DEBUG_BINDING0;DEBUG_CLIP_RECTANGLE0</DefineConstants>
   </PropertyGroup>
   <!--  <PropertyGroup Condition=" '$(Platform)' == 'Linux_x86' ">
     <DefineConstants>__linux__</DefineConstants>
index c643c343ab898f43ecf8f5f01bec2d64c74087a9..23748b3a1120f2251470c7bd02a72d5c525d00df 100644 (file)
@@ -454,7 +454,11 @@ namespace Crow
 
                /// <summary> Loads the default values from XML attributes default </summary>
                protected virtual void loadDefaultValues()
-               {                       
+               {
+                       #if DEBUG_LOAD
+                       Debug.WriteLine ("LoadDefValues for " + this.ToString ());
+                       #endif
+
                        Type thisType = this.GetType ();
                        if (Interface.DefaultValuesLoader.ContainsKey(thisType.FullName)) {
                                Interface.DefaultValuesLoader[thisType.FullName] (this);
@@ -606,6 +610,7 @@ namespace Crow
 
                        Interface.DefaultValuesLoader[thisType.FullName] = (Interface.loadDefaultInvoker)dm.CreateDelegate(typeof(Interface.loadDefaultInvoker));
                        Interface.DefaultValuesLoader[thisType.FullName] (this);
+                       applyStyle ();
                }
 
                public virtual GraphicObject FindByName(string nameToFind){
@@ -1471,6 +1476,11 @@ namespace Crow
                        Stream s = Interface.GetStreamFromPath (style);
                        if (s == null)
                                throw new Exception ("Style Path not found: " + style);
+
+                       #if DEBUG_LOAD
+                       Debug.WriteLine ("ApplyStyle for " + this.ToString ());
+                       #endif
+
                        using (StreamReader sr = new StreamReader (s)) {
                                while (!sr.EndOfStream) {
                                        string tmp = sr.ReadLine ();
index 8cfffe493d35fb48810c7df9734685d8016850c3..2b27a05e6ae94283cdfa38b0f36f8593b959eb5a 100644 (file)
@@ -119,7 +119,7 @@ namespace Crow
 
                void loadPage(int pageNum)
                {
-                       #if DEBUG_LOAD_TIME
+                       #if DEBUG_LOAD
                        Stopwatch loadingTime = new Stopwatch ();
                        loadingTime.Start ();
                        #endif
@@ -150,7 +150,7 @@ namespace Crow
 
                        _list.AddChild (page);
 
-                       #if DEBUG_LOAD_TIME
+                       #if DEBUG_LOAD
                        loadingTime.Stop ();
                        Debug.WriteLine("Listbox {2} Loading: {0} ticks \t, {1} ms",
                        loadingTime.ElapsedTicks,
index 75176c3413f4b75455e42c7b2f5a4bfc9cf07a5e..c1c48fc73fe47c93263e2bf93d022f7bccdfc272 100644 (file)
@@ -174,10 +174,9 @@ namespace Crow
                                } else
                                        loadTemplate (Interface.Load (template, this));
                                
-                               if (this.child == null) {
+                               //if no template found, load default one
+                               if (this.child == null)
                                        loadTemplate ();
-                                       loadDefaultValues ();
-                               }
                                
                                //normal xml read
                                using (XmlReader xr = new XmlTextReader (tmp, XmlNodeType.Element, null)) {
index 8d3a8e80f18d6bbf9b06d2ee048210026e117710..6e9fb8a87315056b59d1f1b47f0d95cf7533ae77 100644 (file)
@@ -132,7 +132,7 @@ namespace Crow
 
                public static GraphicObject Load (Stream stream, Type type, object hostClass = null)
                {
-                       #if DEBUG_LOAD_TIME
+                       #if DEBUG_LOAD
                        Stopwatch loadingTime = new Stopwatch ();
                        loadingTime.Start ();
                        #endif
@@ -150,7 +150,7 @@ namespace Crow
                        result = (GraphicObject)xs.Deserialize (stream);
                        //result.DataSource = hostClass;
 
-                       #if DEBUG_LOAD_TIME
+                       #if DEBUG_LOAD
                        FileStream fs = stream as FileStream;
                        if (fs!=null)
                                CurrentGOMLPath = fs.Name;