diff options
| author | jpbruyere <jp.bruyere@hotmail.com> | 2016-02-25 10:37:27 +0100 |
|---|---|---|
| committer | jpbruyere <jp.bruyere@hotmail.com> | 2016-02-25 11:31:21 +0100 |
| commit | 42fcd3657d6425005ed7f429fe9b73cfb6fcf1c6 (patch) | |
| tree | 87f081e4487881eb4be0142514033ab6c7bd9bd7 | |
| parent | f927821fd5678a29e6272c7ad4bd95e11957188b (diff) | |
remove duplicate of LoadDefault for templated controls, add DEBUG_LOAD
| -rw-r--r-- | Crow.csproj | 2 | ||||
| -rw-r--r-- | src/GraphicObjects/GraphicObject.cs | 12 | ||||
| -rw-r--r-- | src/GraphicObjects/ListBox.cs | 4 | ||||
| -rw-r--r-- | src/GraphicObjects/TemplatedControl.cs | 5 | ||||
| -rw-r--r-- | src/Interface.cs | 4 |
5 files changed, 18 insertions, 9 deletions
diff --git a/Crow.csproj b/Crow.csproj index f7113c64..439302fa 100644 --- a/Crow.csproj +++ b/Crow.csproj @@ -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> diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs index c643c343..23748b3a 100644 --- a/src/GraphicObjects/GraphicObject.cs +++ b/src/GraphicObjects/GraphicObject.cs @@ -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 (); diff --git a/src/GraphicObjects/ListBox.cs b/src/GraphicObjects/ListBox.cs index 8cfffe49..2b27a05e 100644 --- a/src/GraphicObjects/ListBox.cs +++ b/src/GraphicObjects/ListBox.cs @@ -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, diff --git a/src/GraphicObjects/TemplatedControl.cs b/src/GraphicObjects/TemplatedControl.cs index 75176c34..c1c48fc7 100644 --- a/src/GraphicObjects/TemplatedControl.cs +++ b/src/GraphicObjects/TemplatedControl.cs @@ -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)) { diff --git a/src/Interface.cs b/src/Interface.cs index 8d3a8e80..6e9fb8a8 100644 --- a/src/Interface.cs +++ b/src/Interface.cs @@ -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; |