<DefineConstants>__linux__;MEASURE_TIME</DefineConstants>
</PropertyGroup>
<ItemGroup>
- <Compile Include="src\Colors.cs" />
- <Compile Include="src\Point.cs" />
- <Compile Include="src\Rectangle.cs" />
- <Compile Include="src\Rectangles.cs" />
- <Compile Include="src\Size.cs" />
- <Compile Include="src\GraphicObjects\GraphicObject.cs" />
- <Compile Include="src\GraphicObjects\Container.cs" />
- <Compile Include="src\GraphicObjects\Group.cs" />
- <Compile Include="src\GraphicObjects\HorizontalStack.cs" />
- <Compile Include="src\GraphicObjects\Image.cs" />
- <Compile Include="src\GraphicObjects\Label.cs" />
- <Compile Include="src\GraphicObjects\TextBox.cs" />
- <Compile Include="src\GraphicObjects\ProgressBar.cs" />
- <Compile Include="src\GraphicObjects\VerticalStack.cs" />
- <Compile Include="src\Cairo\CairoHelpers.cs" />
- <Compile Include="src\win32\Win32.cs" />
- <Compile Include="src\win32\winApi.cs" />
- <Compile Include="src\GraphicObjects\Button.cs" />
- <Compile Include="src\GraphicObjects\GraduatedSlider.cs" />
- <Compile Include="src\GraphicObjects\Slider.cs" />
- <Compile Include="src\GraphicObjects\NumericControl.cs" />
- <Compile Include="src\GraphicObjects\Scroller.cs" />
- <Compile Include="src\GraphicObjects\ILayoutable.cs" />
- <Compile Include="src\Enums.cs" />
- <Compile Include="src\GraphicObjects\GenericStack.cs" />
- <Compile Include="src\CompilerServices\CompilerServices.cs" />
- <Compile Include="src\GraphicObjects\AnalogMeter.cs" />
- <Compile Include="src\GraphicObjects\Border.cs" />
- <Compile Include="src\Font.cs" />
- <Compile Include="src\GraphicObjects\Window.cs" />
- <Compile Include="src\GraphicObjects\ListBox.cs" />
- <Compile Include="src\ExtensionsMethods.cs" />
- <Compile Include="src\Interface.cs" />
- <Compile Include="src\LayoutingQueueItem.cs" />
- <Compile Include="src\GraphicObjects\Spinner.cs" />
- <Compile Include="src\DynAttribute.cs" />
- <Compile Include="src\GraphicObjects\IValueChange.cs" />
- <Compile Include="src\Picture.cs" />
- <Compile Include="src\SvgPicture.cs" />
- <Compile Include="src\BmpPicture.cs" />
- <Compile Include="src\GraphicObjects\TemplatedControl.cs" />
- <Compile Include="src\GraphicObjects\RadioButton.cs" />
- <Compile Include="src\GraphicObjects\Expandable.cs" />
- <Compile Include="src\GraphicObjects\PrivateContainer.cs" />
- <Compile Include="src\GraphicObjects\TemplatedContainer.cs" />
- <Compile Include="src\GraphicObjects\Popper.cs" />
- <Compile Include="src\TextChangeEventArgs.cs" />
- <Compile Include="src\ReflexionExtensions.cs" />
- <Compile Include="src\XCursor.cs" />
- <Compile Include="src\GraphicObjects\Grid.cs" />
- <Compile Include="src\GraphicObjects\TextRun.cs" />
- <Compile Include="src\GraphicObjects\MessageBox.cs" />
- <Compile Include="src\SelectionChangeEventArgs.cs" />
- <Compile Include="src\ValueChangeEventArgs.cs" />
- <Compile Include="src\GraphicObjects\FileDialog.cs" />
- <Compile Include="src\GraphicObjects\CheckBox.cs" />
- <Compile Include="src\GraphicObjects\ComboBox.cs" />
- <Compile Include="src\GraphicObjects\GroupBox.cs" />
- <Compile Include="src\GraphicObjects\ScrollBar.cs" />
- <Compile Include="src\BubblingMouseButtonEventArgs.cs" />
- <Compile Include="src\SolidColor.cs" />
- <Compile Include="src\Gradient.cs" />
- <Compile Include="src\Fill\Fill.cs" />
- <Compile Include="src\LayoutingEventArgs.cs" />
- <Compile Include="src\ScrollingEventArgs.cs" />
- <Compile Include="src\GraphicObjects\Trend.cs" />
- <Compile Include="src\GraphicObjects\Splitter.cs" />
- <Compile Include="src\GraphicObjects\TreeView.cs" />
- <Compile Include="src\GraphicObjects\TabView.cs" />
- <Compile Include="src\GraphicObjects\TabItem.cs" />
- <Compile Include="src\GraphicObjects\DummyTemplate.cs" />
- <Compile Include="src\Input\KeyboardKeyEventArgs.cs" />
- <Compile Include="src\Input\Buttons.cs" />
- <Compile Include="src\Input\ButtonState.cs" />
- <Compile Include="src\Input\Key.cs" />
- <Compile Include="src\Input\KeyboardState.cs" />
- <Compile Include="src\Input\KeyModifiers.cs" />
- <Compile Include="src\Input\MouseButton.cs" />
- <Compile Include="src\Input\MouseEventArgs.cs" />
- <Compile Include="src\Input\MouseScroll.cs" />
- <Compile Include="src\Input\MouseState.cs" />
- <Compile Include="src\rsvg\DimensionData.cs" />
- <Compile Include="src\rsvg\Global.cs" />
- <Compile Include="src\rsvg\Handle.cs" />
- <Compile Include="src\rsvg\Pixbuf.cs" />
- <Compile Include="src\rsvg\RsvgSharp.SizeFuncNative.cs" />
- <Compile Include="src\rsvg\SizeFunc.cs" />
- <Compile Include="src\MouseCursorChangedEventArgs.cs" />
- <Compile Include="src\Input\KeyPressEventArgs.cs" />
- <Compile Include="src\Configuration.cs" />
- <Compile Include="src\Measure.cs" />
- <Compile Include="src\CompilerServices\MemberReference.cs" />
- <Compile Include="src\CompilerServices\Bindings.cs" />
- <Compile Include="src\StyleReader.cs" />
- <Compile Include="src\GraphicObjects\DirectoryView.cs" />
- <Compile Include="src\Instantiator.cs" />
- <Compile Include="src\ItemTemplate.cs" />
- <Compile Include="src\Style.cs" />
- <Compile Include="src\GraphicObjects\Wrapper.cs" />
- <Compile Include="src\GraphicObjects\TemplatedGroup.cs" />
- <Compile Include="src\GraphicObjects\MenuItem.cs" />
- <Compile Include="src\GraphicObjects\Menu.cs" />
- <Compile Include="src\Command.cs" />
- <Compile Include="src\GraphicObjects\DataSourceChangeEventArgs.cs" />
- <Compile Include="src\IML\Reader.cs"/>
+ <Compile Include="src\Colors.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\Point.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\Rectangle.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\Rectangles.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\Size.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\GraphicObjects\GraphicObject.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\GraphicObjects\Container.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\GraphicObjects\Group.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\GraphicObjects\HorizontalStack.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\GraphicObjects\Image.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\GraphicObjects\Label.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\GraphicObjects\TextBox.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\GraphicObjects\ProgressBar.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\GraphicObjects\VerticalStack.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\Cairo\CairoHelpers.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\win32\Win32.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\win32\winApi.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\GraphicObjects\Button.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\GraphicObjects\GraduatedSlider.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\GraphicObjects\Slider.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\GraphicObjects\NumericControl.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\GraphicObjects\Scroller.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\GraphicObjects\ILayoutable.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\Enums.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\GraphicObjects\GenericStack.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\CompilerServices\CompilerServices.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\GraphicObjects\AnalogMeter.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\GraphicObjects\Border.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\Font.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\GraphicObjects\Window.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\GraphicObjects\ListBox.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\ExtensionsMethods.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\Interface.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\LayoutingQueueItem.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\GraphicObjects\Spinner.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\DynAttribute.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\GraphicObjects\IValueChange.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\Picture.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\SvgPicture.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\BmpPicture.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\GraphicObjects\TemplatedControl.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\GraphicObjects\RadioButton.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\GraphicObjects\Expandable.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\GraphicObjects\PrivateContainer.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\GraphicObjects\TemplatedContainer.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\GraphicObjects\Popper.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\TextChangeEventArgs.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\ReflexionExtensions.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\XCursor.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\GraphicObjects\Grid.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\GraphicObjects\TextRun.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\GraphicObjects\MessageBox.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\SelectionChangeEventArgs.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\ValueChangeEventArgs.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\GraphicObjects\FileDialog.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\GraphicObjects\CheckBox.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\GraphicObjects\ComboBox.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\GraphicObjects\GroupBox.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\GraphicObjects\ScrollBar.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\BubblingMouseButtonEventArgs.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\SolidColor.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\Gradient.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\Fill\Fill.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\LayoutingEventArgs.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\ScrollingEventArgs.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\GraphicObjects\Trend.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\GraphicObjects\Splitter.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\GraphicObjects\TreeView.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\GraphicObjects\TabView.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\GraphicObjects\TabItem.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\GraphicObjects\DummyTemplate.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\Input\KeyboardKeyEventArgs.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\Input\Buttons.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\Input\ButtonState.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\Input\Key.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\Input\KeyboardState.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\Input\KeyModifiers.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\Input\MouseButton.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\Input\MouseEventArgs.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\Input\MouseScroll.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\Input\MouseState.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\rsvg\DimensionData.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\rsvg\Global.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\rsvg\Handle.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\rsvg\Pixbuf.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\rsvg\RsvgSharp.SizeFuncNative.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\rsvg\SizeFunc.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\MouseCursorChangedEventArgs.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\Input\KeyPressEventArgs.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\Configuration.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\Measure.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\CompilerServices\MemberReference.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\CompilerServices\Bindings.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\StyleReader.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\GraphicObjects\DirectoryView.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\Instantiator.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\ItemTemplate.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\Style.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\GraphicObjects\Wrapper.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\GraphicObjects\TemplatedGroup.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\GraphicObjects\MenuItem.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\GraphicObjects\Menu.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\Command.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\GraphicObjects\DataSourceChangeEventArgs.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\IML\Reader.cs">
+ <LogicalName></LogicalName>
+ </Compile>
+ <Compile Include="src\IML\Context.cs" />
+ <Compile Include="src\IML\NodeAddress.cs" />
+ <Compile Include="src\IML\Node.cs" />
+ <Compile Include="src\IML\MemberAddress.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
- <None Include="README.md" />
+ <None Include="README.md">
+ <LogicalName></LogicalName>
+ </None>
<None Include="Crow.dll.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ <LogicalName></LogicalName>
</None>
</ItemGroup>
</Project>
GetMethod ("get_Item", new Type[] { typeof(string) });
public static FieldInfo fldItemTemplates = typeof(TemplatedGroup).GetField("ItemTemplates");
public static MethodInfo miCreateExpDel = typeof(ItemTemplate).GetMethod ("CreateExpandDelegate");
+ public static MethodInfo miLoadDefaultVals = typeof (GraphicObject).GetMethod ("loadDefaultValues");
+ public static PropertyInfo piStyle = typeof (GraphicObject).GetProperty ("Style");
+ #region tree handling methods
+ internal static MethodInfo miSetChild = typeof (Container).GetMethod ("SetChild");
+ internal static MethodInfo miAddChild = typeof (Group).GetMethod ("AddChild");
+ internal static MethodInfo miLoadTmp = typeof (TemplatedControl).GetMethod ("loadTemplate", BindingFlags.Instance | BindingFlags.NonPublic);
+ internal static MethodInfo miSetContent = typeof (TemplatedContainer).GetProperty ("Content").GetSetMethod ();
+ internal static MethodInfo miAddItem = typeof (TemplatedGroup).GetMethod ("AddItem", BindingFlags.Instance | BindingFlags.Public);
+ #endregion
#region ValueChange Reflexion member info
static EventInfo eiValueChange = typeof (IValueChange).GetEvent ("ValueChanged");
static MethodInfo miValueChangeAdd = eiValueChange.GetAddMethod ();
#endregion
-
+ /// <summary>
+ /// Loc0 is the current graphic object and arg1 of loader is the current interface
+ /// </summary>
+ /// <param name="il">Il.</param>
public static void emitSetCurInterface(ILGenerator il){
il.Emit (OpCodes.Ldloc_0);
il.Emit (OpCodes.Ldarg_1);
--- /dev/null
+//
+// Context.cs
+//
+// Author:
+// Jean-Philippe Bruyère <jp.bruyere@hotmail.com>
+//
+// Copyright (c) 2016 jp
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+using System;
+using System.Collections.Generic;
+using System.Reflection.Emit;
+
+namespace Crow.IML
+{
+ /// <summary>
+ /// Context while parsing IML
+ /// </summary>
+ public class Context
+ {
+ public ILGenerator il = null;
+ //public SubNodeType curSubNodeType;
+ public Stack<Node> nodesStack = new Stack<Node> ();
+
+ public Dictionary<string, string> Names = new Dictionary<string, string> ();
+ public Dictionary<string, Dictionary<string, MemberAddress>> PropertyBindings = new Dictionary<string, Dictionary<string, MemberAddress>> ();
+
+ public Context ()
+ {
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+//
+// MemberAddress.cs
+//
+// Author:
+// Jean-Philippe Bruyère <jp.bruyere@hotmail.com>
+//
+// Copyright (c) 2016 jp
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+using System;
+namespace Crow.IML
+{
+ /// <summary>
+ /// Address member of a node
+ /// </summary>
+ public struct MemberAddress
+ {
+ public NodeAddress Address;
+ public string Name;
+
+ public MemberAddress (NodeAddress _address, string _member)
+ {
+ Address = _address;
+ Name = _member;
+ }
+
+ #region Equality Compare
+ public override bool Equals (object obj)
+ {
+ return obj is MemberAddress && this == (MemberAddress)obj;
+ }
+ public override int GetHashCode ()
+ {
+ return Address.GetHashCode () ^ Name.GetHashCode ();
+ }
+ public static bool operator == (MemberAddress x, MemberAddress y)
+ {
+ return x.Address == y.Address && x.Name == y.Name;
+ }
+ public static bool operator != (MemberAddress x, MemberAddress y)
+ {
+ return !(x == y);
+ }
+ #endregion
+ }
+}
--- /dev/null
+//
+// Node.cs
+//
+// Author:
+// Jean-Philippe Bruyère <jp.bruyere@hotmail.com>
+//
+// Copyright (c) 2016 jp
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+using System;
+using System.Reflection;
+
+namespace Crow.IML
+{
+ /// <summary>
+ /// IML Node are the elements of the interface XML,
+ /// </summary>
+ public class Node
+ {
+ public Type CrowType;
+ /// <summary>
+ /// Indexer for group child, -1 for template
+ /// </summary>
+ public int Index;
+
+ public Node (Type crowType, int _index = 0)
+ {
+ CrowType = crowType;
+ Index = _index;
+ }
+
+ #region Equality Compare
+ public override bool Equals (object obj)
+ {
+ return obj is Node && this == (Node)obj;
+ }
+ public override int GetHashCode ()
+ {
+ return CrowType.GetHashCode () ^ Index.GetHashCode ();
+ }
+ public static bool operator == (Node x, Node y)
+ {
+ return x.CrowType == y.CrowType && x.Index == y.Index;
+ }
+ public static bool operator != (Node x, Node y)
+ {
+ return !(x == y);
+ }
+ #endregion
+
+ public bool IsTemplate {
+ get { return typeof (TemplatedControl).IsAssignableFrom (CrowType) && Index == 0; }
+ }
+ public MethodInfo AddMethod {
+ get {
+ if (typeof (Group).IsAssignableFrom (CrowType))
+ return CompilerServices.miAddChild;
+ if (typeof (Container).IsAssignableFrom (CrowType))
+ return CompilerServices.miSetChild;
+ if (typeof (TemplatedContainer).IsAssignableFrom (CrowType))
+ return Index == 0 ? CompilerServices.miLoadTmp : CompilerServices.miSetContent;
+ if (typeof (TemplatedGroup).IsAssignableFrom (CrowType))
+ return Index == 0 ? CompilerServices.miLoadTmp : CompilerServices.miAddItem;
+ if (typeof (TemplatedControl).IsAssignableFrom (CrowType))
+ return CompilerServices.miLoadTmp;
+ return null;
+ }
+ }
+
+ public static implicit operator string (Node sn)
+ {
+ return sn.ToString ();
+ }
+ public override string ToString ()
+ {
+ return string.Format ("{0}.{1}", CrowType.FullName, Index);
+ }
+ }
+}
--- /dev/null
+//
+// NodeAddress.cs
+//
+// Author:
+// Jean-Philippe Bruyère <jp.bruyere@hotmail.com>
+//
+// Copyright (c) 2016 jp
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Crow.IML
+{
+ public class NodeAddress : List<Node>
+ {
+ public override bool Equals (object obj)
+ {
+ return obj is NodeAddress && this == obj as NodeAddress;
+ }
+ public static bool operator == (NodeAddress x, NodeAddress y)
+ {
+ return x.SequenceEqual (y);
+ }
+ public static bool operator != (NodeAddress x, NodeAddress y)
+ {
+ return !(x == y);
+ }
+ }
+}
namespace Crow.IML
{
public class Reader : XmlTextReader
- {
- static MethodInfo[] miAddChild = new MethodInfo[]{
- typeof(Container).GetMethod ("SetChild"),
- typeof(Group).GetMethod ("AddChild"),
- typeof(TemplatedControl).GetMethod ("loadTemplate", BindingFlags.Instance | BindingFlags.NonPublic),
- typeof(TemplatedContainer).GetProperty ("Content").GetSetMethod (),
- typeof(TemplatedGroup).GetMethod ("AddItem", BindingFlags.Instance | BindingFlags.Public),
- //typeof(PrivateContainer).GetMethod ("SetChild", BindingFlags.Instance | BindingFlags.NonPublic)
- };
+ {
+ static List<Type> CrowTypes = new List<Type> ();
+
public enum SubNodeType{
None,
Child,
Items,
ItemTemplate
}
- public class Node {
- public SubNodeType Type;
- public int Index;
-
- public Node(){}
- public Node(SubNodeType snt, int _index = 0){
- Type = snt;
- Index = _index;
- }
- public static implicit operator SubNodeType(Node sn){
- return sn.Type;
- }
- public static implicit operator string(Node sn){
- return sn.ToString ();
- }
- public static implicit operator Node(SubNodeType sn){
- return new Node (sn);
- }
- public override bool Equals (object obj)
- {
- return obj is Node && this == (Node)obj;
- }
- public override int GetHashCode()
- {
- return Type.GetHashCode() ^ Index.GetHashCode();
- }
- public static bool operator ==(Node x, Node y)
- {
- return x.Type == y.Type && x.Index == y.Index;
- }
- public static bool operator !=(Node x, Node y)
- {
- return !(x == y);
- }
- public override string ToString ()
- {
- return string.Format ("{0}.{1}", (int)Type, Index);
- }
- public static Node Parse(string str){
- string[] tmp = str.Trim ().Split ('.');
- switch (tmp.Length) {
- case 1:
- return new Node ((SubNodeType)int.Parse (tmp [0]));
- case 2:
- return new Node ((SubNodeType)int.Parse (tmp [0]), int.Parse (tmp[1]));
- case 0:
- default:
- return new Node ();
- }
- }
- public static string AddressToString(Node[] address){
- string tmp = "";
- foreach (Node n in address) {
- tmp += n.ToString () + ";";
- }
- return string.IsNullOrEmpty(tmp) ? tmp : tmp.Substring (0, tmp.Length - 1);
- }
- public static Node[] AddressFromString(string address) {
- List<Node> nodes = new List<Node> ();
- string[] tmp = address.Split (';');
- for (int i = 0; i < tmp.Length; i++)
- nodes.Add (Node.Parse (tmp [i]));
- return nodes.ToArray();
- }
- }
-// public class PropertyBinding {
-// public string OriginePropertyName = "";
-// public MemberAddress Destination;
-// }
- public class MemberAddress {
- public Node[] DestinationNode = null;
- public string DestinationProperty = "";
-
- public MemberAddress (){}
- public MemberAddress (Node[] _node, string _property){
- DestinationNode = _node;
- DestinationProperty = _property;
- }
- }
- InstanciatorInvoker loader = null;
- DynamicMethod dm = null;
-
- public class IMLContext {
- public ILGenerator il = null;
- public SubNodeType curSubNodeType;
- public Stack<Node> nodesStack = new Stack<Node>();
-
- public Dictionary<string, string> Names = new Dictionary<string, string>();
- public Dictionary<string, Dictionary<string, MemberAddress>> PropertyBindings = new Dictionary<string, Dictionary<string, MemberAddress>>();
- }
+ //public static Node Parse(string str){
+ // string[] tmp = str.Trim ().Split ('.');
+ // switch (tmp.Length) {
+ // case 1:
+ // return new Node ((SubNodeType)int.Parse (tmp [0]));
+ // case 2:
+ // return new Node ((SubNodeType)int.Parse (tmp [0]), int.Parse (tmp[1]));
+ // case 0:
+ // default:
+ // return new Node ();
+ // }
+ //}
+ //public static string AddressToString(Node[] address){
+ // string tmp = "";
+ // foreach (Node n in address) {
+ // tmp += n.ToString () + ";";
+ // }
+ // return string.IsNullOrEmpty(tmp) ? tmp : tmp.Substring (0, tmp.Length - 1);
+ //}
+ //public static Node[] AddressFromString(string address) {
+ // List<Node> nodes = new List<Node> ();
+ // string[] tmp = address.Split (';');
+ // for (int i = 0; i < tmp.Length; i++)
+ // nodes.Add (Node.Parse (tmp [i]));
+ // return nodes.ToArray();
+ //}
+
+
+ // public class PropertyBinding {
+ // public string OriginePropertyName = "";
+ // public MemberAddress Destination;
+ // }
public Type RootType = null;
- public IMLContext IMLCtx;
+ public Context context;
- ILGenerator il { get { return IMLCtx.il; }}
+ InstanciatorInvoker loader = null;
+ DynamicMethod dm = null;
+
+ ILGenerator il { get { return context.il; }}
/// <summary>
/// Finalize instatiator MSIL and return LoaderInvoker delegate
}
protected int curDepth {
- get { return IMLCtx.nodesStack.Count - 1;}
+ get { return context.nodesStack.Count - 1;}
}
protected Node curNode {
- get { return IMLCtx.nodesStack.Peek(); }
+ get { return context.nodesStack.Peek(); }
}
//protected Stack<int> curTemplateDepth = new Stack<int>(new int[] {0}); //current template root depth
/// Used to parse xmlFrament with same code generator linked
/// If ilGen=null, a new Code Generator will be created.
/// </summary>
- public Reader (IMLContext ctx, string xmlFragment)
+ public Reader (Context ctx, string xmlFragment)
: base(xmlFragment, XmlNodeType.Element,null){
- IMLCtx = ctx;
+ context = ctx;
//
// if (IMLCtx != null)
// return;
#endregion
void createInstantiator(){
- IMLCtx = new IMLContext();
- readRootType();
+ context = new Context();
+ RootType = findRootType();
InitEmitter();
emitLoader(RootType);
Read();//close tag
CallingConventions.Standard,
typeof(void),new Type[] {typeof(object), typeof(Interface)}, RootType, true);
- IMLCtx.il = dm.GetILGenerator(256);
+ context.il = dm.GetILGenerator(256);
il.DeclareLocal(typeof(GraphicObject));
il.Emit(OpCodes.Nop);
//set local GraphicObject to root object passed as 1st argument
CompilerServices.emitSetCurInterface (il);
}
void emitLoader(Type crowType){
-
-
- if (typeof(Group).IsAssignableFrom (crowType))
- IMLCtx.curSubNodeType = SubNodeType.Children;
- else if (typeof(Container).IsAssignableFrom (crowType))
- IMLCtx.curSubNodeType = SubNodeType.Child;
- else if (typeof(TemplatedContainer).IsAssignableFrom (crowType))
- IMLCtx.curSubNodeType = SubNodeType.Content;
- else if (typeof(TemplatedGroup).IsAssignableFrom (crowType))
- IMLCtx.curSubNodeType = SubNodeType.Items;
- else if (typeof(TemplatedControl).IsAssignableFrom (crowType))
- IMLCtx.curSubNodeType = SubNodeType.Template;
- else
- IMLCtx.curSubNodeType = SubNodeType.None;
+ Node expectedNode = new Node (crowType);
string tmpXml = ReadOuterXml ();
il.Emit (OpCodes.Ldloc_0);//save current go onto the stack if child has to be added
#region Template and ItemTemplates loading
- if (IMLCtx.curSubNodeType >= SubNodeType.Template) {
+ if (expectedNode.IsTemplate) {
//if its a template, first read template elements
- using (Reader reader = new Reader (IMLCtx, tmpXml)) {
+ using (Reader reader = new Reader (context, tmpXml)) {
+ List<string []> itemTemplateIds = new List<string []> ();
+ bool inlineTemplate = false;
string templatePath = reader.GetAttribute ("Template");
- List<string[]> itemTemplateIds = new List<string[]> ();
- bool inlineTemplate = false;
reader.Read ();
int depth = reader.Depth + 1;
while (reader.Read ()) {
if (reader.Name == "Template") {
inlineTemplate = true;
reader.Read ();
- IMLCtx.nodesStack.Push(SubNodeType.Template);
+ context.nodesStack.Push (expectedNode);
readChildren (reader);
- IMLCtx.nodesStack.Pop();
+ context.nodesStack.Pop();
} else if (reader.Name == "ItemTemplate") {
string dataType = "default", datas = "", path = "";
while (reader.MoveToNextAttribute ()) {
}
}
- if (!inlineTemplate) {
- reader.il.Emit (OpCodes.Ldloc_0);//Load this templateControl ref
+ if (!inlineTemplate) {//load from path or default template
+ reader.il.Emit (OpCodes.Ldloc_0);//Load current templatedControl ref
if (string.IsNullOrEmpty (templatePath)) {
reader.il.Emit (OpCodes.Ldnull);//default template loading
}else{
reader.il.Emit (OpCodes.Callvirt,//call Interface.Load(path)
CompilerServices.miIFaceLoad);
}
- MethodInfo mitmp = crowType.GetMethod ("loadTemplate", BindingFlags.Instance | BindingFlags.NonPublic);
- if (mitmp == null)
- System.Diagnostics.Debugger.Break();
- reader.il.Emit (OpCodes.Callvirt,//load template
- mitmp);
+ reader.il.Emit (OpCodes.Callvirt, CompilerServices.miLoadTmp);//load template
}
//copy item templates (review this)
foreach (string[] iTempId in itemTemplateIds) {
}
}
}
+ expectedNode.Index++;
}
#endregion
- using (Reader reader = new Reader(IMLCtx,tmpXml)){
+ using (Reader reader = new Reader (context, tmpXml)){
reader.Read ();
#region Styling and default values loading
if (reader.HasAttributes) {
string style = reader.GetAttribute ("Style");
- if (!string.IsNullOrEmpty (style)) {
- PropertyInfo pi = crowType.GetProperty ("Style");
- CompilerServices.EmitSetValue (reader.il, pi, style);
- }
+ if (!string.IsNullOrEmpty (style))
+ CompilerServices.EmitSetValue (reader.il, CompilerServices.piStyle, style);
}
reader.il.Emit (OpCodes.Ldloc_0);
- reader.il.Emit (OpCodes.Callvirt, typeof(GraphicObject).GetMethod ("loadDefaultValues"));
+ reader.il.Emit (OpCodes.Callvirt, CompilerServices.miLoadDefaultVals);
#endregion
#region Attributes reading
throw new Exception ("Member '" + reader.Name + "' not found in " + crowType.Name);
if (pi.Name == "Name")
- IMLCtx.Names.Add(reader.Value, Node.AddressToString(IMLCtx.nodesStack.ToArray()));
+ context.Names.Add(reader.Value, Node.AddressToString(context.nodesStack.ToArray()));
- if (reader.Value.StartsWith ("{")) {
+ if (reader.Value.StartsWith ("{", StringComparison.OrdinalIgnoreCase)) {
readPropertyBinding(reader.Name, reader.Value.Substring (1, reader.Value.Length - 2));
//CompilerServices.emitBindingCreation (reader.il, reader.Name, reader.Value.Substring (1, reader.Value.Length - 2));
reader.il.Emit (OpCodes.Pop);//pop saved ref to current object
return;
}
- IMLCtx.nodesStack.Push (IMLCtx.curSubNodeType);
+ context.nodesStack.Push (expectedNode);
readChildren (reader);
- IMLCtx.nodesStack.Pop ();
+ context.nodesStack.Pop ();
}
il.Emit (OpCodes.Pop);//pop saved ref to current object
}
void registerPropertyBinding(string origNode, string origProp, MemberAddress ma){
- if (!IMLCtx.PropertyBindings.ContainsKey(origNode))
- IMLCtx.PropertyBindings [origNode] = new Dictionary<string, MemberAddress> ();
- IMLCtx.PropertyBindings [origNode] [origProp] = ma;
+ if (!context.PropertyBindings.ContainsKey(origNode))
+ context.PropertyBindings [origNode] = new Dictionary<string, MemberAddress> ();
+ context.PropertyBindings [origNode] [origProp] = ma;
}
void readPropertyBinding(string srcProperty, string expression){
//if binding exp = '{}' => binding is done on datasource
if (string.IsNullOrEmpty (expression)) {
- registerPropertyBinding ("DS", "", new MemberAddress (IMLCtx.nodesStack.ToArray (), srcProperty));
+ registerPropertyBinding ("DS", "", new MemberAddress (context.nodesStack.ToArray (), srcProperty));
return;
}
if (bindingExp.Length == 1) {
registerPropertyBinding ("DS", bindingExp [0],
- new MemberAddress (IMLCtx.nodesStack.ToArray (), srcProperty));
+ new MemberAddress (context.nodesStack.ToArray (), srcProperty));
return;
}
string targetName = "";
string nodeId = "";
- Node[] target = IMLCtx.nodesStack.ToArray ();
+ Node[] target = context.nodesStack.ToArray ();
int nodeIdx = target.Length - 1;//index of target in nodeStack
int ptr = 0;//pointer in bindingExp splitted on '/'
nodeId = Node.AddressToString (target);
targetName = bindTrg [0];
}else if (bindTrg.Length == 2) {
- nodeId = IMLCtx.Names [bindTrg [0]];
+ nodeId = context.Names [bindTrg [0]];
targetName = bindTrg [1];
} else
throw new Exception ("Syntax error in binding, expected 'go dot member'");
targetName = bindingExp [ptr];
}
- registerPropertyBinding (nodeId, targetName, new MemberAddress (IMLCtx.nodesStack.ToArray (), srcProperty));
+ registerPropertyBinding (nodeId, targetName, new MemberAddress (context.nodesStack.ToArray (), srcProperty));
}
/// <summary>
/// Parse child node an generate corresponding msil
reader.emitLoader (t);
reader.il.Emit (OpCodes.Ldloc_0);//load child on stack for parenting
- reader.il.Emit (OpCodes.Callvirt, miAddChild [(int)IMLCtx.nodesStack.Peek ().Type -1]);
+ reader.il.Emit (OpCodes.Callvirt, miAddChild [(int)context.nodesStack.Peek ().Type -1]);
reader.il.Emit (OpCodes.Stloc_0); //reset local to current go
reader.il.Emit (OpCodes.Ldloc_0);//save current go onto the stack if child has to be added
- IMLCtx.nodesStack.Peek ().Index++;
+ context.nodesStack.Peek ().Index++;
break;
}
/// read first node to set GraphicObject class for loading
/// and let reader position on that node
/// </summary>
- Type readRootType ()
+ Type findRootType ()
{
string root = "Object";
while (Read()) {
t = expT;
}
}
- RootType = t;
return t;
}
}