From dca4d91d401ba718eccb83d6be42a12f55919838 Mon Sep 17 00:00:00 2001 From: jpbruyere Date: Sat, 30 Jul 2016 10:00:02 +0200 Subject: remove style attributes, add ';' to style files line ending, new style parser --- src/GraphicObjects/GraphicObject.cs | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) (limited to 'src/GraphicObjects/GraphicObject.cs') 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 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(); - 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(); + //if (defStyle != null) + // defaultValue = defStyle.Path; + } else { + DefaultValueAttribute dv = (DefaultValueAttribute)pi.GetCustomAttribute (typeof (DefaultValueAttribute)); + if (dv == null) + continue; + defaultValue = dv.Value; + } } #endregion -- cgit v1.3.1-4-g156e From 6c6fb760bfb6a956a3413abfb56571a11113acd3 Mon Sep 17 00:00:00 2001 From: jpbruyere Date: Sat, 30 Jul 2016 12:42:25 +0200 Subject: replace ';' separator between members by ',' and set '.' as decimal mark in files --- Styles/MessageBox.style | 2 +- Styles/Window.style | 2 +- Templates/ArrowButTemplate.crow | 8 ++++---- Templates/Button.crow | 8 ++++---- Templates/FileDialog.goml | 6 +++--- Templates/MessageBox.goml | 6 +++--- Templates/ScrollBar.goml | 4 ++-- Templates/Window.goml | 6 +++--- Templates/imgItemTemplate.goml | 4 ++-- Tests/Interfaces/Divers/fps.crow | 4 ++-- Tests/Interfaces/Divers/testBorder.crow | 4 ++-- Tests/Interfaces/Divers/testGrid.crow | 10 +++++----- Tests/Interfaces/Divers/testWindow.goml | 8 ++++---- Tests/Interfaces/Divers/testWindow2.goml | 8 ++++---- Tests/Interfaces/Divers/testWindow3.goml | 6 +++--- Tests/Interfaces/Divers/test_Listbox.crow | 4 ++-- Tests/Interfaces/Nouveau dossier/test4.1.crow | 6 +++--- Tests/Interfaces/Nouveau dossier/test4.crow | 4 ++-- Tests/Interfaces/Nouveau dossier/test6.crow | 6 +++--- Tests/Interfaces/Nouveau dossier/testColorList.crow | 4 ++-- Tests/Interfaces/Nouveau dossier/testDirViewer.crow | 4 ++-- Tests/OpenTKGameWindow.cs | 2 ++ Tests/ui/test.crow | 6 +++--- Tests/ui/tmpWindow.crow | 4 ++-- src/Colors.cs | 4 ++-- src/GraphicObjects/GraphicObject.cs | 18 ++++++++++++------ src/Interface.cs | 11 +++++++++++ src/Point.cs | 4 ++-- src/Rectangle.cs | 4 ++-- src/Size.cs | 2 +- 30 files changed, 94 insertions(+), 75 deletions(-) (limited to 'src/GraphicObjects/GraphicObject.cs') diff --git a/Styles/MessageBox.style b/Styles/MessageBox.style index 1f562c11..914fbb97 100644 --- a/Styles/MessageBox.style +++ b/Styles/MessageBox.style @@ -2,4 +2,4 @@ Height=Fit; Title=MessageBox; Focusable=true; -MinimumSize=150;80; +MinimumSize=150,80; diff --git a/Styles/Window.style b/Styles/Window.style index 22ee20e2..26422233 100644 --- a/Styles/Window.style +++ b/Styles/Window.style @@ -1,3 +1,3 @@ Focusable=true; -MinimumSize=50;50; +MinimumSize=50,50; Fit=true; diff --git a/Templates/ArrowButTemplate.crow b/Templates/ArrowButTemplate.crow index 8614670d..fe0e122c 100755 --- a/Templates/ArrowButTemplate.crow +++ b/Templates/ArrowButTemplate.crow @@ -1,10 +1,10 @@ - + \ No newline at end of file diff --git a/Templates/Button.crow b/Templates/Button.crow index 7d128f75..a9e45dc3 100755 --- a/Templates/Button.crow +++ b/Templates/Button.crow @@ -1,10 +1,10 @@ - +