diff options
| author | jpbruyere <jp.bruyere@hotmail.com> | 2016-07-30 10:00:02 +0200 |
|---|---|---|
| committer | jpbruyere <jp.bruyere@hotmail.com> | 2016-07-30 10:00:02 +0200 |
| commit | dca4d91d401ba718eccb83d6be42a12f55919838 (patch) | |
| tree | 7822513d2718fdaf7f1971fab03138e9f93904a4 /src/GraphicObjects/GraphicObject.cs | |
| parent | e4e8fa3e55edf6205387cab650ab156055d83143 (diff) | |
remove style attributes, add ';' to style files line ending, new style parser
Diffstat (limited to 'src/GraphicObjects/GraphicObject.cs')
| -rw-r--r-- | src/GraphicObjects/GraphicObject.cs | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs index 2838f6cd..433599c1 100644 --- a/src/GraphicObjects/GraphicObject.cs +++ b/src/GraphicObjects/GraphicObject.cs @@ -493,12 +493,16 @@ namespace Crow #endif Type thisType = this.GetType (); - if (Interface.DefaultValuesLoader.ContainsKey(thisType.FullName)) { - Interface.DefaultValuesLoader[thisType.FullName] (this); - applyStyle (); + if (Interface.DefaultValuesLoader.ContainsKey (thisType.FullName)) { + Interface.DefaultValuesLoader [thisType.FullName] (this); return; } + Dictionary<string, string> styling = null; + + if (Interface.CurrentInterface.Styling.ContainsKey (thisType.Name)) + styling = Interface.CurrentInterface.Styling[thisType.Name]; + //Reflexion being very slow compared to dyn method or delegates, //I compile the initial values coded in the CustomAttribs of the class, //all other instance of this type would not longer use reflexion to init properly @@ -535,16 +539,20 @@ namespace Crow else name = xaa.AttributeName; } - if (name == "Style"){ - //retrieve default value from class attribute - DefaultStyle defStyle = thisType.GetCustomAttribute<DefaultStyle>(); - if (defStyle != null) - defaultValue = defStyle.Path; - }else{ - DefaultValueAttribute dv = (DefaultValueAttribute)pi.GetCustomAttribute (typeof(DefaultValueAttribute)); - if (dv == null) - continue; - defaultValue = dv.Value; + if (styling.ContainsKey (name)) { + + } else { + if (name == "Style") { + //retrieve default value from class attribute + //DefaultStyle defStyle = thisType.GetCustomAttribute<DefaultStyle>(); + //if (defStyle != null) + // defaultValue = defStyle.Path; + } else { + DefaultValueAttribute dv = (DefaultValueAttribute)pi.GetCustomAttribute (typeof (DefaultValueAttribute)); + if (dv == null) + continue; + defaultValue = dv.Value; + } } #endregion |