]> O.S.I.I.S - jp/crow.git/commitdiff
made SeletedItem of templatedGroup writable 0.6.0
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Fri, 9 Feb 2018 19:44:48 +0000 (20:44 +0100)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Fri, 9 Feb 2018 19:48:02 +0000 (20:48 +0100)
13 files changed:
Crow.OpenTK.nuspec
Crow.sln
CrowIDE/src/ImlVisualEditor.cs
CrowIDE/src/MembersView.cs
CrowIDE/ui/CSProjExplorer.crow
CrowIDE/ui/GTreeExpITemp.crow
CrowIDE/ui/MembersItem.template
CrowIDE/ui/MembersView.template
CrowIDE/ui/imlEditor.crow
Tests/Tests.csproj
src/ExtensionsMethods.cs
src/GraphicObjects/TemplatedGroup.cs
src/Instantiator.cs

index e336b178238308e02d73f8ac70ccdd134b37dd88..9d49b0a4605813637dacde45f7c96c14b4e52955 100644 (file)
@@ -2,7 +2,7 @@
 <package >
        <metadata>
                <id>Crow.OpenTK</id>
-               <version>0.6.0-pre1</version>
+               <version>0.6.0</version>
                <title>C# Rapid Open Widget Toolkit</title>
                <authors>JP Bruyere</authors>
                <owners>Grand Tetras Software</owners>
@@ -21,13 +21,15 @@ Crow.OpenTK is the OpenTK ready version.
                        - Bug fix #36
                        - group item templates in single file
                        - instantiation from code clarification
-                       - Only run on mono >= 5.0
                        - Cairo mesh patterns support.
