</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugType>full</DebugType>
- <DefineConstants>_DEBUG_DISPOSE;TRACE;_DEBUG_BINDING;DESIGN_MODE;_DEBUG_CLIP_RECTANGLE;DEBUG_FOCUS;_DEBUG_DRAGNDROP;NET471;NET461;NETFRAMEWORK;NET472;DEBUG;NETSTANDARD;NETSTANDARD2_0</DefineConstants>
+ <DefineConstants>_DEBUG_DISPOSE;TRACE;_DEBUG_BINDING;DESIGN_MODE;_DEBUG_CLIP_RECTANGLE;_DEBUG_FOCUS;_DEBUG_DRAGNDROP;NET471;NET461;NETFRAMEWORK;NET472;DEBUG;NETSTANDARD;NETSTANDARD2_0</DefineConstants>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
</PropertyGroup>
<ItemGroup Condition="$(TargetFramework.StartsWith('netstandard'))">
name = "ToInt16";
else if (targetType == typeof (int))
name = "ToInt32";
+ else if (targetType == typeof (uint))
+ name = "ToUInt32";
else if (targetType == typeof (long))
name = "ToInt64";
else if (targetType == typeof (double))
{
if (mi.MemberType == MemberTypes.Field)
il.Emit (OpCodes.Stfld, mi as FieldInfo);
- else if (mi.MemberType == MemberTypes.Property)
- il.Emit (OpCodes.Callvirt, (mi as PropertyInfo).GetSetMethod ());
- else
+ else if (mi.MemberType == MemberTypes.Property) {
+ MethodInfo mt = (mi as PropertyInfo).GetSetMethod ();
+ il.Emit (mt.IsVirtual?OpCodes.Callvirt:OpCodes.Call, mt);
+ } else
throw new NotImplementedException ();
}
/// <summary>
typeof (void), CompilerServices.argsBoundValueChange, true);
ILGenerator il = dm.GetILGenerator (64);
+
+ Stack<LocalBuilder> locals = new Stack<LocalBuilder> ();
+
System.Reflection.Emit.Label endMethod = il.DefineLabel ();
il.Emit (OpCodes.Nop);
il.Emit (OpCodes.Ldflda, miDests [i] as FieldInfo);
else if (miDests [i].MemberType == MemberTypes.Property) {
PropertyInfo pi = miDests [i] as PropertyInfo;
+ MethodInfo mi_g = pi.GetGetMethod ();
if (pi.PropertyType.IsValueType) {
il.Emit (OpCodes.Dup);//dup parent for calling property set afterward
- il.Emit (OpCodes.Callvirt, pi.GetGetMethod ());
- il.Emit (OpCodes.Box, pi.PropertyType);
- il.Emit (OpCodes.Dup);//dup boxed valueType, should unbox before setting parent
- } else
- il.Emit (OpCodes.Callvirt, pi.GetGetMethod ());
+ il.Emit (mi_g.IsVirtual ? OpCodes.Callvirt : OpCodes.Call, mi_g);
+ LocalBuilder lb = il.DeclareLocal (pi.PropertyType);
+ il.Emit (OpCodes.Stloc, lb);
+ il.Emit (OpCodes.Ldloca, lb);
+ locals.Push (lb);
+ } else {
+ il.Emit (mi_g.IsVirtual ? OpCodes.Callvirt : OpCodes.Call, mi_g);
+ }
} else
throw new NotImplementedException ();
}
PropertyInfo pi = miDests [i] as PropertyInfo;
if (!pi.PropertyType.IsValueType)
continue;
- il.Emit (OpCodes.Ldobj, pi.PropertyType);
- il.Emit (OpCodes.Callvirt, pi.GetSetMethod ());//updating parent
+ MethodInfo mi_s = pi.GetSetMethod ();
+ il.Emit (OpCodes.Ldloc, locals.Pop());
+ il.Emit (mi_s.IsVirtual ? OpCodes.Callvirt : OpCodes.Call, mi_s);
}
il.MarkLabel (endMethod);
il.Emit (OpCodes.Ret);
public void Init () {
loadStyling ();
-// initTooltip ();
-// initContextMenus ();
+ initTooltip ();
+ //initContextMenus ();
Startup ();
}
}*/
#region Static and constants
- /// <summary>
- /// Crow configuration root path
- /// </summary>
+ /// <summary>Crow configuration root path</summary>
public static string CROW_CONFIG_ROOT;
/// <summary>If true, mouse focus is given when mouse is over control</summary>
public static bool FOCUS_ON_HOVER = true;
/// <summary> Threshold to catch borders for sizing </summary>
public static int BorderThreshold = 5;
- /// <summary> delay before tooltip appear </summary>
+ /// <summary> delay before tooltip appears </summary>
public static int TOOLTIP_DELAY = 500;
/// <summary>Double click threshold in milisecond</summary>
public static int DOUBLECLICK_TRESHOLD = 240;//max duration between two mouse_down evt for a dbl clk in milisec.
#endregion
#region Default values and Style loading
- /// Default values of properties from GraphicObjects are retrieve from XML Attributes.
+ /// Default values of properties from Widgets are retrieve from XML Attributes.
/// The reflexion process used to retrieve those values being very slow, it is compiled in MSIL
/// and injected as a dynamic method referenced in the DefaultValuesLoader Dictionnary.
/// The compilation is done on the first object instancing, and is also done for custom widgets
using (Stream stream = assembly.GetManifestResourceStream (s)) {
new StyleReader (this.Styling, stream, s);
}
-
}
}
#endregion
/// <param name="path">path of the iml file to load</param>
public virtual Widget CreateInstance (string path)
{
- try {
+ //try {
return GetInstantiator (path).CreateInstance ();
- } catch (Exception ex) {
- throw new Exception ("Error loading <" + path + ">:", ex);
- }
+ //} catch (Exception ex) {
+ // throw new Exception ("Error loading <" + path + ">:", ex);
+ //}
}
/// <summary>
/// Create an instance of a GraphicObject linked to this interface but not added to the GraphicTree
/// <summary>
/// Initializes a new instance of the <see cref="Crow.ItemTemplate"/> class by parsing the IML fragment passed as arg.
/// </summary>
- /// <param name="path">IML fragment to parse</param>
+ /// <param name="ImlFragment">IML fragment to parse</param>
/// <param name="_dataType">type this item will be choosen for, or member of the data item</param>
/// <param name="_fetchDataMethod">for hierarchical data, method to call for children fetching</param>
public ItemTemplate (Interface _iface, Stream ImlFragment, string _dataTest, string _dataType, string _fetchDataMethod)
/// <summary>
/// Initializes a new instance of the <see cref="Crow.ItemTemplate"/> class using the opened XmlReader in args.
/// </summary>
- /// <param name="path">XML reader positionned before or at the root node</param>
+ /// <param name="reader">XML reader positionned before or at the root node</param>
/// <param name="_dataType">type this item will be choosen for, or member of the data item</param>
/// <param name="_fetchDataMethod">for hierarchical data, method to call for children fetching</param>
public ItemTemplate (Interface _iface, XmlReader reader, string _dataTest = "TypeOf" , string _dataType = null, string _fetchDataMethod = null)
else
il.Emit (OpCodes.Callvirt, miGetDatas);
}
-
-
-
}
}
Height = value.Height;
}
}
+ [XmlIgnore]
+ public SizeD SizeD => new SizeD (Width, Height);
[XmlIgnore]public Point Position{
get => new Point (X, Y);
set {
foreach (string en in enumType.GetEnumNames ()) {
RadioButton rb = new RadioButton (IFace);
rb.Caption = en;
- rb.Fit = true;
rb.LogicalParent = this;
if (enumValue.ToString () == en)
rb.IsChecked = true;
public virtual int CursorSize {
get { return _cursorSize; }
set {
- if (_cursorSize == value || value < 8)
+ if (_cursorSize == value || value < 4)
return;
_cursorSize = value;
RegisterForGraphicUpdate ();
}
#endregion
+ public override void onMouseClick (object sender, MouseButtonEventArgs e)
+ {
+ e.Handled = true;
+ base.onMouseClick (sender, e);
+ }
void onUp (object sender, MouseButtonEventArgs e)
{
Value += this.SmallIncrement;
-//
-// DesignInterface.cs
+// Copyright (c) 2013-2019 Bruyère Jean-Philippe <jp_bruyere@hotmail.com>
//
-// Author:
-// Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// Copyright (c) 2013-2017 Jean-Philippe Bruyère
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
+// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
+
using System;
using Crow;
using System.Globalization;