]> O.S.I.I.S - jp/crow.git/commitdiff
debug
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Sun, 13 Oct 2019 23:00:12 +0000 (01:00 +0200)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Sun, 13 Oct 2019 23:00:12 +0000 (01:00 +0200)
Crow/Crow.csproj
Crow/src/CompilerServices/CompilerServices.cs
Crow/src/Instantiator.cs
Crow/src/Interface.cs
Crow/src/ItemTemplate.cs
Crow/src/Rectangle.cs
Crow/src/Widgets/EnumSelector.cs
Crow/src/Widgets/Slider.cs
Crow/src/Widgets/Spinner.cs

index 3519cc7fc5504381d841442bcf0920a12266b553..e2bbd3f7a7034ee5fa5bca0e6b8601e0cd466d6c 100644 (file)
@@ -25,7 +25,7 @@
        </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'))">
index 8849895172dd0b09ac264750724abda1251e94cf..7e368a086b2150af329c4d2d57e8d6d583a5972e 100644 (file)
@@ -269,6 +269,8 @@ namespace Crow.IML
                                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))
index 1dcb989a9f0f53a54d334a9383f77ba7464bce43..1b37a7aec6aeb1f940758c555e6790d5cd3c2e51 100644 (file)
@@ -1318,9 +1318,10 @@ namespace Crow.IML {
                {
                        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>
@@ -1356,6 +1357,9 @@ namespace Crow.IML {
                                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);
@@ -1377,13 +1381,17 @@ namespace Crow.IML {
                                        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 ();
                        }
@@ -1402,8 +1410,9 @@ namespace Crow.IML {
                                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);
index cb836a9f6c09c3b569b3b4b731f20c857babe164..5488b559a42c7067db7f9c3ebea0e9cdd66ce8a4 100644 (file)
@@ -134,8 +134,8 @@ namespace Crow
                public void Init () {
                        loadStyling ();
 
-//                     initTooltip ();
-//                     initContextMenus ();
+                       initTooltip ();
+                       //initContextMenus ();
 
                        Startup ();
                }
@@ -210,15 +210,13 @@ namespace Crow
                }*/
 
                #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.
@@ -340,7 +338,7 @@ namespace Crow
                #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
@@ -368,7 +366,6 @@ namespace Crow
                                using (Stream stream = assembly.GetManifestResourceStream (s)) {
                                        new StyleReader (this.Styling, stream, s);
                                }
-
                        }
                }
                #endregion
@@ -490,11 +487,11 @@ namespace Crow
                /// <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
index e4615b7afe569ca628938d95905bd83358a0b03e..3b6cf0b27e0757dd21aa5a2549c7d34450da3c53 100644 (file)
@@ -114,7 +114,7 @@ namespace Crow
                /// <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)
@@ -127,7 +127,7 @@ namespace Crow
                /// <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)
@@ -272,9 +272,6 @@ namespace Crow
             else
                 il.Emit (OpCodes.Callvirt, miGetDatas);
         }
-
-       
-       
        }
 }
 
index afbb192d2805f2e702296ddfb23f0e8d41450171..a0e5ccf8a3a3f1dc3cdeb0cffcef558423c37e92 100644 (file)
@@ -41,6 +41,8 @@ namespace Crow {
                 Height = value.Height;
             }
         }
+               [XmlIgnore]
+               public SizeD SizeD => new SizeD (Width, Height); 
                [XmlIgnore]public Point Position{
                        get => new Point (X, Y);
                        set {
index 576eb95381459b8556c01fda86f35490e085d154..70985f2a37cd9d87f2dc4acc53db1eb77bba585e 100644 (file)
@@ -53,7 +53,6 @@ namespace Crow
                                                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;
index e4942b2b50a8fa4b100db730564f02371bed0fa2..acceced0413001e19767a819e590180f20d8f2a4 100644 (file)
@@ -83,7 +83,7 @@ namespace Crow
                public virtual int CursorSize {
                        get { return _cursorSize; }
                        set {
-                               if (_cursorSize == value || value < 8)
+                               if (_cursorSize == value || value < 4)
                                        return;
                                _cursorSize = value;
                                RegisterForGraphicUpdate ();
index 8a3bcd626d8d9765eaebcd85f95650a029907269..d9fd51f6fa3fd182224863f91d4af4f0adf21f38 100644 (file)
@@ -17,6 +17,11 @@ namespace Crow
                }
                #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;