-                       - Image resources sharing among controls.            
+                       - Image resources sharing among controls.
+                       - Some small api changes (LoadInterface replaced by AddWidget overload
+                       - Documentations
+                       - Tooltip for GraphicObject class               
                </releaseNotes>
-               <copyright>Copyright 2013-2017</copyright>
+               <copyright>Copyright 2013-2018</copyright>
                <dependencies>
-                       <dependency id="OpenTK" version="3.0.0-git00041" />
+                       <dependency id="OpenTK" version="2.0.0" />
                </dependencies>
         <tags>Crow OpenTK OpenGL Widget Interface GUI C# .Net Mono</tags>
         <references>
index 70736ea4699658f8c1e19c9668855c431bb50f50..5fc9079fa00801de87694084d1ff5da14ab6d424 100644 (file)
--- a/Crow.sln
+++ b/Crow.sln
@@ -16,17 +16,13 @@ Global
        EndGlobalSection
        GlobalSection(ProjectConfigurationPlatforms) = postSolution
                {42C73BD8-51F5-4BB7-8EE9-9F0BE2D80A2C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-               {42C73BD8-51F5-4BB7-8EE9-9F0BE2D80A2C}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {42C73BD8-51F5-4BB7-8EE9-9F0BE2D80A2C}.Release|Any CPU.ActiveCfg = Release|Any CPU
-               {42C73BD8-51F5-4BB7-8EE9-9F0BE2D80A2C}.Release|Any CPU.Build.0 = Release|Any CPU
                {74289092-9F70-4941-AFCB-DFD7BE2140B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
                {74289092-9F70-4941-AFCB-DFD7BE2140B6}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {74289092-9F70-4941-AFCB-DFD7BE2140B6}.Release|Any CPU.ActiveCfg = Release|Any CPU
                {74289092-9F70-4941-AFCB-DFD7BE2140B6}.Release|Any CPU.Build.0 = Release|Any CPU
                {B6D911CD-1D09-42FC-B300-9187190F2AE1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-               {B6D911CD-1D09-42FC-B300-9187190F2AE1}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {B6D911CD-1D09-42FC-B300-9187190F2AE1}.Release|Any CPU.ActiveCfg = Release|Any CPU
-               {B6D911CD-1D09-42FC-B300-9187190F2AE1}.Release|Any CPU.Build.0 = Release|Any CPU
                {C2980F9B-4798-4C05-99E2-E174810F7C7B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
                {C2980F9B-4798-4C05-99E2-E174810F7C7B}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {C2980F9B-4798-4C05-99E2-E174810F7C7B}.Release|Any CPU.ActiveCfg = Release|Any CPU
index 9c51338f3cc0e5395b08f41c427bff3fd3e8127e..e238a7062fa2252ff3ad795f48e749505ff104c7 100644 (file)
@@ -129,19 +129,6 @@ namespace CrowIDE
                        get { return imlVE.GraphicTree; }
                }
 
-
-               public CrowMSBuild.Project CSProj {
-                       get {
-                               CrowMSBuild.Project proj = null;
-                               XmlSerializer serializer = new XmlSerializer(typeof(CrowMSBuild.Project));
-                               string path=@"/mnt/data2/devel/crow/Tests/Tests.csproj";
-                               using (StreamReader reader = new StreamReader (path)) {
-                                       proj = (CrowMSBuild.Project)serializer.Deserialize (reader);
-                               }
-                               return proj;
-                       }
-               }
-
                void reloadFromSource(){
                        if (string.IsNullOrEmpty (imlSource)) {
                                reload_iTor (null);
index 18f1a7096ee06666c5337158ec106db014574e37..67c712bda2bb76bf2fa983d6a930bdf3ee7e0431 100644 (file)
@@ -24,6 +24,7 @@ using System.Xml.Serialization;
 using System.ComponentModel;
 using System.Reflection;
 using System.Collections.Generic;
+using System.Linq;
 
 namespace CrowIDE
 {
@@ -47,7 +48,10 @@ namespace CrowIDE
                                try {
                                        if (!pi.PropertyType.IsAssignableFrom(value.GetType()) && pi.PropertyType != typeof(string)){
                                                if (pi.PropertyType.IsEnum) {
-                                                       pi.SetValue (instance, value);
+                                                       if (value is string) {
+                                                               pi.SetValue (instance, Enum.Parse (pi.PropertyType, (string)value));
+                                                       }else
+                                                               pi.SetValue (instance, value);
                                                } else {
                                                        MethodInfo me = pi.PropertyType.GetMethod
                                                                ("Parse", BindingFlags.Static | BindingFlags.Public,
@@ -65,9 +69,9 @@ namespace CrowIDE
                public string Type { get { return pi.PropertyType.IsEnum ?
                                        "System.Enum"
                                        : pi.PropertyType.FullName; }}
-               public string[] Choices {
+               public object[] Choices {
                        get {
-                               return Enum.GetNames (pi.PropertyType);
+                               return Enum.GetValues (pi.PropertyType).Cast<object>().ToArray();
                        }
                }
 
index f8155a23ffc73798bcc5311ef9a9d84566b2c767..5f9f99499599b2e47bea5bc507e660fe59201e30 100644 (file)
@@ -51,7 +51,7 @@
                        <HorizontalStack Height="Fit">
                                <GraphicObject Width="12" Height="10"/>
                                <TreeView Name="List" Height="Fit"
-                                       Template="#Crow.Templates.treeList.crow" />
+                                       Template="#Crow.Templates.treeList.template" />
                        </HorizontalStack>
                </Expandable>
        </ItemTemplate>
index 32eeb43b871ea843ca776a1adf0e8c7ef9661354..4be4f09413cb4964aea894639dacc7f0b4508506 100644 (file)
@@ -23,6 +23,6 @@
        <HorizontalStack Height="Fit">
                <GraphicObject Width="12" Height="10"/>
                <TreeView Name="List" Height="Fit"
-                       Template="#Crow.Templates.treeList.crow" />
+                       Template="#Crow.Templates.treeList.template" />
        </HorizontalStack>
 </Expandable>
index 4b1c97c7454d2a4964b58530a3efe309b3fe09af..abf8c24c567058e747187f4c495f322a25d985ec 100644 (file)
@@ -21,7 +21,7 @@
                        MouseLeave="{Background=Transparent}" >
                <Label Margin="1" Text="{Name}" Height="Fit" Width="50%"/>
                <ComboBox Margin="0"  Height="Stretched" Width="50%" Data="{Choices}"
-                               SelectedIndex="{²Value}">
+                               SelectedItem="{²Value}">
                        <Template>
                                <Popper Name="popper" PopDirection="Bottom">
                                        <Template>
index 484751165124867a71057e10a9b45d09ac2844fe..92f132f30067c68a12d53c165ffaba03a7154d14 100755 (executable)
@@ -2,7 +2,7 @@
 <Window Template="#Crow.ToolWindow.template" Caption="Properties" MinimumSize="10,10" Width="Stretched" Height="Stretched">
        <VerticalStack>
                <Border Height="Fit">
-                       <Label TextAlignment="Left" Text="{./Instance}" Width="Stretched"/>
+                       <Label TextAlignment="Left" Text="{../../../../Instance}" Width="Stretched"/>
                </Border>
                <Scroller  Name="scroller1" Margin="1" VerticalScrolling="true"         
                        ValueChanged="./_scroller_ValueChanged">
index 4df6b40de6121de577bf998032001cfafceb11ed..2b2fc8eccc86a54b84d0430d3e1cb71302528cd1 100644 (file)
@@ -29,9 +29,9 @@
 <!--           <HorizontalStack Height="Fit" Margin="2">
                        <Image Style="icon" Path="#CrowIDE.images.save.svg" MouseClick="onCommandSave"/>
                </HorizontalStack>-->
-               <Border Margin="1" Background="Onyx" Height="Fit">
+<!--           <Border Margin="1" Background="Onyx" Height="Fit">
                        <Label Width="Stretched" Margin="1" Text="{../../dv.SelectedItem}"/>
-               </Border>
+               </Border>-->
                <HorizontalStack>
                        <TreeView Name="treeview" Width="20%" Height="100%" IsRoot="true"
                                DataSource="{CurrentSolution}" Data="{Projects}"                                
index 75969d9b1a8c89db4ef7d224439f2fe96ef6fabb..7fd3f6ed004a7861bb71c90501fdc793197c109c 100644 (file)
@@ -8,7 +8,7 @@
     <OutputType>Exe</OutputType>
     <RootNamespace>Tests</RootNamespace>
     <AssemblyName>Tests</AssemblyName>
-    <StartupObject>Tests.BasicTests</StartupObject>
+    <StartupObject>Tests.Showcase</StartupObject>
     <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
     <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
     <ReleaseVersion>0.5</ReleaseVersion>
index 6198dee6185e9d67ae5378e10c9154de1ada7e05..6697be626de71f83754b1996899083aa79b87df7 100644 (file)
@@ -125,6 +125,14 @@ namespace Crow
                {
                        return c == '\t' || c == '\r' || c == '\n' || char.IsWhiteSpace (c);
                }
+               public static object GetDefaultValue(this object obj)
+               {                       
+                       Type t = obj.GetType ();
+                       if (t.IsValueType)
+                               return Activator.CreateInstance (t);
+                       
+                       return null;
+               }
        }
 }
 
index c32b2c44f4a7651e97b80e3e4956b55e7e906334..34d5772700a81bf28226c31ba7a1aadb7760a6cd 100644 (file)
@@ -148,7 +148,18 @@ namespace Crow
                        }
                }
                [XmlIgnore]public virtual object SelectedItem{
-                       get { return data == null ? null : _selectedIndex < 0 ? null : data[_selectedIndex]; }
+                       get { return data == null ? null : _selectedIndex < 0 ? data.GetDefaultValue() : data[_selectedIndex]; }
+                       set {
+                               if (data == null) {
+                                       SelectedIndex = -1;
+                                       return;
+                               }
+                               //TODO:double check if value type will be notified to binding sys
+                               if (value == SelectedItem)
+                                       return;
+                               
+                               SelectedIndex = data.IndexOf (value);
+                       }
                }
                [XmlIgnore]public bool HasItems {
                        get { return Items.Count > 0; }
index 297337edd31dd35026923fb20440cc0852708995..b3f070e7d609d1ba7231e36c296cb49caf900c59 100644 (file)
@@ -890,6 +890,9 @@ namespace Crow.IML
 
                                CompilerServices.emitConvert (il, piSource.PropertyType);
 
+                               if (!piSource.CanWrite)
+                                       throw new Exception ("Source member of bindind is read only:" + piSource.ToString());
+
                                il.Emit (OpCodes.Callvirt, piSource.GetSetMethod ());
 
                                il.MarkLabel (endMethod);